Files
claude-code/src/commands/review/UltrareviewPreflightDialog.tsx
claude-code-best efaf4afd9c feat: 添加 Provider Registry、StatusLine、Cache Stats 和其他增强
- providerRegistry: OpenAI 兼容 provider 切换(Cerebras/Groq/DeepSeek/Qwen)
- StatusLine: 增强状态栏(缓存命中率、TTL 倒计时、自定义 shell 命令)
- cacheStats: 缓存命中率和 token 签名追踪
- ultrareviewPreflight: 代码审查预检服务
- SkillsMenu/filterSkills: 技能菜单过滤增强
- MagicDocs/langfuse prompts: 提示词更新
- claude.ts: API 客户端更新

Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
2026-05-09 23:04:35 +08:00

57 lines
1.7 KiB
TypeScript

import React, { useCallback, useRef, useState } from 'react';
import { Box, Dialog, Text } from '@anthropic/ink';
import { Select } from '../../components/CustomSelect/select.js';
type Props = {
billingNote: string | null;
onConfirm: (signal: AbortSignal) => Promise<void>;
onCancel: () => void;
};
/**
* Dialog shown when /v1/ultrareview/preflight returns action='confirm'.
* Displays the server-provided billing_note (or a generic fallback) and
* gives the user a Proceed / Cancel choice.
*/
export function UltrareviewPreflightDialog({ billingNote, onConfirm, onCancel }: Props): React.ReactNode {
const [isLaunching, setIsLaunching] = useState(false);
const abortControllerRef = useRef(new AbortController());
const handleSelect = useCallback(
(value: string) => {
if (value === 'proceed') {
setIsLaunching(true);
void onConfirm(abortControllerRef.current.signal).catch(() => setIsLaunching(false));
} else {
onCancel();
}
},
[onConfirm, onCancel],
);
const handleCancel = useCallback(() => {
abortControllerRef.current.abort();
onCancel();
}, [onCancel]);
const options = [
{ label: 'Proceed', value: 'proceed' },
{ label: 'Cancel', value: 'cancel' },
];
const displayNote = billingNote ?? 'This run may incur additional cost.';
return (
<Dialog title="Ultrareview — additional cost" onCancel={handleCancel} color="background">
<Box flexDirection="column" gap={1}>
<Text>{displayNote}</Text>
{isLaunching ? (
<Text color="background">Launching</Text>
) : (
<Select options={options} onChange={handleSelect} onCancel={handleCancel} />
)}
</Box>
</Dialog>
);
}