feat: manually mirror opencoze's code from bytedance
Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
8
idl/conversation/agentrun_service.thrift
Normal file
8
idl/conversation/agentrun_service.thrift
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
include "./run.thrift"
|
||||
namespace go conversation.agentrun
|
||||
|
||||
service AgentRunService {
|
||||
run.AgentRunResponse AgentRun(1: run.AgentRunRequest request)(api.post='/api/conversation/chat', api.category="conversation", api.gen_path= "agent_run")
|
||||
run.ChatV3Response ChatV3(1: run.ChatV3Request request)(api.post = "/v3/chat", api.category="chat", api.tag="openapi", api.gen_path="chat")
|
||||
}
|
||||
15
idl/conversation/common.thrift
Normal file
15
idl/conversation/common.thrift
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
namespace go conversation.common
|
||||
|
||||
enum Scene{
|
||||
Default = 0,
|
||||
Explore = 1,
|
||||
BotStore = 2,
|
||||
CozeHome = 3,
|
||||
Playground = 4, //调试
|
||||
Evaluation = 5, // 评测平台
|
||||
AgentAPP = 6,
|
||||
PromptOptimize = 7, //prompt优化
|
||||
GenerateAgentInfo = 8 // createbot的nl2bot功能
|
||||
SceneOpenApi = 9, //openapi
|
||||
}
|
||||
94
idl/conversation/conversation.thrift
Normal file
94
idl/conversation/conversation.thrift
Normal file
@@ -0,0 +1,94 @@
|
||||
include "../base.thrift"
|
||||
include "common.thrift"
|
||||
|
||||
namespace go conversation.conversation
|
||||
|
||||
struct ClearConversationHistoryRequest {
|
||||
1: required i64 conversation_id ( api.js_conv="true")
|
||||
2: optional common.Scene scene
|
||||
3: optional i64 bot_id ( api.js_conv="true")
|
||||
}
|
||||
|
||||
struct ClearConversationHistoryResponse {
|
||||
1: i64 code
|
||||
2: string msg
|
||||
3: required i64 new_section_id ( api.js_conv="true")
|
||||
}
|
||||
|
||||
struct ClearConversationCtxRequest {
|
||||
1: required i64 conversation_id ( api.js_conv="true")
|
||||
2: optional common.Scene scene
|
||||
3: optional list<string> insert_history_message_list, // 存在需要插入聊天的情况
|
||||
}
|
||||
|
||||
struct ClearConversationCtxResponse {
|
||||
1: i64 code
|
||||
2: string msg
|
||||
3: required i64 new_section_id ( api.js_conv="true")
|
||||
}
|
||||
|
||||
|
||||
struct ConversationData {
|
||||
1: i64 Id (api.body = "id", agw.key = "id", api.js_conv="true")
|
||||
2: i64 CreatedAt (api.body = "created_at", agw.key = "created_at")
|
||||
3: map<string,string> MetaData (api.body = "meta_data", agw.key = "meta_data")
|
||||
4: optional i64 CreatorID (api.body = "creator_d", agw.key = "creator_d", api.js_conv="true")
|
||||
5: optional i64 ConnectorID (api.body = "connector_id", agw.key="connector_id", api.js_conv="true")
|
||||
6: optional i64 LastSectionID (api.body="last_section_id", api.js_conv="true")
|
||||
7: optional i64 AccountID (api.body = "account_id")
|
||||
}
|
||||
|
||||
struct CreateConversationRequest {
|
||||
1: optional map<string,string> MetaData (api.body = "meta_data") //自定义透传字段
|
||||
3: optional i64 BotId (api.body = "bot_id", api.js_conv="true")
|
||||
4: optional i64 ConnectorId (api.body= "connector_id", api.js_conv="true")
|
||||
}
|
||||
|
||||
struct CreateConversationResponse {
|
||||
1: i64 code
|
||||
2: string msg
|
||||
3: optional ConversationData ConversationData (api.body = "data")
|
||||
}
|
||||
|
||||
struct ClearConversationApiRequest {
|
||||
1: required i64 ConversationID (api.path="conversation_id", api.js_conv="true",)
|
||||
|
||||
255: base.Base Base
|
||||
}
|
||||
|
||||
struct Section {
|
||||
1: i64 id (agw.key = "id", api.js_conv = "true")
|
||||
2: i64 conversation_id (agw.key = "conversation_id", api.js_conv = "true")
|
||||
}
|
||||
|
||||
struct ClearConversationApiResponse {
|
||||
1 : i64 code (api.body = "code", agw.key="code") // 错误code
|
||||
2 : string msg (api.body = "msg", agw.key = "msg") // 错误消息
|
||||
3 : Section data (api.body = "data", agw.key = "data") // section 信息
|
||||
|
||||
255: base.BaseResp BaseResp
|
||||
}
|
||||
|
||||
struct ListConversationsApiRequest {
|
||||
1 : i64 page_num (api.query = "page_num", agw.key = "page_num")
|
||||
2 : i64 page_size (api.query = "page_size", agw.key = "page_size")
|
||||
3 : string sort_order (api.query = "sort_order", agw.key = "sort_order") // 可选值:ASC、DESC
|
||||
4 : string sort_field (api.query = "sort_field", age.key = "sort_field") // 可选值:created_at创建时间
|
||||
5 : required i64 bot_id (api.query = "bot_id", agw.key = "bot_id",api.js_conv="true")
|
||||
6 : optional i64 connector_id (api.query = "connector_id", agw.key = "connector_id",api.js_conv="true")
|
||||
|
||||
255: base.Base Base
|
||||
}
|
||||
|
||||
struct ListConversationsApiResponse {
|
||||
1 : i64 code (api.body = "code", agw.key="code") // 错误code
|
||||
2 : string msg (api.body = "msg", agw.key = "msg") // 错误消息
|
||||
3 : ListConversationData data (api.body = "data", agw.key = "data")
|
||||
255: base.BaseResp BaseResp
|
||||
}
|
||||
|
||||
struct ListConversationData {
|
||||
1 : list<ConversationData> conversations (api.body = "conversations", agw.key = "conversations")
|
||||
2 : bool has_more (api.body = "has_more", agw.key = "has_more")
|
||||
}
|
||||
|
||||
14
idl/conversation/conversation_service.thrift
Normal file
14
idl/conversation/conversation_service.thrift
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
include "./conversation.thrift"
|
||||
namespace go conversation.conversation
|
||||
|
||||
service ConversationService {
|
||||
conversation.ClearConversationCtxResponse ClearConversationCtx(1: conversation.ClearConversationCtxRequest request)(api.post='/api/conversation/create_section', api.category="conversation", api.gen_path= "conversation")
|
||||
conversation.ClearConversationHistoryResponse ClearConversationHistory(1: conversation.ClearConversationHistoryRequest request)(api.post='/api/conversation/clear_message', api.category="conversation", api.gen_path= "conversation")
|
||||
conversation.CreateConversationResponse CreateConversation(1: conversation.CreateConversationRequest request)(api.post='/v1/conversation/create', api.category="conversation", api.gen_path= "conversation")
|
||||
|
||||
conversation.ClearConversationApiResponse ClearConversationApi(1: conversation.ClearConversationApiRequest req)(api.post='/v1/conversations/:conversation_id/clear', api.category="conversation", api.tag="openapi", agw.preserve_base="true")
|
||||
|
||||
conversation.ListConversationsApiResponse ListConversationsApi(1: conversation.ListConversationsApiRequest request) (api.get = '/v1/conversations', api.category = "conversation", api.tag="openapi", agw.preserve_base = "true")
|
||||
|
||||
}
|
||||
217
idl/conversation/message.thrift
Normal file
217
idl/conversation/message.thrift
Normal file
@@ -0,0 +1,217 @@
|
||||
include "../base.thrift"
|
||||
include "common.thrift"
|
||||
|
||||
namespace go conversation.message
|
||||
|
||||
enum LoadDirection {
|
||||
Unknown = 0
|
||||
Prev = 1
|
||||
Next = 2
|
||||
}
|
||||
const string OrderByDesc = "DESC"
|
||||
const string OrderByAsc = "ASC"
|
||||
|
||||
enum MsgParticipantType {
|
||||
Bot = 1
|
||||
User = 2
|
||||
}
|
||||
// follow copilot 定义的枚举
|
||||
enum ChatMessageMetaType {
|
||||
Default_0 = 0; // Compatible value
|
||||
Replaceable = 1; // 端侧直接替换
|
||||
Insertable = 2; // 插入引用
|
||||
DocumentRef = 3; // 文档引用
|
||||
KnowledgeCard = 4; // 知识库引用卡片
|
||||
EmbeddedMultimedia = 100; // 嵌入的多媒体信息,只是alice给端上用的,因为全链路复用这一个字段,所以在这儿改了
|
||||
}
|
||||
|
||||
struct ExtraInfo {
|
||||
1 : string local_message_id,
|
||||
2 : string input_tokens ,
|
||||
3 : string output_tokens ,
|
||||
4 : string token ,
|
||||
5 : string plugin_status , // "success" or "fail"
|
||||
6 : string time_cost ,
|
||||
7 : string workflow_tokens ,
|
||||
8 : string bot_state ,
|
||||
9 : string plugin_request ,
|
||||
10: string tool_name ,
|
||||
11: string plugin ,
|
||||
12: string mock_hit_info ,
|
||||
13: string log_id ,
|
||||
14: string stream_id ,
|
||||
15: string message_title ,
|
||||
16: string stream_plugin_running ,
|
||||
17: string new_section_id,
|
||||
18: string remove_query_id,
|
||||
19: string execute_display_name,
|
||||
20: string task_type, // 对应定时任务task_type,1-预设任务,2-用户任务,3-Plugin后台任务
|
||||
21: string refer_format //agent app使用引用格式
|
||||
22: string call_id,
|
||||
}
|
||||
|
||||
struct MsgParticipantInfo{
|
||||
1: string id
|
||||
2: MsgParticipantType type
|
||||
3: string name
|
||||
4: string desc
|
||||
5: string avatar_url
|
||||
6: string space_id
|
||||
7: string user_id
|
||||
8: string user_name
|
||||
9: bool allow_mention
|
||||
10: string access_path
|
||||
11: bool is_fav // 是否被收藏
|
||||
// 12: shortcut_command.ShortcutStruct shortcuts //快捷指令
|
||||
13: bool allow_share // 是否允许被分享
|
||||
}
|
||||
|
||||
//struct InterruptFunction {
|
||||
// 1: string name
|
||||
// 2: string arguments
|
||||
//}
|
||||
|
||||
//struct InterruptRequireInfo {
|
||||
// 1: string require_fields
|
||||
// 2: string name
|
||||
//}
|
||||
|
||||
|
||||
struct InterruptPlugin {
|
||||
1: string id
|
||||
2: string type // 1 function, 2 require_info
|
||||
// 3: InterruptFunction function = 3;
|
||||
// 4: InterruptRequireInfo require_info = 4;
|
||||
}
|
||||
|
||||
|
||||
struct SubmitToolOutputs {
|
||||
1: list<InterruptPlugin> tool_calls
|
||||
}
|
||||
|
||||
// 和 bot_connector_platform保持同步
|
||||
struct RequiredAction {
|
||||
1 : string type
|
||||
2 :SubmitToolOutputs submit_tool_outputs
|
||||
}
|
||||
|
||||
struct ChatMessageMetaInfo{
|
||||
1: ChatMessageMetaType type,
|
||||
2: string info,
|
||||
}
|
||||
|
||||
|
||||
struct ChatMessage {
|
||||
1 : string role ,
|
||||
2 : string type ,
|
||||
3 : string content ,
|
||||
4 : string content_type,
|
||||
5 : string message_id ,
|
||||
6 : string reply_id ,
|
||||
7 : string section_id ,
|
||||
8 : ExtraInfo extra_info ,
|
||||
9 : string status , // 正常、打断状态 拉消息列表时使用,chat运行时没有这个字段
|
||||
10: optional i32 broken_pos , // 打断位置
|
||||
11: optional string sender_id,
|
||||
12: optional list<MsgParticipantInfo> mention_list,
|
||||
13: i64 content_time,
|
||||
14: i64 message_index (api.js_conv='true' go.tag="json:\"message_index,string\""),
|
||||
15: i32 source , // 消息来源,0 普通聊天消息,1 定时任务,2 通知,3 异步结果
|
||||
16: optional ChatMessage reply_message, // 对应回复的query 找不到后端加一个兜底的
|
||||
17: optional RequiredAction required_action // 打断信息
|
||||
18: optional list<ChatMessageMetaInfo> meta_infos, // 引用、高亮等文本标记
|
||||
19: optional map<string,string> card_status // 卡片状态
|
||||
20: optional string reasoning_content //模型思维链
|
||||
}
|
||||
|
||||
|
||||
struct GetMessageListRequest {
|
||||
|
||||
1: string conversation_id
|
||||
2: required string cursor // 首次传0/-1,0-最后一页,-1-未读第一页
|
||||
3: required i32 count
|
||||
4: string bot_id
|
||||
5: optional bool draft_mode
|
||||
6: optional string preset_bot // 使用的bot模版
|
||||
7: optional common.Scene scene
|
||||
8: optional string biz_kind // 同一个bot和uid下面的不同业务情况
|
||||
9: optional list<string> insert_history_message_list // 存在创建聊天记录前需要插入聊天的情况
|
||||
10: optional LoadDirection load_direction
|
||||
11: optional bool must_append // 在已有conversation情况下,是否强制append message
|
||||
12: optional i64 share_id (api.js_conv='true' go.tag="json:\"share_id,string\"") // 分享ID
|
||||
}
|
||||
|
||||
struct GetMessageListResponse {
|
||||
1: required list<ChatMessage> message_list
|
||||
2: required string cursor // 下一刷存在时的位置(向上翻页),与next_cursor翻页方向相反。兼容旧逻辑,不加prev前缀
|
||||
3: required bool hasmore // 下一刷是否存在(向上翻页),与next_has_more翻页方向相反。兼容旧逻辑,不加prev前缀
|
||||
4: required string conversation_id
|
||||
5: optional string last_section_id // 会话最新的section_id 只有第一刷返回
|
||||
6: i64 code
|
||||
7: string msg
|
||||
8: optional map<string, MsgParticipantInfo> participant_info_map
|
||||
9: string next_cursor // 下一刷存在时的位置(向下翻页),
|
||||
10: bool next_has_more // 下一刷是否存在(向下翻页)
|
||||
11: i64 read_message_index (api.js_conv='true' go.tag="json:\"read_message_index,string\"")
|
||||
12: string connector_conversation_id //botconnector对应的id
|
||||
}
|
||||
|
||||
struct DeleteMessageRequest {
|
||||
1: required i64 conversation_id (api.js_conv='true')
|
||||
2: required i64 message_id (api.js_conv='true')
|
||||
3: optional common.Scene scene
|
||||
4: optional i64 bot_id (api.js_conv='true')
|
||||
}
|
||||
|
||||
|
||||
struct DeleteMessageResponse {
|
||||
1: i64 code
|
||||
2: string msg
|
||||
}
|
||||
|
||||
struct BreakMessageRequest {
|
||||
1: required i64 conversation_id (api.js_conv='true') //会话id
|
||||
2: required i64 query_message_id (api.js_conv='true')// 当前问题id
|
||||
3: optional i64 answer_message_id (api.js_conv='true') // 当前问题下哪一条回复被打断了
|
||||
4: optional i32 broken_pos // 打断位置
|
||||
5: optional common.Scene scene
|
||||
}
|
||||
struct BreakMessageResponse {
|
||||
1: i64 code
|
||||
2: string msg
|
||||
}
|
||||
|
||||
//批量查询
|
||||
struct ListMessageApiRequest {
|
||||
1: required i64 conversation_id (api.query = "conversation_id",api.js_conv='true') //会话id
|
||||
2: optional i64 limit (api.body = "limit") // 限制条数
|
||||
3: optional string order (api.body = "order") // 排序方式 desc/asc
|
||||
4: optional i64 chat_id (api.body = "chat_id",api.js_conv='true') //一次对话的id
|
||||
5: optional i64 before_id (api.body = "before_id",api.js_conv='true') // 向前翻页需要传的ID
|
||||
6: optional i64 after_id (api.body = "after_id",api.js_conv='true') // 向后返回需要传的ID
|
||||
255: base.Base Base
|
||||
}
|
||||
|
||||
struct OpenMessageApi {
|
||||
1: i64 id (api.js_conv='true')// 主键ID
|
||||
2: i64 bot_id (api.js_conv='true') // agent id
|
||||
3: string role // user / assistant/tool
|
||||
4: string content //消息内容
|
||||
5: i64 conversation_id //会话id
|
||||
6: map<string,string> meta_data // 自定义字段
|
||||
7: i64 created_at //创建时间
|
||||
8: i64 updated_at //更新时间
|
||||
9: i64 chat_id // 一次对话的id
|
||||
10: string content_type // content 类型 ,text/mix
|
||||
11: string type //消息类型 answer/question/function_call/tool_response
|
||||
12: string section_id // 会话的section_id
|
||||
13: optional string reasoning_content //模型思维链
|
||||
}
|
||||
|
||||
|
||||
struct ListMessageApiResponse {
|
||||
1: optional list<OpenMessageApi> messages (api.body = "data")
|
||||
2: optional bool has_more (api.body = "has_more") // 是否还有数据,true 有,false 没有
|
||||
3: optional i64 first_id (api.body = "first_id",api.js_conv='true') // 第一条数据的id
|
||||
4: optional i64 last_id (api.body = "last_id",api.js_conv='true') // 最后一条数据的id
|
||||
}
|
||||
10
idl/conversation/message_service.thrift
Normal file
10
idl/conversation/message_service.thrift
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
include "./message.thrift"
|
||||
namespace go conversation.message
|
||||
|
||||
service MessageService {
|
||||
message.GetMessageListResponse GetMessageList(1: message.GetMessageListRequest request)(api.post='/api/conversation/get_message_list', api.category="conversation", api.gen_path= "message")
|
||||
message.DeleteMessageResponse DeleteMessage(1: message.DeleteMessageRequest request)(api.post='/api/conversation/delete_message', api.category="conversation", api.gen_path= "message")
|
||||
message.BreakMessageResponse BreakMessage(1: message.BreakMessageRequest request)(api.post='/api/conversation/break_message', api.category="conversation", api.gen_path= "message")
|
||||
message.ListMessageApiResponse GetApiMessageList(1: message.ListMessageApiRequest request)(api.post='/v1/conversation/message/list', api.category="conversation", api.gen_path= "message")
|
||||
}
|
||||
244
idl/conversation/run.thrift
Normal file
244
idl/conversation/run.thrift
Normal file
@@ -0,0 +1,244 @@
|
||||
include "../base.thrift"
|
||||
include "common.thrift"
|
||||
include "message.thrift"
|
||||
namespace go conversation.run
|
||||
|
||||
struct parametersStruct {
|
||||
1 : string value
|
||||
2 : string resource_type // "uri"
|
||||
}
|
||||
|
||||
|
||||
// content type
|
||||
const string ContentTypeText = "text"
|
||||
const string ContentTypeImage = "image"
|
||||
const string ContentTypeAudio = "audio"
|
||||
const string ContentTypeVideo = "video"
|
||||
const string ContentTypeLink = "link"
|
||||
const string ContentTypeMusic = "music"
|
||||
const string ContentTypeCard = "card"
|
||||
const string ContentTypeAPP = "app"
|
||||
const string ContentTypeFile = "file"
|
||||
const string ContentTypeMix = "mix"
|
||||
const string ContentTypeMixApi = "object_string"
|
||||
|
||||
// event type
|
||||
|
||||
const string RunEventMessage = "message"
|
||||
const string RunEventDone = "done"
|
||||
const string RunEventError = "error"
|
||||
|
||||
|
||||
|
||||
struct MixContentModel {
|
||||
1:list<Item> item_list
|
||||
2:list<Item> refer_items
|
||||
}
|
||||
|
||||
struct Item {
|
||||
1: string type
|
||||
2: string text
|
||||
3: Image image
|
||||
4: File file
|
||||
}
|
||||
|
||||
struct ImageDetail {
|
||||
1:string url
|
||||
2:i32 width
|
||||
3:i32 height
|
||||
}
|
||||
|
||||
struct File {
|
||||
1:string file_key
|
||||
2:string file_name
|
||||
3:string file_type
|
||||
4:i64 file_size
|
||||
6:string file_url
|
||||
}
|
||||
|
||||
struct Image {
|
||||
1: string key
|
||||
2:ImageDetail image_thumb
|
||||
3:ImageDetail image_ori
|
||||
}
|
||||
|
||||
|
||||
struct Tool {
|
||||
1 : i64 plugin_id (api.js_conv='true')
|
||||
2 : map<string,parametersStruct> parameters
|
||||
3 : string api_name
|
||||
4 : i64 tool_id (api.js_conv='true')
|
||||
}
|
||||
|
||||
enum DiffModeIdentifier {
|
||||
ChatWithA = 1
|
||||
ChatWithB = 2
|
||||
}
|
||||
|
||||
struct AdditionalContent {
|
||||
1: required string type
|
||||
2: optional string text
|
||||
3: optional string file_url
|
||||
}
|
||||
|
||||
struct AgentRunRequest {
|
||||
1 : i64 bot_id (api.js_conv='true') , //agent id
|
||||
2 : required i64 conversation_id (api.js_conv='true') , // 会话id
|
||||
5 : required string query ,
|
||||
7 : map<string,string> extra , // ext 透传字段
|
||||
9 : map<string,string> custom_variables ,
|
||||
10: optional bool draft_mode , // 草稿bot or 线上bot
|
||||
11: optional common.Scene scene , // explore场景
|
||||
12: optional string content_type , // 文件 file 图片 image 等
|
||||
13: optional i64 regen_message_id (api.js_conv='true') , // 重试消息id
|
||||
14: optional string local_message_id , // 前端本地的message_id 在extra_info 里面透传返回
|
||||
15: optional string preset_bot , // 使用的bot模版 代替bot_id bot_version draft_mode参数, coze home使用 preset_bot="coze_home"
|
||||
16: optional list<string> insert_history_message_list,
|
||||
17: optional string device_id,
|
||||
18: optional i64 space_id (api.js_conv='true'),
|
||||
19: optional list<message.MsgParticipantInfo> mention_list,
|
||||
20: optional list<Tool> toolList
|
||||
21: optional string commit_version
|
||||
22: optional string sub_scene // scene粒度下进一步区分场景,目前仅给bot模版使用 = bot_template
|
||||
23: optional DiffModeIdentifier diff_mode_identifier // diff模式下的聊天配置,仅草稿single bot
|
||||
24: optional i64 shortcut_cmd_id (api.js_conv='true')
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct RunStreamResponse {
|
||||
1: required message.ChatMessage message
|
||||
2: optional bool is_finish
|
||||
3: required i32 index
|
||||
4: required string conversation_id
|
||||
5: required i32 seq_id
|
||||
}
|
||||
|
||||
struct AgentRunResponse {
|
||||
1: i64 code
|
||||
2: string msg
|
||||
}
|
||||
|
||||
struct ErrorData {
|
||||
1: i64 code
|
||||
2: string msg
|
||||
}
|
||||
|
||||
|
||||
struct CustomConfig {
|
||||
1: optional ModelConfig ModelConfig (api.body = "model_config")
|
||||
2: optional BotConfig BotConfig (api.body = "bot_config")
|
||||
}
|
||||
|
||||
struct ModelConfig{
|
||||
1: optional string ModelID (api.body="model_id")
|
||||
}
|
||||
|
||||
struct BotConfig{
|
||||
1: optional string CharacterName (api.body="character_name")
|
||||
2: optional string Prompt (api.body="propmt")
|
||||
}
|
||||
struct ShortcutCommandDetail {
|
||||
1: required i64 command_id (api.js_conv='true')
|
||||
2: map<string,string> parameters // key=参数名 value=值 object_string object 数组序列化之后的 JSON String
|
||||
}
|
||||
|
||||
|
||||
struct ChatV3Request {
|
||||
1: required i64 BotID (api.body = "bot_id",api.js_conv='true'), //agent_id
|
||||
2: optional i64 ConversationID (api.query = "conversation_id", api.js_conv='true'), //conversation_id
|
||||
3: required string User (api.body = "user_id"), //user_id,数据隔离标识,需要保证唯一
|
||||
4: optional bool Stream (api.body = "stream"), //是否流式,当前仅支持流失
|
||||
5: optional list<EnterMessage> AdditionalMessages (api.body = "additional_messages"), //本次对话消息,当前仅支持role=user
|
||||
6: optional map<string,string> CustomVariables (api.body = "custom_variables"), //用户自定义变量
|
||||
8: optional map<string, string> MetaData (api.body = "meta_data")
|
||||
10:optional CustomConfig CustomConfig (api.body = "custom_config")
|
||||
11:optional map<string, string> ExtraParams (api.body = "extra_params") // 透传参数到 plugin/workflow 等下游
|
||||
12:optional i64 ConnectorID (api.body="connector_id", api.js_conv='true') // 手动指定渠道 id 聊天。目前仅支持 websdk(=999)
|
||||
13:optional ShortcutCommandDetail ShortcutCommand (api.body="shortcut_command") // 指定快捷指令
|
||||
}
|
||||
|
||||
struct ChatV3MessageDetail {
|
||||
1: required string ID (api.body = "id"),
|
||||
2: required string ConversationID (api.body = "conversation_id"),
|
||||
3: required string BotID (api.body = "bot_id"),
|
||||
4: required string Role (api.body = "role"),
|
||||
5: required string Type (api.body = "type"),
|
||||
6: required string Content (api.body = "content"),
|
||||
7: required string ContentType (api.body = "content_type"),
|
||||
8: optional map<string, string> MetaData (api.body = "meta_data"),
|
||||
9: required string ChatID (api.body = "chat_id")
|
||||
10: optional string SectionID (api.body="section_id")
|
||||
11: optional i64 CreatedAt (api.body = "created_at")
|
||||
12: optional i64 UpdatedAt (api.body = "updated_at")
|
||||
13: optional string ReasoningContent (api.body = "reasoning_content")
|
||||
}
|
||||
|
||||
|
||||
struct EnterMessage {
|
||||
1: string Role (api.body = "role"), // user / assistant
|
||||
2: string Content (api.body = "content"), // 如果是非 text,需要解析 JSON
|
||||
3: map<string,string> MetaData (api.body = "meta_data"),
|
||||
4: string ContentType (api.body = "content_type"), // text, card, object_string
|
||||
5: optional string Type (api.body = "type")
|
||||
6: optional string Name (api.body = "name")
|
||||
}
|
||||
|
||||
struct LastError {
|
||||
1: required i32 Code (api.body = "code"),
|
||||
2: required string Msg (api.body = "msg"),
|
||||
}
|
||||
|
||||
struct Usage {
|
||||
1: optional i32 TokenCount (api.body = "token_count"),
|
||||
2: optional i32 OutputTokens (api.body = "output_count"),
|
||||
3: optional i32 InputTokens (api.body = "input_count"),
|
||||
}
|
||||
|
||||
struct RequiredAction {
|
||||
1: string Type (api.body = "type"),
|
||||
2: SubmitToolOutputs SubmitToolOutputs (api.body = "submit_tool_outputs")
|
||||
}
|
||||
|
||||
struct SubmitToolOutputs {
|
||||
1: list<InterruptPlugin> ToolCalls (api.body = "tool_calls")
|
||||
}
|
||||
|
||||
struct InterruptPlugin {
|
||||
1: string id
|
||||
2: string type
|
||||
3: InterruptFunction function
|
||||
4: InterruptRequireInfo require_info
|
||||
}
|
||||
|
||||
struct InterruptFunction {
|
||||
1: string name
|
||||
2: string arguments
|
||||
}
|
||||
|
||||
struct InterruptRequireInfo {
|
||||
1: list<string> infos
|
||||
}
|
||||
|
||||
struct ChatV3ChatDetail {
|
||||
1: required i64 ID (api.body = "id",api.js_conv='true'),
|
||||
2: required i64 ConversationID (api.body = "conversation_id",api.js_conv='true'),
|
||||
3: required i64 BotID (api.body = "bot_id",api.js_conv='true'),
|
||||
4: optional i32 CreatedAt (api.body = "created_at"),
|
||||
5: optional i32 CompletedAt (api.body = "completed_at"),
|
||||
6: optional i32 FailedAt (api.body = "failed_at"),
|
||||
7: optional map<string, string> MetaData (api.body = "meta_data"),
|
||||
8: optional LastError LastError (api.body = "last_error"),
|
||||
9: required string Status (api.body = "status"),
|
||||
10: optional Usage Usage (api.body = "usage"),
|
||||
11: optional RequiredAction RequiredAction (api.body = "required_action")
|
||||
12: optional i64 SectionID (api.body="section_id",api.js_conv='true')
|
||||
}
|
||||
|
||||
|
||||
// no stream
|
||||
struct ChatV3Response {
|
||||
1: optional ChatV3ChatDetail ChatDetail (api.body = "data"),
|
||||
2: required i32 Code (api.body = "code"),
|
||||
3: required string Msg (api.body = "msg")
|
||||
}
|
||||
Reference in New Issue
Block a user