fix(ui): 5 项 E2E 测试 Bug 修复 — Agent 502 / 错误持久化 / 模型标记 / 侧面板 / 记忆页
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- BUG-01: createFromTemplate 在 saas-relay 模式下 try-catch 跳过本地 Kernel - BUG-02: upsertActiveConversation 持久化前剥离 error/streaming/optimistic 字段 - BUG-04: ModelSelector 添加 available 标记,ChatArea 追踪失败模型 ID - BUG-05: VikingPanel 移除 status?.available 门控,不可用时 disabled + 重连按钮 - BUG-06: 侧面板 tooltip 改为"查看产物文件",空状态增加图标和说明
This commit is contained in:
@@ -233,16 +233,30 @@ export const useAgentStore = create<AgentStore>((set, get) => ({
|
||||
?? 'default';
|
||||
|
||||
// Step 2: Create clone with merged data from backend
|
||||
const result = await client.createClone({
|
||||
name: config.name,
|
||||
emoji: config.emoji,
|
||||
personality: config.personality,
|
||||
scenarios: template.scenarios,
|
||||
communicationStyle: config.communication_style,
|
||||
model: resolvedModel,
|
||||
});
|
||||
|
||||
const cloneId = result?.clone?.id;
|
||||
// In saas-relay mode the local Kernel may not be running,
|
||||
// so wrap createClone in a try-catch and skip gracefully.
|
||||
let cloneId: string | undefined;
|
||||
let freshClone: Clone | undefined;
|
||||
try {
|
||||
const result = await client.createClone({
|
||||
name: config.name,
|
||||
emoji: config.emoji,
|
||||
personality: config.personality,
|
||||
scenarios: template.scenarios,
|
||||
communicationStyle: config.communication_style,
|
||||
model: resolvedModel,
|
||||
});
|
||||
cloneId = result?.clone?.id;
|
||||
} catch (cloneErr) {
|
||||
log.warn('[AgentStore] createClone failed (likely saas-relay mode without local kernel):', cloneErr);
|
||||
// In SaaS relay mode, the agent was already created server-side in Step 1.
|
||||
// Just refresh the clone list from the server.
|
||||
await get().loadClones();
|
||||
freshClone = get().clones.find(c => c.name === config.name);
|
||||
if (freshClone) {
|
||||
cloneId = freshClone.id;
|
||||
}
|
||||
}
|
||||
|
||||
if (cloneId) {
|
||||
// Persist SOUL.md via identity system
|
||||
@@ -286,7 +300,15 @@ export const useAgentStore = create<AgentStore>((set, get) => ({
|
||||
await get().loadClones();
|
||||
|
||||
// Return a fresh clone from the store (immutable — no in-place mutation)
|
||||
const freshClone = get().clones.find((c) => c.id === cloneId);
|
||||
const storedClone = get().clones.find((c) => c.id === cloneId);
|
||||
if (storedClone) {
|
||||
return {
|
||||
...storedClone,
|
||||
...(config.welcome_message ? { welcomeMessage: config.welcome_message } : {}),
|
||||
...(config.quick_commands?.length ? { quickCommands: config.quick_commands } : {}),
|
||||
};
|
||||
}
|
||||
// Fallback: if clone was found by name earlier in the catch path
|
||||
if (freshClone) {
|
||||
return {
|
||||
...freshClone,
|
||||
@@ -294,7 +316,7 @@ export const useAgentStore = create<AgentStore>((set, get) => ({
|
||||
...(config.quick_commands?.length ? { quickCommands: config.quick_commands } : {}),
|
||||
};
|
||||
}
|
||||
return result?.clone as Clone | undefined;
|
||||
return undefined;
|
||||
} catch (error) {
|
||||
set({ error: String(error) });
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user