样式修改
This commit is contained in:
1 parent
114ee8f6ac
commit
e3d8e534f6
6 files changed
+739
-48
No files matched your search
@@ -57,7 +57,9 @@ import {
|
||||
} from "@/roundtable-planning/api/multi-agent";
|
||||
import {
|
||||
initIntent,
|
||||
IntentInitError,
|
||||
streamIntent,
|
||||
type IntentErrorDetail,
|
||||
type IntentStreamPhase,
|
||||
type IntentSummary,
|
||||
} from "@/roundtable-planning/api/intent";
|
||||
@@ -504,6 +506,8 @@ export default function RoundtablePlanningPage() {
|
||||
const [intentThreadId, setIntentThreadId] = useState<string | null>(null);
|
||||
const [intentReady, setIntentReady] = useState<IntentSummary | null>(null);
|
||||
const [intentInitError, setIntentInitError] = useState<string | null>(null);
|
||||
// 后端 _diagnose_exception 输出的结构化诊断,有就额外渲染 hint + trace_tail 面板。
|
||||
const [intentInitErrorDetail, setIntentInitErrorDetail] = useState<IntentErrorDetail | null>(null);
|
||||
const [isIntentSending, setIsIntentSending] = useState<boolean>(false);
|
||||
const [pendingIntentClarificationMsgId, setPendingIntentClarificationMsgId] = useState<number | null>(null);
|
||||
const [intentClarificationSelections, setIntentClarificationSelections] = useState<
|
||||
@@ -1225,6 +1229,7 @@ export default function RoundtablePlanningPage() {
|
||||
const myGen = ++step1InitGenRef.current;
|
||||
setIntentReady(null);
|
||||
setIntentInitError(null);
|
||||
setIntentInitErrorDetail(null);
|
||||
setIntentThreadId(null);
|
||||
setPendingIntentClarificationMsgId(null);
|
||||
setIntentClarificationSelections(new Map());
|
||||
@@ -1256,7 +1261,14 @@ export default function RoundtablePlanningPage() {
|
||||
} catch (err) {
|
||||
if (step1InitGenRef.current !== myGen) return;
|
||||
console.error("init intent failed:", err);
|
||||
setIntentInitError((err as Error).message);
|
||||
if (err instanceof IntentInitError) {
|
||||
// 优先使用后端的可读 message;若 detail 在,渲染诊断面板。
|
||||
setIntentInitError(err.detail?.message || err.message);
|
||||
setIntentInitErrorDetail(err.detail);
|
||||
} else {
|
||||
setIntentInitError((err as Error).message);
|
||||
setIntentInitErrorDetail(null);
|
||||
}
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
@@ -1420,6 +1432,7 @@ export default function RoundtablePlanningPage() {
|
||||
setIntentThreadId(draft.step1.intentThreadId);
|
||||
setIntentReady(draft.step1.intentReady);
|
||||
setIntentInitError(null);
|
||||
setIntentInitErrorDetail(null);
|
||||
setInteractiveMessages(draft.step1.interactiveMessages as typeof interactiveMessages);
|
||||
setTimelineEntries(draft.step1.timelineEntries as typeof timelineEntries);
|
||||
step1InitRef.current = true;
|
||||
@@ -1629,6 +1642,15 @@ export default function RoundtablePlanningPage() {
|
||||
return next;
|
||||
});
|
||||
} else if (res.status === "error") {
|
||||
// 同时把诊断信息写到顶部面板:toast 一闪而过,面板能稳定展示 hint + trace_tail
|
||||
// 方便用户截图发给后端排查。
|
||||
if (res.errorDetail) {
|
||||
setIntentInitError(res.errorDetail.message || res.content);
|
||||
setIntentInitErrorDetail(res.errorDetail);
|
||||
} else {
|
||||
setIntentInitError(res.content);
|
||||
setIntentInitErrorDetail(null);
|
||||
}
|
||||
triggerToast(`❌ 智能体调用失败: ${res.content}`);
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -1955,41 +1977,6 @@ export default function RoundtablePlanningPage() {
|
||||
|
||||
{/* Right Actions */}
|
||||
<div className="flex items-center gap-2">
|
||||
{/* 全局模型选择器
|
||||
─────────────────────────────────────────────
|
||||
影响 Step 1 / 推荐 / Step 2 init / 总控 leader / 子席位 special
|
||||
所有 API 调用。Persona 抽屉里 per-seat 设置的 model 优先级更高。
|
||||
选项来自 /api/models(由 config.yaml 配置),内网部署只需配自家模型。 */}
|
||||
<label className="flex items-center gap-1.5 bg-white border border-[#e2e8f0] rounded-xl px-2.5 py-1.5 text-xs font-bold text-[#334155] dark:border-border dark:bg-secondary dark:text-foreground">
|
||||
<Cpu className="w-3.5 h-3.5 text-primary" />
|
||||
<span className="text-[10px] text-slate-400 font-mono">模型</span>
|
||||
<select
|
||||
id="global-model-select"
|
||||
value={selectedModel}
|
||||
onChange={(e) => setSelectedModel(e.target.value)}
|
||||
disabled={modelsLoading || availableModels.length === 0}
|
||||
title={
|
||||
modelsLoading
|
||||
? "正在加载模型列表…"
|
||||
: availableModels.length === 0
|
||||
? "未在 config.yaml 中配置任何模型"
|
||||
: "切换全局推理模型;不影响 Persona 抽屉里已设置的 per-seat 覆盖"
|
||||
}
|
||||
className="bg-transparent border-none outline-none text-xs font-bold text-slate-700 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed dark:text-foreground"
|
||||
>
|
||||
{availableModels.length === 0 && (
|
||||
<option value="">{modelsLoading ? "加载中…" : "未配置模型"}</option>
|
||||
)}
|
||||
{availableModels.map((m) => (
|
||||
<option key={m.name} value={m.name}>
|
||||
{m.display_name && m.display_name !== m.name
|
||||
? `${m.display_name} (${m.name})`
|
||||
: m.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<button
|
||||
id="new-task-btn"
|
||||
onClick={handleStartNewTask}
|
||||
@@ -2512,9 +2499,40 @@ export default function RoundtablePlanningPage() {
|
||||
</button>
|
||||
</div>
|
||||
{intentInitError && (
|
||||
<p className="mt-2 text-[11px] text-red-500 font-medium">
|
||||
智能体初始化失败: {intentInitError}
|
||||
</p>
|
||||
<div className="mt-2 rounded-lg border border-red-200 bg-red-50/70 p-3 text-[11px] leading-relaxed">
|
||||
<div className="flex items-center gap-2 mb-1.5">
|
||||
<span className="font-bold text-red-700">智能体初始化失败</span>
|
||||
{intentInitErrorDetail?.code && (
|
||||
<span className="px-1.5 py-0.5 bg-red-100 text-red-700 rounded font-mono text-[10px]">
|
||||
{intentInitErrorDetail.code}
|
||||
</span>
|
||||
)}
|
||||
{intentInitErrorDetail?.exception_type && (
|
||||
<span className="text-[10px] text-red-600 font-mono">
|
||||
{intentInitErrorDetail.exception_type}
|
||||
{intentInitErrorDetail.root_type && intentInitErrorDetail.root_type !== intentInitErrorDetail.exception_type
|
||||
? ` → ${intentInitErrorDetail.root_type}`
|
||||
: ""}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-red-700 font-medium break-all">{intentInitError}</p>
|
||||
{intentInitErrorDetail?.hint && (
|
||||
<p className="mt-1.5 text-red-800 bg-amber-50 border-l-2 border-amber-400 px-2 py-1 rounded-sm">
|
||||
<span className="font-bold">💡 建议:</span> {intentInitErrorDetail.hint}
|
||||
</p>
|
||||
)}
|
||||
{intentInitErrorDetail?.trace_tail && intentInitErrorDetail.trace_tail.length > 0 && (
|
||||
<details className="mt-1.5">
|
||||
<summary className="cursor-pointer text-red-600 hover:text-red-800 select-none text-[10px] font-bold">
|
||||
展开 traceback 末段(共 {intentInitErrorDetail.trace_tail.length} 行)
|
||||
</summary>
|
||||
<pre className="mt-1 max-h-48 overflow-auto bg-slate-900 text-slate-100 text-[10px] leading-snug p-2 rounded font-mono whitespace-pre">
|
||||
{intentInitErrorDetail.trace_tail.join("\n")}
|
||||
</pre>
|
||||
</details>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -3652,6 +3670,44 @@ export default function RoundtablePlanningPage() {
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{/* Panel 0: 推理模型选择器
|
||||
─────────────────────────────────────────────────────
|
||||
全局选中模型(selectedModel)影响 Step 1 / 推荐 / Step 2 init /
|
||||
总控 leader / 子席位 special 所有 API 调用。Persona 抽屉里
|
||||
per-seat 覆盖优先级更高。
|
||||
选项来自 /api/models(由 config.yaml 配置),内网部署只需配自家模型。 */}
|
||||
<div className="bg-white border border-slate-200/50 rounded-2xl p-4 shadow-[0_2px_8px_rgba(0,0,0,0.01)]">
|
||||
<div className="flex items-center gap-2 border-b border-slate-100 pb-2.5 mb-2.5">
|
||||
<Cpu className="w-4 h-4 text-primary" strokeWidth={2.5} />
|
||||
<h2 className="text-xs font-bold text-slate-900 uppercase tracking-widest">推理模型</h2>
|
||||
</div>
|
||||
<select
|
||||
id="global-model-select"
|
||||
value={selectedModel}
|
||||
onChange={(e) => setSelectedModel(e.target.value)}
|
||||
disabled={modelsLoading || availableModels.length === 0}
|
||||
title={
|
||||
modelsLoading
|
||||
? "正在加载模型列表…"
|
||||
: availableModels.length === 0
|
||||
? "未在 config.yaml 中配置任何模型"
|
||||
: "切换全局推理模型;不影响 Persona 抽屉里已设置的 per-seat 覆盖"
|
||||
}
|
||||
className="w-full bg-slate-50/50 border border-slate-100 rounded-xl px-3 py-2 text-xs font-bold text-slate-700 cursor-pointer focus:outline-none focus:border-primary focus:ring-1 focus:ring-[var(--brand-200)]/50 disabled:opacity-50 disabled:cursor-not-allowed dark:bg-secondary dark:text-foreground dark:border-border"
|
||||
>
|
||||
{availableModels.length === 0 && (
|
||||
<option value="">{modelsLoading ? "加载中…" : "未配置模型"}</option>
|
||||
)}
|
||||
{availableModels.map((m) => (
|
||||
<option key={m.name} value={m.name}>
|
||||
{m.display_name && m.display_name !== m.name
|
||||
? `${m.display_name} (${m.name})`
|
||||
: m.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{/* Panel 1: 当前意图摘要 */}
|
||||
<div className="bg-white border border-slate-200/50 rounded-2xl p-4.5 shadow-[0_2px_8px_rgba(0,0,0,0.01)]">
|
||||
<div className="flex items-center gap-2 border-b border-slate-100 pb-2.5 mb-2.5">
|
||||
|
||||
Reference in new issue
Block a user