51 lines
878 B
Go
51 lines
878 B
Go
|
|
package model
|
||
|
|
|
||
|
|
// ChatRole 消息角色
|
||
|
|
type ChatRole string
|
||
|
|
|
||
|
|
const (
|
||
|
|
ChatRoleSystem ChatRole = "system"
|
||
|
|
ChatRoleUser ChatRole = "user"
|
||
|
|
ChatRoleAssistant ChatRole = "assistant"
|
||
|
|
ChatRoleTool ChatRole = "tool"
|
||
|
|
)
|
||
|
|
|
||
|
|
// ChatMessage 聊天消息
|
||
|
|
type ChatMessage struct {
|
||
|
|
Role ChatRole
|
||
|
|
Content string
|
||
|
|
ToolCallID string
|
||
|
|
Name string
|
||
|
|
ToolCalls []ChatToolCall
|
||
|
|
}
|
||
|
|
|
||
|
|
// ChatToolCall 工具调用请求
|
||
|
|
type ChatToolCall struct {
|
||
|
|
ID string
|
||
|
|
Name string
|
||
|
|
Arguments string
|
||
|
|
}
|
||
|
|
|
||
|
|
// ChatReply 聊天回复
|
||
|
|
type ChatReply struct {
|
||
|
|
Content string
|
||
|
|
ToolCalls []ChatToolCall
|
||
|
|
}
|
||
|
|
|
||
|
|
// ChatStreamEvent 流式事件
|
||
|
|
type ChatStreamEvent struct {
|
||
|
|
Delta string
|
||
|
|
ToolCalls []ChatToolCall
|
||
|
|
Done bool
|
||
|
|
}
|
||
|
|
|
||
|
|
// ChatContent 聊天输入内容
|
||
|
|
type ChatContent struct {
|
||
|
|
Texts []TextPart
|
||
|
|
}
|
||
|
|
|
||
|
|
// TextPart 文本片段
|
||
|
|
type TextPart struct {
|
||
|
|
Message string
|
||
|
|
}
|