package model // ChatMessage 表示用户、模型或工具的一条消息。 type ChatMessage struct { Role string `json:"role"` Content any `json:"content"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` } // ChatContentPart 表示用户消息中的一段文字或图片。 type ChatContentPart struct { Type string `json:"type"` Text string `json:"text,omitempty"` ImageURL *ChatImageURL `json:"image_url,omitempty"` } // ChatImageURL 保存图片地址,也支持 base64 data URL。 type ChatImageURL struct { URL string `json:"url"` } // ToolCall 表示模型请求执行的工具调用。 type ToolCall struct { Index *int `json:"index,omitempty"` ID string `json:"id"` Type string `json:"type"` Function ToolFunction `json:"function"` } // ToolFunction 表示工具调用的函数名称和参数。 type ToolFunction struct { Name string `json:"name"` Arguments string `json:"arguments"` }