feat(desktop): wire template welcome_message + quick_commands to chat UI
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
- Add welcomeMessage/quickCommands fields to Clone interface - Persist template welcome/quick data via updateClone after creation - FirstConversationPrompt: prefer template-provided welcome message over dynamically generated one - FirstConversationPrompt: render template quick_commands as chips instead of hardcoded QUICK_ACTIONS when available - Tighten assign/unassign template endpoint permissions from model:read to relay:use (self-service operation for all authenticated users)
This commit is contained in:
@@ -36,6 +36,8 @@ export interface Clone {
|
||||
notes?: string; // 用户备注
|
||||
onboardingCompleted?: boolean; // 是否完成首次引导
|
||||
source_template_id?: string; // 模板来源 ID
|
||||
welcomeMessage?: string; // 模板预设欢迎语
|
||||
quickCommands?: Array<{ label: string; command: string }>; // 模板预设快捷命令
|
||||
}
|
||||
|
||||
export interface UsageStats {
|
||||
@@ -226,10 +228,29 @@ export const useAgentStore = create<AgentStore>((set, get) => ({
|
||||
console.warn('Failed to persist temperature/max_tokens:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// Persist welcome_message + quick_commands as clone metadata
|
||||
if (template.welcome_message || (template.quick_commands && template.quick_commands.length > 0)) {
|
||||
try {
|
||||
await client.updateClone(cloneId, {
|
||||
welcomeMessage: template.welcome_message || '',
|
||||
quickCommands: template.quick_commands || [],
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn('Failed to persist welcome_message/quick_commands:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await get().loadClones();
|
||||
return result?.clone;
|
||||
|
||||
// Merge template welcome/quick data into the returned clone for immediate use
|
||||
const createdClone = result?.clone as Record<string, unknown> | undefined;
|
||||
if (createdClone) {
|
||||
if (template.welcome_message) createdClone.welcomeMessage = template.welcome_message;
|
||||
if (template.quick_commands?.length) createdClone.quickCommands = template.quick_commands;
|
||||
}
|
||||
return createdClone as Clone | undefined;
|
||||
} catch (error) {
|
||||
set({ error: String(error) });
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user