89 lines
1.6 KiB
TypeScript
89 lines
1.6 KiB
TypeScript
// 模型类型
|
||
export interface Model {
|
||
id: string;
|
||
name: string;
|
||
displayName: string;
|
||
tag: string;
|
||
}
|
||
|
||
// 工具类型
|
||
export interface Tool {
|
||
id: string;
|
||
name: string;
|
||
icon: string;
|
||
enabled: boolean;
|
||
}
|
||
|
||
// 聊天记录类型
|
||
export interface ChatHistory {
|
||
id: string;
|
||
title: string;
|
||
createdAt: Date;
|
||
updatedAt: Date;
|
||
}
|
||
|
||
// 消息类型
|
||
export interface Message {
|
||
id: string;
|
||
role: 'user' | 'assistant';
|
||
content: string;
|
||
timestamp: Date;
|
||
/** 工具调用记录 */
|
||
toolCalls?: ToolCall[];
|
||
/** 工具调用结果 */
|
||
toolResults?: ToolResult[];
|
||
}
|
||
|
||
// 工具调用记录
|
||
export interface ToolCall {
|
||
id: string;
|
||
name: string;
|
||
input: Record<string, unknown>;
|
||
}
|
||
|
||
// 工具调用结果
|
||
export interface ToolResult {
|
||
toolUseId: string;
|
||
toolName: string;
|
||
content: string;
|
||
isError?: boolean;
|
||
/** 代码执行产生的图片(Base64) */
|
||
images?: string[];
|
||
/** 执行引擎 */
|
||
engine?: 'pyodide' | 'piston';
|
||
/** 执行时间 (ms) */
|
||
executionTime?: number;
|
||
}
|
||
|
||
// 用户类型
|
||
export interface User {
|
||
id: string;
|
||
email: string;
|
||
name: string;
|
||
plan: 'free' | 'pro' | 'enterprise';
|
||
avatar?: string;
|
||
}
|
||
|
||
// 设置类型
|
||
export interface Settings {
|
||
cchUrl: string;
|
||
cchApiKeyConfigured: boolean;
|
||
defaultModel: string;
|
||
defaultTools: string[];
|
||
theme: 'light' | 'dark' | 'system';
|
||
language: string;
|
||
enableThinking: boolean;
|
||
saveChatHistory: boolean;
|
||
// 旧字段(兼容)
|
||
enableWebSearch?: boolean;
|
||
enableCodeExecution?: boolean;
|
||
}
|
||
|
||
// 快捷操作类型
|
||
export interface QuickAction {
|
||
id: string;
|
||
label: string;
|
||
icon: string;
|
||
prompt?: string;
|
||
}
|