claude-code-cchui/src/types/index.ts
gaoziman 55dcb618af feat(类型): 更新模型类型定义
- Model 接口新增 displayName 字段
- 添加 modelType 类型(claude | codex)用于区分模型类型
2025-12-20 01:04:14 +08:00

89 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 模型类型
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;
}