50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
// --- Types (从后端模型同步或手动定义) ---
|
|
// 这些类型应该与后端 pydantic_models.py 中的 Read 模型匹配
|
|
export interface Assistant {
|
|
id: string;
|
|
name: string;
|
|
description?: string | null;
|
|
avatar?: string | null;
|
|
system_prompt: string;
|
|
model: string;
|
|
temperature: number;
|
|
}
|
|
// 创建助手时发送的数据类型
|
|
export interface AssistantCreateData {
|
|
name: string;
|
|
description?: string | null;
|
|
avatar?: string | null;
|
|
system_prompt: string;
|
|
model: string;
|
|
temperature: number;
|
|
}
|
|
|
|
// 更新助手时发送的数据类型 (所有字段可选)
|
|
export type AssistantUpdateData = Partial<AssistantCreateData>;
|
|
|
|
// --- Types ---
|
|
export interface Session {
|
|
id: string;
|
|
title: string;
|
|
assistant_id: string;
|
|
created_at: string; // ISO date string
|
|
updated_at?: string | null; // Add updated_at
|
|
}
|
|
|
|
// Message type from backend
|
|
export interface Message {
|
|
id: string;
|
|
session_id: string;
|
|
sender: "user" | "ai"; // Or extend with 'system' if needed
|
|
text: string;
|
|
order: number;
|
|
created_at: string; // ISO date string
|
|
}
|
|
|
|
// 聊天响应类型
|
|
export interface ChatApiResponse {
|
|
reply: string;
|
|
session_id?: string | null; // 后端返回的新 session id
|
|
session_title?: string | null; // 后端返回的新 session title
|
|
}
|