forked from lobehub/lobe-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchatMessage.ts
71 lines (61 loc) · 1.29 KB
/
chatMessage.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { PluginRequestPayload } from '@lobehub/chat-plugin-sdk';
import { ErrorType } from '@/types/fetch';
import { Translate } from '@/types/translate';
import { LLMRoleType } from './llm';
import { BaseDataModel } from './meta';
/**
* 聊天消息错误对象
*/
export interface ChatMessageError {
body?: any;
message: string;
type: ErrorType;
}
export interface OpenAIFunctionCall {
arguments?: string;
name: string;
}
export interface ChatTranslate extends Translate {
content?: string;
}
export interface ChatTTS {
init?: boolean;
}
export interface ChatMessage extends BaseDataModel {
/**
* @title 内容
* @description 消息内容
*/
content: string;
error?: any;
// 扩展字段
extra?: {
fromModel?: string;
// 翻译
translate?: ChatTranslate;
// TTS
tts?: ChatTTS;
} & Record<string, any>;
files?: string[];
/**
* replace with plugin
* @deprecated
*/
function_call?: OpenAIFunctionCall;
name?: string;
parentId?: string;
plugin?: PluginRequestPayload;
pluginState?: any;
// 引用
quotaId?: string;
/**
* 角色
* @description 消息发送者的角色
*/
role: LLMRoleType;
/**
* 保存到主题的消息
*/
topicId?: string;
}
export type ChatMessageMap = Record<string, ChatMessage>;