feat: manually mirror opencoze's code from bytedance

Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
fanlv
2025-07-20 17:36:12 +08:00
commit 890153324f
14811 changed files with 1923430 additions and 0 deletions

42
idl/api.thrift Normal file
View File

@@ -0,0 +1,42 @@
include "./plugin/plugin_develop.thrift"
include "./flow/marketplace/flow_marketplace_product/public_api.thrift"
include "./data_engine/dataset/dataset.thrift"
include "./data_engine/dataset/flow_dataengine_dataset.thrift"
include "./data_engine/dataset/document.thrift"
include "./data_engine/dataset/slice.thrift"
include "./bot_platform/ocean_cloud_workflow/workflow.thrift"
include "./bot_platform/ocean_cloud_workflow/trace.thrift"
include "./flow/devops/debugger/flow.devops.debugger.coze.thrift"
include "./intelligence/intelligence.thrift"
include "./developer/developer_api.thrift"
include "./playground/playground.thrift"
include "./data_engine/ocean_cloud_memory/table/table.thrift"
include "./memory/database.thrift"
include "./permission/openapiauth_service.thrift"
include "./conversation/conversation_service.thrift"
include "./conversation/message_service.thrift"
include "./conversation/agentrun_service.thrift"
include "./data_engine/ocean_cloud_memory/ocean_cloud_memory.thrift"
include "./resource/resource.thrift"
include "./passport/passport.thrift"
include "./bot_platform/ocean_cloud_workflow/ocean_cloud_workflow.thrift"
include "./bot_open_api/bot_open_api.thrift"
namespace go coze
service IntelligenceService extends intelligence.IntelligenceService {}
service ConversationService extends conversation_service.ConversationService {}
service MessageService extends message_service.MessageService {}
service AgentRunService extends agentrun_service.AgentRunService {}
service OpenAPIAuthService extends openapiauth_service.OpenAPIAuthService {}
service MemoryService extends ocean_cloud_memory.MemoryService {}
service PluginDevelopService extends plugin_develop.PluginDevelopService {}
service PublicProductService extends public_api.PublicProductService {}
service DeveloperApiService extends developer_api.DeveloperApiService {}
service PlaygroundService extends playground.PlaygroundService {}
service DatabaseService extends database.DatabaseService {}
service ResourceService extends resource.ResourceService {}
service PassportService extends passport.PassportService {}
service WorkflowService extends ocean_cloud_workflow.WorkflowService {}
service KnowledgeService extends flow_dataengine_dataset.DatasetService {}
service BotOpenApiService extends bot_open_api.BotOpenApiService {}

42
idl/base.thrift Normal file
View File

@@ -0,0 +1,42 @@
namespace py base
namespace go base
namespace java com.bytedance.thrift.base
struct TrafficEnv {
1: bool Open = false,
2: string Env = "" ,
}
struct Base {
1: string LogID = "",
2: string Caller = "",
3: string Addr = "",
4: string Client = "",
5: optional TrafficEnv TrafficEnv ,
6: optional map<string,string> Extra ,
}
struct BaseResp {
1: string StatusMessage = "",
2: i32 StatusCode = 0 ,
3: optional map<string,string> Extra ,
}
struct EmptyReq {
}
struct EmptyData {}
struct EmptyResp {
1: i64 code,
2: string msg ,
3: EmptyData data,
}
struct EmptyRpcReq {
255: optional Base Base,
}
struct EmptyRpcResp {
255: optional BaseResp BaseResp,
}

View File

@@ -0,0 +1,905 @@
namespace go ocean.cloud.bot_common
struct AuthToken {
1: string service_id,
2: string access_key_id,
3: string secret_access_key,
4: string session_token,
5: string expired_time,
6: string current_time,
7: string upload_host,
8: string host_scheme,
}
struct PromptInfo {
1: optional string Prompt (api.body="prompt"), // 文本prompt
}
struct ModelInfo {
1: optional i64 ModelId (agw.js_conv="str", api.js_conv="true", api.body="model_id"), // 模型id
2: optional double Temperature (api.body="temperature") , // 温度,模型输出随机性,值越大越随机,越小越保守(0-1]
3: optional i32 MaxTokens (api.body="max_tokens") , // 回复最大Token数
4: optional double TopP (api.body="top_p") , // 另一种模型的输出随机性,值越大越随机[0,1]
5: optional double FrequencyPenalty (api.body="frequency_penalty") , // 频率惩罚,调整生成内容中的单词频率,正值单词越少见[-1.0,1.0]
6: optional double PresencePenalty (api.body="presence_penalty") , // 存在惩罚,调整生成内容中新词语频率,正值避免重复单词,用新词[-1.0,1.0]
7: optional ShortMemoryPolicy ShortMemoryPolicy (api.body="short_memory_policy") , // 上下文策略
8: optional i32 TopK (api.body="top_k") , // 生成时,采样候选集的大小
9: optional ModelResponseFormat ResponseFormat (api.body="response_format") , // 模型回复内容格式
10: optional ModelStyle ModelStyle (api.body="model_style") , // 用户选择的模型风格
}
enum ModelStyle {
Custom = 0
Creative = 1
Balance = 2
Precise = 3
}
enum ModelResponseFormat {
Text = 0,
Markdown = 1,
JSON = 2,
}
// 上下文允许传输的类型
enum ContextMode {
Chat = 0,
FunctionCall_1 = 1,
FunctionCall_2 = 2,
FunctionCall_3 = 3,
}
enum ModelFuncConfigType {
Plugin = 1
Workflow = 2
ImageFlow = 3
Trigger = 4
KnowledgeText = 5
KnowledgeTable = 6
KnowledgeAutoCall = 7
KnowledgeOnDemandCall = 8
Variable = 9
Database = 10
LongTermMemory = 11
FileBox = 12
Onboarding = 13
Suggestion = 14
ShortcutCommand = 15
BackGroundImage = 16
TTS = 17
MultiAgentRecognize = 18
KnowledgePhoto = 19
HookInfo = 20
}
enum ModelFuncConfigStatus {
FullSupport = 0
PoorSupport = 1
NotSupport = 2
}
struct ShortMemoryPolicy {
1: optional ContextMode ContextMode (api.body="context_mode") , // 上下文允许传输的类型
2: optional i32 HistoryRound (api.body="history_round"), // 上下文带的轮数
}
struct PluginInfo {
1: optional i64 PluginId (agw.js_conv="str", api.js_conv="true", api.body="plugin_id"), // 插件id
2: optional i64 ApiId (agw.js_conv="str", api.js_conv="true", api.body="api_id") , // api Id
3: optional string ApiName (api.body="api_name") , // api name O项目用
100: optional i64 ApiVersionMs (agw.js_conv="str", api.js_conv="true", api.body="api_version_ms"), // api version
}
struct WorkflowInfo {
1: optional i64 WorkflowId (agw.js_conv="str", api.js_conv="true", api.body="workflow_id"), // WorkflowId
2: optional i64 PluginId (agw.js_conv="str", api.js_conv="true", api.body="plugin_id") , // 插件id
3: optional i64 ApiId (agw.js_conv="str", api.js_conv="true", api.body="api_id") , // api Id
4: optional WorkflowMode FlowMode (agw.js_conv="str", api.body="flow_mode") // workflow or imageflow, 默认为workflow
5: optional string WorkflowName (api.body="workflow_name") , // workflow name
6: optional string Desc (api.body="desc", api.body="desc"),
7: optional list<PluginParameter> Parameters (api.body="parameters", api.body="parameters"),
8: optional string PluginIcon (api.body="plugin_icon", api.body="plugin_icon"),
}
struct PluginParameter {
1: optional string Name (api.body="name")
2: optional string Desc (api.body="desc")
3: optional bool Required (api.body="required")
4: optional string Type (api.body="type")
5: optional list<PluginParameter> SubParameters (api.body="sub_parameters")
6: optional string SubType (api.body="sub_type") // 如果Type是数组则有subtype
}
enum WorkflowMode {
Workflow = 0
Imageflow = 1
SceneFlow = 2
ChatFlow = 3
All = 100
}
// onboarding内容生成模式
enum OnboardingMode {
NO_NEED = 1, // 不需要
USE_MANUAL = 2, // 人工指定内容多语言支持由LLM兜底
USE_LLM = 3, // 由LLM生成
}
struct OnboardingInfo { // 对应 Coze Opening Dialog
1: optional string Prologue (api.body="prologue") , // 开场白
2: optional list<string> SuggestedQuestions (api.body="suggested_questions") , // 建议问题
3: optional OnboardingMode OnboardingMode (api.body="onboarding_mode") , // 开场白模型
4: optional string CustomizedOnboardingPrompt (api.body="customized_onboarding_prompt"), // LLM生成用户自定义 Prompt
5: optional SuggestedQuestionsShowMode SuggestedQuestionsShowMode (api.body="suggested_questions_show_mode") , // 开场白预设问题展示方式 默认0 随机展示
}
enum SuggestedQuestionsShowMode{
Random = 0,
All = 1,
}
enum SuggestReplyMode{
System = 0,
Custom = 1,
Disable = 2,
OriBot = 3, // agent专用复用源Bot配置
}
// suggest
struct SuggestReplyInfo { // 对应 Coze Auto-Suggestion
1: optional SuggestReplyMode SuggestReplyMode (api.body="suggest_reply_mode") , // 建议问题模型
2: optional string CustomizedSuggestPrompt (api.body="customized_suggest_prompt"), // 用户自定义建议问题
3: optional string ChainTaskName (api.body="chain_task_name") , // 运行Prompt的ChainTask名称
}
// tts Voices
struct VoicesInfo { // 对应 Coze Voices
1: optional bool Muted (api.body="muted") , // 是否开启声音 true:禁用 false:开启
2: optional map<string,i64> I18nLangVoice (api.body="i18n_lang_voice"), // 多语音音色配置
7: optional map<string,string> I18nLangVoiceStr (api.body="i18n_lang_voice_str"), // 多语音音色配置, string类型
3: optional bool Autoplay (api.body="autoplay") , // 是否自动播放
4: optional map<string,i64> AutoplayVoice (api.body="autoplay_voice") , // 自动播放的音色
5: optional bool CloseVoiceCall (api.body="voice_call") , // 是否关闭语音通话true:关闭 false:开启 默认为false
6: optional DefaultUserInputType DefaultUserInputType (api.body="default_user_input_type"), // 默认用户输入类型
}
enum DefaultUserInputType {
NotSet = 0, // 没设置
Text = 1, // 文字
Voice = 2, // 按住语音
Call = 3, // 语音通话
}
// AnswerActions
enum AnswerActionsMode {
Default = 1,
Customize = 2,
}
enum AnswerActionTriggerType {
Direct = 1, // 平台预设Trigger action
WebView = 2, // 点击Action 显示自定义的H5页面
SendMessage = 3, // 点击Action 发送自定义的用户消息
}
struct AnswerActionTriggerRule {
1: AnswerActionTriggerType Type (api.body="type") ,
2: bool NeedPreloading (api.body="need_preloading"),
3: map<string,string> TriggerData (api.body="trigger_data") , // 根据 AnswerActionTriggerType决定
}
struct ActionIcon {
1: string Type (api.body="type") , // 自定义的按钮 type 不用传
2: string DefaultUrl (api.body="default_url"), // 默认状态
3: string ActiveUrl (api.body="active_url") , // 按下按钮的状态
4: string DefaultUri (api.body="default_uri"), // 默认状态
5: string ActiveUri (api.body="active_uri") , // 按下按钮的状态
}
struct AnswerActionConfig {
1: string Key (api.body="key") , // 预制的只需要传key
2: string Name (api.body="name") , // 默认
3: ActionIcon Icon (api.body="icon") , // 下发uri
4: map<string,string> NameI18n (api.body="name_i18n") , // 存储用户i18的name
5: AnswerActionTriggerRule TriggerRule (api.body="trigger_rule"), // Direct 没有值; WebView 包含 webview_url和 webview_callback_psm两个keySendMessage 包含send_message_prompt
6: i32 Position (api.body="position") , // 位置
}
struct AnswerActions {
1: AnswerActionsMode AnswerActionsMode (api.body="answer_actions_mode") ,
2: list<AnswerActionConfig> AnswerActionConfigs (api.body="answer_action_configs"),
}
// bot ext
struct BotExtInfo {
1: optional AnswerActions AnswerActions (api.body="answer_actions") ,
2: optional list<i32> CardIds (api.body="card_ids") ,
3: optional i32 PromptId (api.body="prompt_id") ,
4: optional string BotTemplateName (api.body="bot_template_name"),
5: optional bool UseUGCVoice (api.body="use_ugc_voice") ,
6: optional i32 AppId (api.body="app_id") ,
7: optional bool BindingMp (api.body="binding_mp") , // 是否绑定小程序标识
}
struct KnowledgeInfo {
1: optional string Id (api.body="id") , // 知识库id
2: optional string Name (api.body="name"), // 知识库名称
}
enum SearchStrategy {
SemanticSearch = 0, // 语义搜索
HybirdSearch = 1, // 混合搜索
FullTextSearch = 20, // 全文搜索
}
struct Knowledge {
1: optional list<KnowledgeInfo> KnowledgeInfo (api.body="knowledge_info") , // 知识库信息
2: optional i64 TopK (api.body="top_k") , // 召回最大数据量
3: optional double MinScore (api.body="min_score") , // 最小匹配度
4: optional bool Auto (api.body="auto") , // 自动召回
5: optional SearchStrategy SearchStrategy (api.body="search_strategy"), // 搜索策略
6: optional bool ShowSource (api.body="show_source"), // 是否展示来源
7: optional KnowledgeNoRecallReplyMode NoRecallReplyMode (api.body="no_recall_reply_mode"), // 无召回回复mode默认0
8: optional string NoRecallReplyCustomizePrompt (api.body="no_recall_reply_customize_prompt"), // 无召回回复时自定义prompt当NoRecallReplyMode=1时生效
9: optional KnowledgeShowSourceMode ShowSourceMode (api.body="show_source_mode"), // 来源展示方式 默认值0 卡片列表方式
10: optional RecallStrategy RecallStrategy (api.body="recall_strategy"), // 召回策略, 默认值为true
}
struct RecallStrategy {
1: optional bool UseRerank (api.body="use_rerank"),
2: optional bool UseRewrite (api.body="use_rewrite"),
3: optional bool UseNl2sql (api.body="use_nl2sql")
}
enum KnowledgeShowSourceMode{
ReplyBottom = 0,
CardList = 1,
}
enum KnowledgeNoRecallReplyMode{
Default = 0,
CustomizePrompt = 1,
}
enum SocietyVisibility {
Public = 1, // 对所有人可见
Anonymous = 2, // 仅对host可见
Custom = 3, // 自定义
}
struct SocietyVisibiltyConfig {
1: SocietyVisibility VisibilityType (api.body="visibility_type", go.tag="json:\"visibility_type,omitempty\"") , // 社会场景中可见性: Public = 1,Anonymous = 2
2: list<string> VisibilityRoles (api.body="visibility_roles", go.tag="json:\"visibility_roles,omitempty\""), // 可见角色列表
}
struct Variable {
1: optional string Key (api.body="key") , // key, Field
2: optional string Description (api.body="description") , // 描述
3: optional string DefaultValue (api.body="default_value"), // 默认值
4: optional bool IsSystem (api.body="is_system"), // 是否系统值系统值
5: optional bool PromptDisabled (api.body="prompt_disabled"), // 是否支持在Prompt中调用 默认支持
6: optional SocietyVisibiltyConfig SocietyVisibilityConfig (api.body="society_visibility_config", go.tag="json:\"society_visibility_config,omitempty\""), // 社会场景中可见性: Public = 1,Anonymous = 2
7: optional bool IsDisabled (api.body="is_disabled"), // 是否禁用默认为false代表启用
}
struct TaskInfo { // coze 上的 Scheduled Tasks
1: optional bool UserTaskAllowed (api.body="user_task_allowed") , // 用户开启task任务
2: optional i64 EnablePresetTask (api.body="enable_preset_task"), // 允许预设任务
}
enum FieldItemType {
Text = 1, // 文本 String
Number = 2, // 数字 Integer
Date = 3, // 时间 Time
Float = 4, // float Number
Boolean = 5, // bool Boolean
}
struct FieldItem {
1: optional string Name (api.body="name") , // 字段名称
2: optional string Desc (api.body="desc") , // 字段描述
3: optional FieldItemType Type (api.body="type") , // 字段类型
4: optional bool MustRequired (api.body="must_required") , // 是否必填
5: optional i64 Id (agw.js_conv="str", api.js_conv="true", api.body="id"), // 字段Id 新增为0
6: optional string TypeStr (api.body="type_str") , // 字段类型 str
7: optional i64 AlterId (api.body="alterId") , // 字段类型 str
}
struct Database {
1: optional string TableId (api.body="table_id") , // table id
2: optional string TableName (api.body="table_name"), // table名称
3: optional string TableDesc (api.body="table_desc"), // table简介
4: optional list<FieldItem> FieldList (api.body="field_list"), // table字段信息
5: optional bool PromptDisabled (api.body="prompt_disabled"), // 是否支持在Prompt中调用 默认支持
6: optional BotTableRWMode RWMode (api.body="rw_mode"),
}
enum BotTableRWMode {
LimitedReadWrite = 1,
ReadOnly = 2,
UnlimitedReadWrite = 3,
RWModeMax = 4,
}
enum AgentType {
Start_Agent = 0,
LLM_Agent = 1,
Task_Agent = 2,
Global_Agent = 3,
Bot_Agent = 4,
}
//版本兼容0-旧版本 1-可回退的新版本 2-不可回退的新版本 3-可回退的新版本(不再提示)
enum AgentVersionCompat{
OldVersion = 0
MiddleVersion = 1
NewVersion = 2
MiddleVersionNotPrompt = 3
}
struct Agent {
1 : i64 AgentId (agw.js_conv="str", api.js_conv="true", api.body="agent_id") ,
2 : string AgentName (api.body="agent_name") ,
3 : PromptInfo PromptInfo (api.body="prompt_info") , // prompt 信息
4 : list<PluginInfo> PluginInfoList (api.body="plugin_info_list") , // plugin列表
5 : Knowledge Knowledge (api.body="knowledge") , // 数据集
6 : list<WorkflowInfo> WorkflowInfoList (api.body="workflow_info_list") , // Workflow 列表
7 : ModelInfo ModelInfo (api.body="model_info") , // 模型配置
8 : list<Intent> Intents (api.body="intents") , // 意图信息
9 : AgentType AgentType (api.body="agent_type") ,
10: bool RootAgent (api.body="root_agent") , // 是否是rootagent
11: i64 ReferenceId (agw.js_conv="str", api.js_conv="true", api.body="reference_id"),
12: string FirstVersion (api.body="first_version") ,
13: string LastVersion (api.body="last_version") ,
14: AgentPosition AgentPosition (api.body="agent_position") ,
15: string IconUri (api.body="icon_uri") ,
16: JumpConfig JumpConfig (api.body="jump_config") ,
17: SuggestReplyInfo SuggestReplyInfo (api.body="suggest_reply_info") ,
18: string Description (api.body="description") ,
19: AgentVersionCompat VersionCompat (api.body="version_compat") , // multi_agent版本兼容字段
20: optional HookInfo HookInfo (api.body="hook_info") ,
21: optional string CurrentVersion (api.body="current_version") , //子bot当前版本
22: optional ReferenceInfoStatus ReferenceInfoStatus (api.body="reference_info_status") , // 1:有可用更新 2:被删除
23: optional ReferenceUpdateType UpdateType (api.body="update_type") , //子bot更新类型
}
struct AgentPosition{
1: double x,
2: double y,
}
enum MultiAgentSessionType{
Flow = 1
Host = 2
}
enum MultiAgentConnectorType {
Curve = 0
Straight = 1
}
struct Intent{
1: string IntentId (api.body="intent_id") ,
2: string Prompt (api.body="prompt") ,
3: i64 NextAgentId (agw.js_conv="str", api.js_conv="true", api.body="next_agent_id"),
4: MultiAgentSessionType SessionType (api.body="session_type")
}
enum BotMode{
SingleMode = 0,
MultiMode = 1,
WorkflowMode = 2,
}
enum BotSpecies { // bot种类
Default = 0, // 从flow创建
Function = 1, // 从coze创建
}
enum TimeCapsuleMode {
Off = 0, // 关
On = 1, // 开
}
enum DisablePromptCalling {
Off = 0,
On = 1,
}
// 时间胶囊信息
struct TimeCapsuleInfo {
1: optional TimeCapsuleMode TimeCapsuleMode (api.body="time_capsule_mode"),
2: optional DisablePromptCalling DisablePromptCalling (api.body="disable_prompt_calling"),
}
struct BotTagInfo {
1: optional TimeCapsuleInfo TimeCapsuleInfo (api.body="time_capsule_info"), // 时间胶囊信息 tag key : time_capsule
}
struct FileboxInfo{
1: optional FileboxInfoMode Mode,
}
enum FileboxInfoMode {
Off = 0,
On = 1,
}
enum BotStatus {
Deleted = 0
Using = 1
Banned = 2
}
enum BusinessType {
Default = 0
DouyinAvatar = 1
}
// bot信息
struct BotInfo {
1 : i64 BotId (agw.js_conv="str", api.js_conv="true", api.body="bot_id") , // bot id
2 : string Name (api.body="name") , // bot名称
3 : string Description (api.body="description") , // bot描述
4 : string IconUri (api.body="icon_uri") , // bot 图标uri
5 : string IconUrl (api.body="icon_url") , // bot 图标url
6 : i64 CreatorId (agw.js_conv="str", api.js_conv="true", api.body="creator_id") , // 创建人id
7 : i64 CreateTime (agw.js_conv="str", api.js_conv="true", api.body="create_time") , // 创建时间
8 : i64 UpdateTime (agw.js_conv="str", api.js_conv="true", api.body="update_time") , // 更新时间
9 : i64 ConnectorId (agw.js_conv="str", api.js_conv="true", api.body="connector_id"), // 业务线
10: string Version (api.body="version") , // 版本,毫秒
11: ModelInfo ModelInfo (api.body="model_info") , // 模型配置
12: PromptInfo PromptInfo (api.body="prompt_info") , // prompt 信息
13: list<PluginInfo> PluginInfoList (api.body="plugin_info_list") , // plugin列表
14: list<WorkflowInfo> WorkflowInfoList (api.body="workflow_info_list") , // Workflow 列表
15: OnboardingInfo OnboardingInfo (api.body="onboarding_info") , // 开场白
16: Knowledge Knowledge (api.body="knowledge") , // 数据集
17: list<Variable> VariableList (api.body="variable_list") , // kv存储
18: TaskInfo TaskInfo (api.body="task_info") , // 任务管理/预设任务
19: list<Database> DatabaseList (api.body="database_list") , // 数据表
20: SuggestReplyInfo SuggestReplyInfo (api.body="suggest_reply_info") , // 推荐问题
21: VoicesInfo VoicesInfo (api.body="voices_info") , // 音色配置
22: BotExtInfo BotExtInfo (api.body="bot_ext_info") , // 额外信息,扩展字段
23: BotMode BotMode (api.body="bot_mode") , // bot 类型single agent or multi agent
24: list<Agent> Agents (api.body="agents") , // multi agent mode agent信息
25: BotSpecies BotSpecies (api.body="bot_species") , // Bot种类
26: BotTagInfo BotTagInfo (api.body="bot_tag_info") , // bot tag 信息,用户新增字段
27: FileboxInfo FileboxInfo (api.body="filebox_info") , // filebox 信息
28: MultiAgentInfo MultiAgentInfo (api.body="multi_agent_info") , // multi_agent结构体
29: list<BackgroundImageInfo> BackgroundImageInfoList (api.body="background_image_info_list") , // 背景图列表结构体
30: list<string> ShortcutSort (api.body="shortcut_sort") ,
31: BotStatus Status (api.body="status") , // bot状态
32: optional HookInfo HookInfo (api.body="hook_info") , // hook信息
33: UserQueryCollectConf UserQueryCollectConf (api.body="user_query_collect_conf") , // 用户query收集配置
34: LayoutInfo LayoutInfo (api.body="layout_info") , // workflow模式的编排信息
35: BusinessType BusinessType (api.body="business_type")
}
struct CommonKnowledge {
1: list<KnowledgeInfo> knowledge_infos , // 知识库信息
}
struct ShortcutCommandComponent { // panel参数
1 : string name //参数名字
2 : string description //参数描述
3 : string type // 输入类型 text、select、file
4 : optional string tool_parameter // 请求工具时参数的key 对应tool的参数名称没有则为不返回
5 : optional list<string> options // type为select时的可选项列表 or type为file时支持哪些类型 image、doc、table、audio、video、zip、code、txt、ppt
6 : optional string default_value // 默认值 没配置时不返回
7 : bool is_hide // 是否隐藏不展示 线上bot tool类型的快捷指令不返回hide=true的component
}
struct ShortcutCommandToolInfo {
1: string name //
2: string type // tool类型 workflow plugin
}
struct ShortcutCommandInfo {
1: i64 id (api.js_conv="true") // 快捷指令id
2: string name // 快捷指令按钮名称
3: string command // 快捷指令
4: string description // 快捷指令描述
5: string query_template // 指令query模版
6: string icon_url // 快捷指令icon
7: optional list<ShortcutCommandComponent> components // 组件列表(参数列表)
8: optional ShortcutCommandToolInfo tool // tool信息
9: optional i64 agent_id (api.js_conv="true") //multi的指令时该指令由哪个节点执行 没配置不返回
}
struct OpenAPIBotInfo {
1 : i64 bot_id (api.js_conv="true") , // bot id
2 : string name, // bot名称
3 : string description, // bot描述
4 : string icon_url, // bot图像url
5 : i64 create_time, // 创建时间
6 : i64 update_time, // 更新时间
7 : string version, // 版本
8 : PromptInfo prompt_info, // prompt 信息
9 : OnboardingInfo onboarding_info, // 开场白
10: BotMode bot_mode, // bot 类型single agent or multi agent
// 11: optional list<VoiceData> voice_data_list, // 选择的语音信息
12: optional ModelInfo model_info, // 模型信息
13: list<PluginInfo> plugin_info_list, // 插件信息列表
14: optional CommonKnowledge knowledge // 知识库信息
15: list<WorkflowInfo> workflow_info_list, // workflow信息列表
16: list<ShortcutCommandInfo> shortcut_commands, // 快捷指令信息列表
// 17: list<Voice> voice_info_list, // 音色配置
18: string default_user_input_type, // 默认用户输入类型
19: SuggestReplyInfo suggest_reply_info, // 用户问题建议
20: BackgroundImageInfo background_image_info, // 背景图片
21: list<Variable> variables, // 变量列表
}
struct LayoutInfo {
1: string WorkflowId (api.body="workflow_id") , // workflowId
2: string PluginId (api.body="plugin_id") , // PluginId
}
struct UserQueryCollectConf {
1: bool IsCollected (api.body="is_collected") , // 是否开启收集开关
2: string PrivatePolicy (api.body="private_policy") , // 隐私协议链接
}
struct MultiAgentInfo {
1: MultiAgentSessionType SessionType (api.body="session_type") , // multi_agent会话接管方式
2: AgentVersionCompatInfo VersionCompatInfo (api.body="version_compat_info") , // multi_agent版本兼容字段 前端用
3: MultiAgentConnectorType ConnectorType (api.body="connector_type") , // multi_agent连线类型 前端用
}
struct AgentVersionCompatInfo {
1: AgentVersionCompat VersionCompat (api.body="version_compat") ,
2: string version
}
struct BackgroundImageInfo {
1: optional BackgroundImageDetail WebBackgroundImage (api.body="web_background_image") , // web端背景图
2: optional BackgroundImageDetail MobileBackgroundImage (api.body="mobile_background_image") , // 移动端背景图
}
struct BackgroundImageDetail {
1: optional string OriginImageUri (api.body="origin_image_uri") // 原始图片
2: optional string OriginImageUrl (api.body="origin_image_url")
3: optional string ImageUri (api.body="image_uri") // 实际使用图片
4: optional string ImageUrl (api.body="image_url")
5: optional string ThemeColor (api.body="theme_color")
6: optional GradientPosition GradientPosition (api.body="gradient_position") // 渐变位置
7: optional CanvasPosition CanvasPosition (api.body="canvas_position") // 裁剪画布位置
}
struct GradientPosition {
1: optional double Left (api.body="left")
2: optional double Right (api.body="right")
}
struct CanvasPosition {
1: optional double Width (api.body="width")
2: optional double Height (api.body="height")
3: optional double Left (api.body="left")
4: optional double Top (api.body="top")
}
// bot信息 for 更新
struct BotInfoForUpdate {
1: optional i64 BotId (agw.js_conv="str", api.js_conv="true",api.body="bot_id") // bot id
2: optional string Name (api.body="name") // bot名称
3: optional string Description (api.body="description") // bot描述
4: optional string IconUri (api.body="icon_uri") // bot 图标uri
5: optional string IconUrl (api.body="icon_url") // bot 图标url
6: optional i64 CreatorId (agw.js_conv="str", api.js_conv="true", api.body="creator_id") // 创建人id
7: optional i64 CreateTime (agw.js_conv="str", api.js_conv="true", api.body="create_time") // 创建时间
8: optional i64 UpdateTime (agw.js_conv="str", api.js_conv="true", api.body="update_time") // 更新时间
9: optional i64 ConnectorId (agw.js_conv="str", api.js_conv="true", api.body="connector_id") // 业务线
10: optional string Version (api.body="version") // 版本,毫秒
11: optional ModelInfo ModelInfo (api.body="model_info") // 模型配置
12: optional PromptInfo PromptInfo (api.body="prompt_info") // prompt 信息
13: optional list<PluginInfo> PluginInfoList (api.body="plugin_info_list") // plugin列表
14: optional list<WorkflowInfo> WorkflowInfoList (api.body="workflow_info_list") // Workflow 列表
15: optional OnboardingInfo OnboardingInfo (api.body="onboarding_info") // 开场白
16: optional Knowledge Knowledge (api.body="knowledge") // 数据集
17: optional list<Variable> VariableList (api.body="variable_list") // kv存储
18: optional TaskInfo TaskInfo (api.body="task_info") // 任务管理/预设任务
19: optional list<Database> DatabaseList (api.body="database_list") // 数据表
20: optional SuggestReplyInfo SuggestReplyInfo (api.body="suggest_reply_info") // 推荐问题
21: optional VoicesInfo VoicesInfo (api.body="voices_info") // 音色配置
22: optional BotExtInfo BotExtInfo (api.body="bot_ext_info") // 额外信息,扩展字段
23: optional BotMode BotMode (api.body="bot_mode") // bot 类型single agent or multi agent
24: optional list<AgentForUpdate> Agents (api.body="agents") // multi agent mode agent信息
25: BotSpecies BotSpecies (api.body="bot_species") // Bot种类
26: optional BotTagInfo BotTagInfo (api.body="bot_tag_info") // bot tag 信息,用户新增字段
27: optional FileboxInfo FileboxInfo (api.body="filebox_info") // filebox 信息
28: optional MultiAgentInfo MultiAgentInfo (api.body="multi_agent_info") // multi_agent结构体
29: optional list<BackgroundImageInfo> BackgroundImageInfoList (api.body="background_image_info_list") // 背景图列表结构体
30: optional list<string> ShortcutSort (api.body="shortcut_sort")
31: optional HookInfo HookInfo (api.body="hook_info")
32: optional UserQueryCollectConf UserQueryCollectConf (api.body="user_query_collect_conf")// 用户query收集配置
33: optional LayoutInfo LayoutInfo(api.body="layout_info") // workflow模式的编排信息
}
struct AgentForUpdate {
1: optional i64 AgentId (agw.js_conv="str", api.js_conv="true", api.body="id") // agw字段名做了特殊映射 注意
2: optional string AgentName (api.body="name") // agw字段名做了特殊映射 注意
3: optional PromptInfo PromptInfo (api.body="prompt_info") // prompt 信息
4: optional list<PluginInfo> PluginInfoList (api.body="plugin_info_list") // plugin列表
5: optional Knowledge Knowledge (api.body="knowledge") // 数据集
6: optional list<WorkflowInfo> WorkflowInfoList (api.body="workflow_info_list") // Workflow 列表
7: optional ModelInfo ModelInfo (api.body="model_info") // 模型配置
8: optional list<Intent> Intents (api.body="intents") // 意图信息
9: optional AgentType AgentType (api.body="agent_type")
10: optional bool RootAgent (api.body="root_agent") // 是否是rootagent
11: optional i64 ReferenceId (agw.js_conv="str", api.js_conv="true", api.body="reference_id")
12: optional string FirstVersion (api.body="first_version")
13: optional string LastVersion (api.body="last_version")
14: optional AgentPosition Position (api.body="agent_position")
15: optional string IconUri (api.body="icon_uri")
16: optional JumpConfig JumpConfig (api.body="jump_config")
17: optional SuggestReplyInfo SuggestReplyInfo (api.body="suggest_reply_info")
18: optional string Description (api.body="description")
19: optional AgentVersionCompat VersionCompat (api.body="version_compat") // multi_agent版本兼容字段
20: optional HookInfo HookInfo (api.body="hook_info")
}
struct TableDetail {
1: optional string TableId // table id
2: optional string TableName // table名称
3: optional string TableDesc // table简介
4: optional list<FieldItem> FieldList // table字段信息
5: optional bool PromptDisabled (api.body="prompt_disabled"), // 是否支持在Prompt中调用 默认支持
}
struct TaskPluginInputField {
1: optional string Name
2: optional string Type // "Input", "Reference"
3: optional string Value
}
struct TaskPluginInput {
1: optional list<TaskPluginInputField> Params
}
struct TaskWebhookField {
1: optional string Name,
2: optional string Type,
3: optional string Description,
4: optional list<TaskWebhookField> Children,
}
struct TaskWebhookOutput {
1: optional list<TaskWebhookField> Params
}
struct TaskInfoDetail { // Tasks Detail
1: optional string TaskId // 任务唯一标识
2: optional string UserQuestion // 定时器触发时执行的 query例如提醒我喝水. 二期TriggerType == "Time"
3: optional string CreateTime // 定时任务创建时间
4: optional string NextTime // 定时任务下次执行的时间点
5: optional i64 Status // 任务状态:有效/无效
6: optional i32 PresetType // 1-草稿2-线上
7: optional string CronExpr // 定时任务的 crontab 表达式
8: optional string TaskContent // 处理过后的 UserQuestion例如喝水
9: optional string TimeZone // 时区
10: optional string TaskName // 任务名称
11: optional string TriggerType // "Time", "Event"
12: optional string Action // "Bot query", "Plugin", "Workflow"
13: optional string BotQuery // Action == "Bot query" 时的输入
14: optional string PluginName // plugin 和 workflow 都用这个字段
15: optional TaskPluginInput PluginInput // plugin 和 workflow 都用这个字段
16: optional string WebhookUrl // TriggerType == "Event"
17: optional string WebhookBearerToken // TriggerType == "Event"
18: optional TaskWebhookOutput WebhookOutput // TriggerType == "Event"
19: optional string OriginId // 溯源 ID。创建时生成更新/发布不变
}
struct DraftBotInfoV2 {
1: BotInfo BotInfo
2: optional string CanvasData
3: optional i64 BaseCommitVersion
4: optional i64 CommitVersion
5: optional map<string,TableDetail> TableInfo // TableInfo
6: optional map<string, TaskInfoDetail> TaskInfo // taskInfo
}
enum BacktrackMode {
Current = 1
Previous = 2
Start = 3
MostSuitable = 4
}
enum RecognitionMode {
FunctionCall = 1
Independent = 2
}
struct JumpConfig {
1: BacktrackMode backtrack
2: RecognitionMode recognition
3: optional IndependentModeConfig independent_conf
}
enum IndependentTiming {
Pre = 1 // 判断用户输入(前置)
Post = 2 // 判断节点输出(后置)
PreAndPost = 3 // 前置模式和后置模式支持同时选择
}
enum IndependentRecognitionModelType {
SLM = 0 // 小模型
LLM = 1 // 大模型
}
struct IndependentModeConfig {
1: IndependentTiming judge_timing // 判断时机
2: i32 history_round
3: IndependentRecognitionModelType model_type
4: optional string model_id
5: optional string prompt
}
struct MessageFeedback {
1: MessageFeedbackType feedback_type // 反馈类型
2: list<MessageFeedbackDetailType> detail_types // 细分类型
3: string detail_content // 负反馈自定义内容对应用户选择Others
}
enum MessageFeedbackType {
Default = 0
Like = 1
Unlike = 2
}
enum MessageFeedbackDetailType {
UnlikeDefault = 0
UnlikeHarmful = 1 // 有害信息
UnlikeIncorrect = 2 // 信息有误
UnlikeNotFollowInstructions = 3 // 未遵循指令
UnlikeOthers = 4 // 其他
}
enum Scene{
Default = 0,
Explore = 1,
BotStore = 2,
CozeHome = 3,
Playground = 4,
Evaluation = 5, // 评测平台
AgentAPP = 6,
PromptOptimize = 7, //prompt优化
GenerateAgentInfo = 8 // createbot的nl2bot功能
}
struct UserLabel {
1: string label_id
2: string label_name
3: string icon_uri
4: string icon_url
5: string jump_link
}
struct ChatV3ChatDetail {
1: required string ID (api.body = "id"),
2: required string ConversationID (api.body = "conversation_id"),
3: required string BotID (api.body = "bot_id"),
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 string SectionID (api.body="section_id")
}
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 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 HookInfo {
1: optional list<HookItem> pre_agent_jump_hook // pre agent跳转hook
2: optional list<HookItem> post_agent_jump_hook // post agent跳转hook
3: optional list<HookItem> flow_hook // 流程hook
4: optional list<HookItem> atomic_hook // 原子能力hook
5: optional list<HookItem> llm_call_hook // 模型调用hook
6: optional list<HookItem> res_parsing_hook // 对话结果hook
7: optional list<HookItem> suggestion_hook // suggesion hook
}
struct HookItem {
1: optional string uri
2: optional list<string> filter_rules
3: optional bool strong_dep
4: optional i64 timeout_ms
}
//struct ContentAttachment {
// 1: required string FileID (api.body = "file_id")
//}
// struct MetaContent{
// 1: required string Type (api.body="type"),
// 2: optional string Text ( api.body="text"),
// 3: optional string FileID (api.body="file_id"),
// 4: optional string FileURL (api.body="file_url"),
// 5: optional string Card (api.body="card"),
// }
// struct EnterMessage {
// 1: required string Role (api.body = "role")
// 2: string Content(api.body = "content") // 内容
// 3: map<string,string> MetaData(api.body = "meta_data")
// 4: string ContentType(api.body = "content_type")//text/card/object_string
// 5: string Type(api.body = "type")
// }
// struct OpenMessageApi {
// 1: string Id(api.body = "id") // 主键ID
// 2: string BotId(api.body = "bot_id") // bot id //已TODO 所有的i64加注解str,入参和出参都要
// 3: string Role(api.body = "role")
// 4: string Content(api.body = "content") // 内容
// 5: string ConversationId(api.body = "conversation_id") // conversation id
// 6: map<string,string> MetaData(api.body = "meta_data")
// 7: string CreatedAt(api.body = "created_at") // 创建时间
// 8: string UpdatedAt(api.body = "updated_at") // 更新时间 //已TODO 时间改成int
// 9: string ChatId(api.body = "chat_id")
// 10: string ContentType(api.body = "content_type")
// 11: string Type(api.body = "type")
// }
enum ReferenceUpdateType {
ManualUpdate = 1
AutoUpdate = 2
}
enum ReferenceInfoStatus {
HasUpdates = 1 // 1:有可用更新
IsDelete = 2 // 2:被删除
}

View File

@@ -0,0 +1,15 @@
include "../base.thrift"
namespace go ocean.cloud.bot_open_api
struct OauthAuthorizationCodeReq {
1: string code (api.query='code') ,
2: string state (api.query='state'),
}
struct OauthAuthorizationCodeResp {
255: required base.BaseResp BaseResp,
}
service BotOpenApiService {
OauthAuthorizationCodeResp OauthAuthorizationCode(1: OauthAuthorizationCodeReq request)(api.get='/api/oauth/authorization_code', api.category="oauth", api.gen_path="oauth")
}

View File

@@ -0,0 +1,78 @@
include "../../base.thrift"
include "workflow.thrift"
include "../../resource/resource.thrift"
include "trace.thrift"
include "../../resource/resource_common.thrift"
namespace go ocean.cloud.workflow
service WorkflowService {
// 创建流程
workflow.CreateWorkflowResponse CreateWorkflow(1:workflow.CreateWorkflowRequest request) (api.post='/api/workflow_api/create', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// 查询流程
workflow.GetCanvasInfoResponse GetCanvasInfo(1:workflow.GetCanvasInfoRequest request) (api.post='/api/workflow_api/canvas', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.GetHistorySchemaResponse GetHistorySchema(1:workflow.GetHistorySchemaRequest request) (api.post='/api/workflow_api/history_schema', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// 保存流程
workflow.SaveWorkflowResponse SaveWorkflow(1:workflow.SaveWorkflowRequest request) (api.post='/api/workflow_api/save', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.UpdateWorkflowMetaResponse UpdateWorkflowMeta(1:workflow.UpdateWorkflowMetaRequest request) (api.post='/api/workflow_api/update_meta', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.DeleteWorkflowResponse DeleteWorkflow(1:workflow.DeleteWorkflowRequest request) (api.post='/api/workflow_api/delete', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.BatchDeleteWorkflowResponse BatchDeleteWorkflow(1:workflow.BatchDeleteWorkflowRequest request) (api.post='/api/workflow_api/batch_delete', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.GetDeleteStrategyResponse GetDeleteStrategy(1: workflow.GetDeleteStrategyRequest request)(api.post='/api/workflow_api/delete_strategy', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// 发布流程。该接口的用途是发布非 project 内部的流程。
workflow.PublishWorkflowResponse PublishWorkflow(1:workflow.PublishWorkflowRequest request) (api.post='/api/workflow_api/publish', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.CopyWorkflowResponse CopyWorkflow(1:workflow.CopyWorkflowRequest request) (api.post='/api/workflow_api/copy', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.CopyWkTemplateApiResponse CopyWkTemplateApi(1:workflow.CopyWkTemplateApiRequest request) (api.post='/api/workflow_api/copy_wk_template', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.GetReleasedWorkflowsResponse GetReleasedWorkflows(1: workflow.GetReleasedWorkflowsRequest request) (api.post='/api/workflow_api/released_workflows', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.GetWorkflowReferencesResponse GetWorkflowReferences(1: workflow.GetWorkflowReferencesRequest request) (api.post='/api/workflow_api/workflow_references', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// 获取示例流程列表
workflow.GetExampleWorkFlowListResponse GetExampleWorkFlowList(1: workflow.GetExampleWorkFlowListRequest request)(api.post='/api/workflow_api/example_workflow_list', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// 获取流程列表。
workflow.GetWorkFlowListResponse GetWorkFlowList(1: workflow.GetWorkFlowListRequest request) (api.post='/api/workflow_api/workflow_list', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.QueryWorkflowNodeTypeResponse QueryWorkflowNodeTypes(1: workflow.QueryWorkflowNodeTypeRequest request)(api.post="/api/workflow_api/node_type", api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// 画布
workflow.NodeTemplateListResponse NodeTemplateList(1: workflow.NodeTemplateListRequest request)(api.post='/api/workflow_api/node_template_list', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.NodePanelSearchResponse NodePanelSearch(1: workflow.NodePanelSearchRequest request)(api.post='/api/workflow_api/node_panel_search', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.GetLLMNodeFCSettingsMergedResponse GetLLMNodeFCSettingsMerged(1: workflow.GetLLMNodeFCSettingsMergedRequest req)(api.post='/api/workflow_api/llm_fc_setting_merged', api.category="workflow_api", api.gen_path="workflow_trace", agw.preserve_base = "true")
workflow.GetLLMNodeFCSettingDetailResponse GetLLMNodeFCSettingDetail(1: workflow.GetLLMNodeFCSettingDetailRequest req)(api.post='/api/workflow_api/llm_fc_setting_detail', api.category="workflow_api", api.gen_path="workflow_trace", agw.preserve_base = "true")
// 试运行流程test run
workflow.WorkFlowTestRunResponse WorkFlowTestRun(1:workflow.WorkFlowTestRunRequest request) (api.post='/api/workflow_api/test_run', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.WorkflowTestResumeResponse WorkFlowTestResume(1:workflow.WorkflowTestResumeRequest request) (api.post='/api/workflow_api/test_resume', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.CancelWorkFlowResponse CancelWorkFlow(1:workflow.CancelWorkFlowRequest request) (api.post='/api/workflow_api/cancel', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// 查看试运行执行历史。
workflow.GetWorkflowProcessResponse GetWorkFlowProcess(1:workflow.GetWorkflowProcessRequest request)(api.get='/api/workflow_api/get_process', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.GetNodeExecuteHistoryResponse GetNodeExecuteHistory(1:workflow.GetNodeExecuteHistoryRequest request)(api.get='/api/workflow_api/get_node_execute_history', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.GetApiDetailResponse GetApiDetail(1: workflow.GetApiDetailRequest request) (api.get='/api/workflow_api/apiDetail', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.WorkflowNodeDebugV2Response WorkflowNodeDebugV2(1: workflow.WorkflowNodeDebugV2Request request) (api.post='/api/workflow_api/nodeDebug', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// 文件上传
workflow.GetUploadAuthTokenResponse GetWorkflowUploadAuthToken(1: workflow.GetUploadAuthTokenRequest request)(api.post = '/api/workflow_api/upload/auth_token', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.SignImageURLResponse SignImageURL(1: workflow.SignImageURLRequest request)(api.post='/api/workflow_api/sign_image_url', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// conversation
workflow.CreateProjectConversationDefResponse CreateProjectConversationDef(1: workflow.CreateProjectConversationDefRequest request)(api.post = '/api/workflow_api/project_conversation/create', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.UpdateProjectConversationDefResponse UpdateProjectConversationDef(1: workflow.UpdateProjectConversationDefRequest request)(api.post = '/api/workflow_api/project_conversation/update', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.DeleteProjectConversationDefResponse DeleteProjectConversationDef(1: workflow.DeleteProjectConversationDefRequest request)(api.post = '/api/workflow_api/project_conversation/delete', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.ListProjectConversationResponse ListProjectConversationDef(1: workflow.ListProjectConversationRequest request)(api.get = '/api/workflow_api/project_conversation/list', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// Trace
// 列出历史执行的trace
trace.ListRootSpansResponse ListRootSpans (1: trace.ListRootSpansRequest req)(api.post='/api/workflow_api/list_spans', api.category="workflow_trace", api.gen_path="workflow_trace", agw.preserve_base = "true")
trace.GetTraceSDKResponse GetTraceSDK (1: trace.GetTraceSDKRequest req)(api.post='/api/workflow_api/get_trace', api.category="workflow_trace", api.gen_path="workflow_trace", agw.preserve_base = "true")
// App
workflow.GetWorkflowDetailResponse GetWorkflowDetail(1: workflow.GetWorkflowDetailRequest request) (api.post='/api/workflow_api/workflow_detail', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.GetWorkflowDetailInfoResponse GetWorkflowDetailInfo(1: workflow.GetWorkflowDetailInfoRequest request) (api.post='/api/workflow_api/workflow_detail_info', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.ValidateTreeResponse ValidateTree(1: workflow.ValidateTreeRequest request) (api.post='/api/workflow_api/validate_tree', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// chat flow role config
workflow.GetChatFlowRoleResponse GetChatFlowRole(1: workflow.GetChatFlowRoleRequest request) (api.get='/api/workflow_api/chat_flow_role/get', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.CreateChatFlowRoleResponse CreateChatFlowRole(1: workflow.CreateChatFlowRoleRequest request) (api.post='/api/workflow_api/chat_flow_role/create', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
workflow.DeleteChatFlowRoleResponse DeleteChatFlowRole(1: workflow.DeleteChatFlowRoleRequest request) (api.post='/api/workflow_api/chat_flow_role/delete', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// App 发布管理
workflow.ListPublishWorkflowResponse ListPublishWorkflow(1: workflow.ListPublishWorkflowRequest request) (api.post='/api/workflow_api/list_publish_workflow', api.category="workflow_api", api.gen_path="workflow_api", agw.preserve_base = "true")
// Open API
workflow.OpenAPIRunFlowResponse OpenAPIRunFlow(1: workflow.OpenAPIRunFlowRequest request)(api.post = "/v1/workflow/run", api.category="workflow_open_api", api.tag="openapi", api.gen_path="workflow_open_api" )
workflow.OpenAPIStreamRunFlowResponse OpenAPIStreamRunFlow(1: workflow.OpenAPIRunFlowRequest request)(api.post = "/v1/workflow/stream_run", api.category="workflow_open_api", api.tag="openapi", api.gen_path="workflow_open_api")
workflow.OpenAPIStreamRunFlowResponse OpenAPIStreamResumeFlow(1: workflow.OpenAPIStreamResumeFlowRequest request)(api.post = "/v1/workflow/stream_resume", api.category="workflow_open_api", api.tag="openapi", api.gen_path="workflow_open_api")
workflow.GetWorkflowRunHistoryResponse OpenAPIGetWorkflowRunHistory(1:workflow.GetWorkflowRunHistoryRequest request)(api.get='/v1/workflow/get_run_history', api.category="workflow_open_api", api.tag="openapi", api.gen_path="workflow_api", agw.preserve_base = "false")
workflow.ChatFlowRunResponse OpenAPIChatFlowRun(1: workflow.ChatFlowRunRequest request)(api.post = "/v1/workflows/chat", api.category="workflow_open_api", api.tag="openapi", api.gen_path="workflow_open_api")
workflow.OpenAPIGetWorkflowInfoResponse OpenAPIGetWorkflowInfo(1: workflow.OpenAPIGetWorkflowInfoRequest request)(api.get = "/v1/workflows/:workflow_id", api.category="workflow_open_api", api.tag="openapi", api.gen_path="workflow_open_api")
}

View File

@@ -0,0 +1,227 @@
include "../../base.thrift"
namespace go ocean.cloud.workflow
enum FrontedTagType {
TEXT = 0 // 文本
TIME = 1 // 时间,用时间戳,单位是毫秒
TIME_DURATION = 2 // 时间间隔,单位是毫秒
}
// Tag
struct TraceTag {
1: string Key (go.tag = "json:\"key\"", agw.key = "key")
2: TagType TagType (go.tag = "json:\"tag_type\"", agw.key = "tag_type")
3: Value Value (go.tag = "json:\"value\"", agw.key = "value")
}
struct FilterTag {
1: optional string DataType (go.tag = "json:\"data_type\"", agw.key = "data_type")
2: optional string TagKey (go.tag = "json:\"tag_key\"", agw.key = "tag_key")
3: optional list<string> MultiTagKeys (go.tag = "json:\"multi_tag_keys\"", agw.key = "multi_tag_keys")
4: optional list<string> Values (go.tag = "json:\"values\"", agw.key = "values")
5: optional QueryTypeEnum QueryType (go.tag = "json:\"query_type\"", agw.key = "query_type")
}
enum QueryTypeEnum {
Undefined = 0
Match = 1
Term = 2
Range = 3
Exist = 4
NotExist = 5
}
enum SpanStatus{
Unknown = 0
Success = 1
Fail = 2
}
struct ListRootSpansRequest {
2: required i64 StartAt (go.tag = "json:\"start_at\"", api.body = "start_at") // 单位是毫秒
3: required i64 EndAt (go.tag = "json:\"end_at\"", api.body = "end_at") // 单位是毫秒
4: optional i16 Limit (go.tag = "json:\"limit\"", api.body = "limit")
5: optional bool DescByStartTime (go.tag = "json:\"desc_by_start_time\"", api.body = "desc_by_start_time")
6: optional i32 Offset (go.tag = "json:\"offset\"", api.body = "offset")
7: required string WorkflowID(go.tag = "json:\"workflow_id\"", api.body = "workflow_id")
8: optional string Input(go.tag = "json:\"input\"", api.body = "input")
9: optional SpanStatus Status(go.tag = "json:\"status\"", api.body = "status")
10: optional i32 ExecuteMode (go.tag = "json:\"execute_mode\"", api.body = "execute_mode") // 正式运行/试运行/节点Debug
255: optional base.Base Base
}
struct Span {
1: string TraceID (go.tag = "json:\"trace_id\"", agw.key = "trace_id")
2: string LogID (go.tag = "json:\"log_id\"", agw.key = "log_id")
3: string PSM (go.tag = "json:\"psm\"", agw.key = "psm")
4: string DC (go.tag = "json:\"dc\"", agw.key = "dc")
5: string PodName (go.tag = "json:\"pod_name\"", agw.key = "pod_name")
6: string SpanID (go.tag = "json:\"span_id\"", agw.key = "span_id")
7: string Type (go.tag = "json:\"type\"", agw.key = "type")
8: string Name (go.tag = "json:\"name\"", agw.key = "name")
9: string ParentID (go.tag = "json:\"parent_id\"", agw.key = "parent_id")
10: i64 Duration (go.tag = "json:\"duration\"", agw.key = "duration") // 单位是毫秒
11: i64 StartTime (go.tag = "json:\"start_time\"", agw.key = "start_time") // 单位是毫秒
12: i32 StatusCode (go.tag = "json:\"status_code\"", agw.key = "status_code")
13: list<TraceTag> Tags (go.tag = "json:\"tags\"", agw.key = "tags")
}
struct Value {
1: optional string VStr (go.tag = "json:\"v_str\"", agw.key = "v_str")
2: optional double VDouble (go.tag = "json:\"v_double\"", agw.key = "v_double")
3: optional bool VBool (go.tag = "json:\"v_bool\"", agw.key = "v_bool")
4: optional i64 VLong (go.tag = "json:\"v_long\"", agw.key = "v_long")
5: optional binary VBytes (go.tag = "json:\"v_bytes\"", agw.key = "v_bytes")
}
enum TagType {
STRING = 0
DOUBLE = 1
BOOL = 2
LONG = 3
BYTES = 4
}
struct ListRootSpansResponse {
1: optional list<Span> Spans (go.tag = "json:\"spans\"", api.body = "spans")
255: optional base.BaseResp BaseResp
}
struct GetTraceSDKRequest {
2: optional string LogID (go.tag = "json:\"log_id\"", api.query = "log_id")
4: optional i64 StartAt (go.tag = "json:\"start_at\"", api.query = "start_at") // 单位是毫秒
5: optional i64 EndAt (go.tag = "json:\"end_at\"", api.query = "end_at") // 单位是毫秒
6: optional i64 WorkflowID (go.tag = "json:\"workflow_id\"", api.query = "workflow_id")
7: optional i64 ExecuteID (go.tag = "json:\"execute_id\"", api.query = "execute_id")
255: optional base.Base Base
}
enum QueryScene {
ALICE_OP = 0 // doubao cici 全链路调试台
DOUBAO_CICI_DEBUG = 1 // doubao cici debug 功能
WORKFLOW_DEBUG = 2 // workflow debug 功能
}
enum TenantLevel {
Ordinary = 0
AdvancedWhitelist = 1
}
struct GetTraceSDKResponse {
1: optional TraceFrontend data
255: optional base.BaseResp BaseResp
}
struct KeyScene {
1: optional string Scene (go.tag = "json:\"scene\"", agw.key = "scene") // 场景,如"拆分搜索词"\"搜索"
2: optional string StatusMessage (go.tag = "json:\"status_message\"", agw.key = "status_message") // 状态信息
3: optional string System (go.tag = "json:\"system\"", agw.key = "system")
4: optional list<MessageItem> HistoryMessages (go.tag = "json:\"history_messages\"", agw.key = "history_messages") // 历史消息
5: optional KeySceneInput Input (go.tag = "json:\"input\"", agw.key = "input") // 输入
6: optional KeySceneOutput Output (go.tag = "json:\"output\"", agw.key = "output") // 输出
7: optional i64 Duration (go.tag = "json:\"duration\"", agw.key = "duration") // 单位是毫秒
8: optional i64 StartTime (go.tag = "json:\"start_time\"", api.body = "start_time") // 开始时间,用于排序,单位是毫秒
9: optional list<KeyScene> SubKeyScenes (go.tag = "json:\"sub_key_scenes\"", agw.key = "sub_key_scenes") // 子场景
}
struct KeySceneInput {
1: optional string Role (go.tag = "json:\"role\"", agw.key = "role")
2: optional list<TraceSummaryContent> contentList (go.tag = "json:\"content_list\"", agw.key = "content_list")
}
struct KeySceneOutput {
1: optional string Role (go.tag = "json:\"role\"", agw.key = "role")
2: optional list<TraceSummaryContent> contentList (go.tag = "json:\"content_list\"", agw.key = "content_list")
}
struct TraceSummaryContent {
1: optional string Key (go.tag = "json:\"key\"", agw.key = "key") // 键
2: optional string Content (go.tag = "json:\"content\"", agw.key = "content") // 内容
}
struct MessageItem {
1: optional string Role (go.tag = "json:\"role\"", agw.key = "role") // 角色
2: optional string Content (go.tag = "json:\"content\"", agw.key = "content") // 内容
}
struct SpanSummary {
1: optional list<FrontendTag> Tags (go.tag = "json:\"tags\"", agw.key = "tags")
}
struct FrontendTag {
1: required string Key (go.tag = "json:\"key\"", agw.key = "key")
2: optional string KeyAlias (go.tag = "json:\"key_alias\"", agw.key = "key_alias") // 多语,如无配置时值沿用 key
3: required TagType TagType (go.tag = "json:\"tag_type\"", agw.key = "tag_type")
4: optional Value Value (go.tag = "json:\"value\"", agw.key = "value")
5: optional FrontedTagType FrontendTagType (go.tag = "json:\"frontend_tag_type\"", agw.key = "frontend_tag_type") // 前端类型,用于前端处理
6: optional bool canCopy (go.tag = "json:\"can_copy\"", agw.key = "can_copy") // 是否可复制
}
struct TraceSummary{
1: optional string System (go.tag = "json:\"system\"", agw.key = "system") // 一级 System 的文本
2: optional list<MessageItem> HistoryMessages (go.tag = "json:\"history_messages\"", agw.key = "history_messages") // 一级历史消息
3: optional list<KeyScene> KeyScenes (go.tag = "json:\"key_scenes\"", agw.key = "key_scenes")
4: optional string Input (go.tag = "json:\"input\"", agw.key = "input") // 输入
5: optional string Output (go.tag = "json:\"output\"", agw.key = "output") // 输出
6: optional i64 Duration (go.tag = "json:\"duration\"", agw.key = "duration") // 一级当前对话的耗时, 单位是毫秒
7: optional string UserID (go.tag = "json:\"user_id\"", agw.key = "user_id") // 用户ID
}
struct TraceHeader {
1: optional i64 Duration (go.tag = "json:\"duration\"", agw.key = "duration") // 单位是毫秒
2: optional i32 Tokens (agw.key = "tokens") // 输入消耗token数
3: optional i32 StatusCode (go.tag = "json:\"status_code\"", agw.key = "status_code")
4: optional list<FrontendTag> Tags (go.tag = "json:\"tags\"", agw.key = "tags")
5: optional string MessageID (go.tag = "json:\"message_id\"", agw.key = "message_id") // 消息ID
6: optional i64 StartTime (go.tag = "json:\"start_time\"", agw.key = "start_time") // 单位是毫秒
}
struct TraceFrontend {
1: optional list<TraceFrontendSpan> spans (go.tag = "json:\"spans\"", api.body = "spans")
2: optional TraceHeader header (go.tag = "json:\"header\"", agw.key = "header")
}
struct TraceFrontendDoubaoCiciDebug {
1: optional list<TraceFrontendSpan> spans (go.tag = "json:\"spans\"", api.body = "spans")
2: optional TraceHeader header (go.tag = "json:\"header\"", agw.key = "header")
3: optional TraceSummary summary (go.tag = "json:\"summary\"", agw.key = "summary")
}
enum InputOutputType {
TEXT = 0 // 文本类型
}
struct SpanInputOutput {
1: optional InputOutputType Type (go.tag = "json:\"type\"", agw.key = "type") // TEXT
2: optional string Content (go.tag = "json:\"content\"", agw.key = "content")
}
struct TraceFrontendSpan {
1: string TraceID (go.tag = "json:\"trace_id\"", agw.key = "trace_id")
2: string LogID (go.tag = "json:\"log_id\"", agw.key = "log_id")
3: string SpanID (go.tag = "json:\"span_id\"", agw.key = "span_id")
4: string Type (go.tag = "json:\"type\"", agw.key = "type")
5: string Name (go.tag = "json:\"name\"", agw.key = "name")
6: string AliasName (go.tag = "json:\"alias_name\"", agw.key = "alias_name")
7: string ParentID (go.tag = "json:\"parent_id\"", agw.key = "parent_id")
8: i64 Duration (go.tag = "json:\"duration\"", agw.key = "duration") // 单位是毫秒
9: i64 StartTime (go.tag = "json:\"start_time\"", agw.key = "start_time") // 单位是毫秒
10: i32 StatusCode (go.tag = "json:\"status_code\"", agw.key = "status_code")
11: optional list<TraceTag> Tags (go.tag = "json:\"tags\"", agw.key = "tags")
12: optional SpanSummary summary (go.tag = "json:\"summary\"", agw.key = "summary") // 节点详情
13: optional SpanInputOutput Input (go.tag = "json:\"input\"", agw.key = "input")
14: optional SpanInputOutput Output (go.tag = "json:\"output\"", agw.key = "output")
15: optional bool IsEntry (go.tag = "json:\"is_entry\"", agw.key = "is_entry") // 是否是入口节点
16: optional string ProductLine (go.tag = "json:\"product_line\"", agw.key = "product_line") // 产品线
17: optional bool IsKeySpan (go.tag = "json:\"is_key_span\"", agw.key = "is_key_span") // 是否是关键节点
18: optional list<string> OwnerList (go.tag = "json:\"owner_list\"", agw.key = "owner_list") // 节点负责人列表, 邮箱前缀
19: optional string RundownDocURL (go.tag = "json:\"rundown_doc_url\"", agw.key = "rundown_doc_url") // 节点详情文档
}

File diff suppressed because it is too large Load Diff

View 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")
}

View 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
}

View 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")
}

View 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")
}

View 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_type1-预设任务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/-10-最后一页,-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
}

View 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
View 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")
}

View File

@@ -0,0 +1,98 @@
namespace go flow.dataengine.dataset
// 类型
enum FormatType {
Text = 0 // 文本
Table = 1 // 表格
Image = 2 // 图片
Database = 3 // 数据库
}
struct ChunkStrategy {
1: string separator // 分隔符,如句号
2: i64 max_tokens // 分片的最大token数
3: bool remove_extra_spaces // 替换掉连续的空格、换行符和制表符
4: bool remove_urls_emails // 是否去除url和email
5: ChunkType chunk_type // 如果为0, 则不使用以上字段的配置
7: optional CaptionType caption_type // 图片类型,图片描述文字的标注方式
8: optional i64 overlap; //分段重叠度
9: optional i64 max_level; //最大层级数(按层级分段时生效)
10: optional bool save_title; //切片保留层级标题(按层级分段时生效)
}
enum ChunkType{
DefaultChunk = 0
CustomChunk = 1
LevelChunk = 2
}
enum ContentSchema{
DefaultSchema = 0
LinkReaderSchema = 1
}
enum CaptionType {
Auto = 0 // 智能标注
Manual = 1 // 人工标注
}
enum DocumentStatus {
Processing = 0 // 上传中
Enable = 1 // 生效
Disable = 2 // 失效
Deleted = 3 // 删除
Resegment = 4 // 重新分片中,调用方不感知该状态
Refreshing = 5 // 刷新中(刷新成功后会删除)
Failed = 9 // 失败
}
enum DocumentSource {
Document = 0 // 本地文件上传
Custom = 2 // 自定义类型
}
struct ParsingStrategy{
1: optional ParsingType parsing_type; //解析类型
2: optional bool image_extraction; //是否开启图片元素提取(精准解析时生效)
3: optional bool table_extraction; //是否开启表格元素提取(精准解析时生效)
4: optional bool image_ocr; //是否开启图片OCR精准解析时生效
}
enum ParsingType{
FastParsing = 0 //快速解析
AccurateParsing = 1 //精准解析
}
struct IndexStrategy{
1: optional bool vector_indexing; //是否开启向量索引默认为true
2: optional bool keyword_indexing; //是否开启关键词索引默认为true
3: optional bool hierarchical_indexing; //是否开启分层索引
4: optional string model; //向量模型
}
struct FilterStrategy{
1: optional list<i32> filter_page; //过滤页数
}
// 排序字段
enum OrderField {
CreateTime = 1
UpdateTime = 2
}
// 排序规则
enum OrderType {
Desc = 1
Asc = 2
}
struct SinkStrategy {
1: bool check_index // 是否检查索引成功
}
enum ReviewStatus {
Processing = 0 // 处理中
Enable = 1 // 已完成
Failed = 2 // 失败
ForceStop = 3 // 失败
}

View File

@@ -0,0 +1,164 @@
include "../../base.thrift"
include "common.thrift"
namespace go flow.dataengine.dataset
struct CreateDatasetRequest {
1: string name // 知识库名称长度不超过100个字符
2: string description // 知识库描述
3: i64 space_id (agw.js_conv="str", api.js_conv="true") // 空间ID
4: string icon_uri // 知识库头像URI
5: common.FormatType format_type
6: i64 biz_id (agw.js_conv="str", api.js_conv="true") // 开放给第三方的业务标识, coze 传 0 或者不传
7: i64 project_id (agw.js_conv="str", api.js_conv="true") //新增project ID
255: optional base.Base Base
}
struct CreateDatasetResponse {
1: i64 dataset_id (agw.js_conv="str", api.js_conv="true")
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct DatasetDetailRequest {
1: list<string> DatasetIDs (agw.js_conv="str", api.body="dataset_ids")
3: i64 project_id (agw.js_conv="str", api.js_conv="true") //新增project ID
2: i64 space_id (agw.js_conv="str", api.js_conv="true")
255: optional base.Base Base
}
struct DatasetDetailResponse {
1: map<string, Dataset> dataset_details (agw.js_conv="str")
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
enum DatasetStatus {
DatasetProcessing = 0
DatasetReady = 1
DatasetDeleted = 2 // 软删
DatasetForbid = 3 // 不启用
DatasetFailed = 9
}
struct Dataset {
1: i64 dataset_id(agw.js_conv="str", api.js_conv="true")
2: string name // 数据集名称
3: list<string> file_list // 文件列表
4: i64 all_file_size (agw.js_conv="str", api.js_conv="true") // 所有文件大小
5: i32 bot_used_count // 使用Bot数
6: DatasetStatus status
7: list<string> processing_file_list // 处理中的文件名称列表,兼容老逻辑
8: i32 update_time // 更新时间,秒级时间戳
9: string icon_url
10: string description
11: string icon_uri
12: bool can_edit // 是否可以编辑
13: i32 create_time // 创建时间,秒级时间戳
14: i64 creator_id (agw.js_conv="str", api.js_conv="true") // 创建者ID
15: i64 space_id (agw.js_conv="str", api.js_conv="true") // 空间ID
18: list<string> failed_file_list (agw.js_conv="str") // 处理失败的文件
19: common.FormatType format_type
20: i32 slice_count // 分段数量
21: i32 hit_count // 命中次数
22: i32 doc_count // 文档数量
23: common.ChunkStrategy chunk_strategy // 切片规则
24: list<string> processing_file_id_list // 处理中的文件ID列表
25: string project_id //新增project ID
}
struct ListDatasetRequest {
1: optional DatasetFilter filter
3: optional i32 page
4: optional i32 size
5: i64 space_id (agw.js_conv="str", api.js_conv="true")
6: optional common.OrderField order_field // 排序字段
7: optional common.OrderType order_type // 排序规则
8: optional string space_auth // 如果传了指定值, 就放开校验
9: optional i64 biz_id (agw.js_conv="str", api.js_conv="true") // 开放给第三方的业务标识
10: optional bool need_ref_bots // 是否需要拉取引用bots的数量会增加响应延时
11: optional string project_id //新增project ID
255: optional base.Base Base
}
struct ListDatasetResponse {
1: list<Dataset> dataset_list
2: i32 total
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct DatasetFilter {
// 如果都设置了And 关系
1: optional string name // 关键字搜索, 按照名称模糊匹配
2: optional list<string> dataset_ids (agw.js_conv="str") // 知识库id列表
3: optional DatasetSource source_type // 来源
4: optional DatasetScopeType scope_type // 搜索类型
5: optional common.FormatType format_type // 类型
}
enum DatasetScopeType {
ScopeAll = 1
ScopeSelf = 2
}
enum DatasetSource{
SourceSelf = 1
SourceExplore = 2
}
struct DeleteDatasetRequest {
1: i64 dataset_id (agw.js_conv="str", api.js_conv="true")
255: optional base.Base Base
}
struct DeleteDatasetResponse {
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct UpdateDatasetRequest {
1: i64 dataset_id (agw.js_conv="str", api.js_conv="true") // 知识库id
2: string name // 知识库名称,不能为空
3: string icon_uri // 知识库icon
4: string description // 知识库描述
5: optional DatasetStatus status
255: optional base.Base Base;
}
struct UpdateDatasetResponse {
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct GetIconRequest {
1: common.FormatType format_type
}
struct Icon {
1: string url
2: string uri
}
struct GetIconResponse {
1: Icon icon
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}

View File

@@ -0,0 +1,337 @@
include "../../base.thrift"
include "common.thrift"
namespace go flow.dataengine.dataset
struct ListDocumentRequest {
1: required i64 dataset_id(agw.js_conv='str', api.js_conv='true')
2: optional list<string> document_ids (agw.js_conv='str')
3: optional i32 page
4: optional i32 size
5: optional string keyword // 根据名称搜索
255: optional base.Base Base
}
struct ListDocumentResponse {
1: list<DocumentInfo> document_infos
2: i32 total
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct DocumentInfo {
1: string name
2: i64 document_id(agw.js_conv='str', api.js_conv='true')
3: optional string tos_uri // 文件链接
5: i32 create_time // 创建时间
6: i32 update_time // 更新时间
7: optional i64 creator_id (agw.js_conv="str", api.js_conv='true', api.body="creator_id") // 创建人
8: i32 slice_count // 包含分段数量
9: string type // 文件后缀 csv, pdf 等
10: i32 size // 文件大小 字节数
11: i32 char_count // 字符数
12: common.DocumentStatus status // 状态
13: i32 hit_count // 命中次数
14: common.DocumentSource source_type // 来源
18: common.FormatType format_type // 文件类型
19: optional list<TableColumn> table_meta // 表格类型元数据
20: optional string web_url // url 地址
21: optional string status_descript // 状态的详细信息;如果切片失败,返回失败信息
24: optional i64 space_id(agw.js_conv="str", api.js_conv="true") // 空间id
// 以下字段仅针对重构后的表格类型有用,用于前端判断
26: optional bool editable_append_content // 仅针对表格类型,是否允许添加内容、修改表结构
27: common.ChunkStrategy chunk_strategy // 切片规则
28: optional string imagex_uri // imagex 存储的文件链接
29: optional string doc_outline // 层级分段文档树Json (未使用)
30: optional common.ParsingStrategy parsing_strategy // 解析策略
32: optional common.FilterStrategy filter_strategy // 过滤策略
33: optional string doc_tree_tos_url // 层级分段文档树 tos_url
34: optional string preview_tos_url // 预览用的原文档 tos_url
35: optional i64 review_id // 预览用的原文档 tos_url
}
struct TableColumn {
1: i64 id(agw.js_conv="str", api.js_conv="true", api.body="id") // 列 id
2: string column_name // 列名
3: bool is_semantic // 是否为语义匹配列
4: i64 sequence(agw.js_conv="str", api.js_conv="true", api.body="sequence")// 列原本在 excel 的序号
5: optional ColumnType column_type // 列类型
6: optional bool contains_empty_value
7: optional string desc // 描述
}
enum ColumnType {
Unknown = 0
Text = 1 // 文本
Number = 2 // 数字
Date = 3 // 时间
Float = 4 // float
Boolean = 5 // bool
Image = 6 // 图片
}
struct DeleteDocumentRequest {
2: list<string> document_ids // 要删除的文档ID列表
255: optional base.Base Base
}
struct DeleteDocumentResponse {
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct UpdateDocumentRequest{
1: i64 document_id (agw.js_conv="str", api.js_conv="true")
// 需要更新就传, 更新名称
3: optional string document_name
// 更新表结构
5: optional list<TableColumn> table_meta // 表格元数据
255: optional base.Base Base
}
struct UpdateDocumentResponse {
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct UpdatePhotoCaptionRequest {
1: required i64 document_id(agw.js_conv='str', api.js_conv='true') // 文档ID
2: required string caption // 要更新的图片描述信息
255: optional base.Base Base
}
struct UpdatePhotoCaptionResponse {
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp(api.none="true")
}
struct ListPhotoRequest {
1: required i64 dataset_id(agw.js_conv='str', api.js_conv='true') // 知识库ID
2: optional i32 page // 页数,从 1 开始
3: optional i32 size // 每页大小
4: optional PhotoFilter filter
255: optional base.Base Base
}
struct PhotoFilter {
1: optional bool has_caption // true 筛选 “已标注” 的图片false 筛选 “未标注” 的图片
2: optional string keyword // 搜索关键字,对图片名称和图片描述进行搜索
3: optional common.DocumentStatus status // 状态
}
struct ListPhotoResponse {
1: list<PhotoInfo> photo_infos
2: i32 total
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp(api.none="true")
}
struct PhotoInfo { // 图片型知识库一个图片对应一个文档
1: string name // 图片名称
2: i64 document_id(agw.js_conv='str', api.js_conv='true') // 文档ID
3: string url // 图片链接
4: string caption // 图片描述信息
5: i32 create_time // 创建时间
6: i32 update_time // 更新时间
7: i64 creator_id (agw.js_conv="str", api.js_conv='true', agw.key="creator_id", api.body="creator_id") // 创建人
8: string type // 图片后缀 jpg, png 等
9: i32 size // 图片大小
10: common.DocumentStatus status // 状态
11: common.DocumentSource source_type // 来源
}
struct PhotoDetailRequest {
1: required list<string> document_ids (agw.js_conv='str') // 文档ID列表
2: required i64 dataset_id(agw.js_conv='str', api.js_conv='true') // 知识库ID
255: optional base.Base Base
}
struct PhotoDetailResponse {
1: map<string, PhotoInfo> photo_infos // 文档ID到图片信息的映射
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp(api.none="true")
}
struct ResegmentRequest {
1: i64 dataset_id (agw.js_conv="str", api.js_conv="true") // 知识库ID
2: list<string> document_ids // 要重新分段的文档
3: common.ChunkStrategy chunk_strategy // 分段策略
5: optional common.ParsingStrategy parsing_strategy // 解析策略
7: optional common.FilterStrategy filter_strategy; // 过滤策略
255: optional base.Base Base
}
struct ResegmentResponse {
1: list<DocumentInfo> document_infos // 老版需要. 仅返回id 和名称即可
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct CreateDocumentRequest {
1: i64 dataset_id(agw.js_conv='str', api.js_conv='true') // 要插入文档的知识库id
4: common.FormatType format_type // 知识库的类型,目前支持文本、表格、图片三种知识库
// 表格类型一次只能创建一个
6: list<DocumentBase> document_bases // 待创建的文档信息
17: optional common.ChunkStrategy chunk_strategy // 只在知识库中没有文档时需要传递,已有则从知识库获取.切片规则,为空则自动按段落切片
31: optional bool is_append // 为 true 时向已有的 document 追加内容。text 类型不能使用
32: optional common.ParsingStrategy parsing_strategy // 解析策略
255: optional base.Base Base
}
struct CreateDocumentResponse {
2: list<DocumentInfo> document_infos
253: required i32 code
254: required string msg
255: required base.BaseResp BaseResp
}
// 用于创建文档的基本信息
struct DocumentBase{
1: string name // 文档名称
2: SourceInfo source_info
// 以下参数表格类型需要传递
4: optional list<TableColumn> table_meta // 表格元数据
5: optional TableSheet table_sheet // 表格解析信息
6: optional common.FilterStrategy filter_strategy // 过滤策略
7: optional string caption // 图片类型知识库,人工标注时的图片描述
}
// 支持多种数据源
struct SourceInfo {
1: optional string tos_uri (api.body="tos_uri"); // 本地上传返回的 uri
4: optional common.DocumentSource document_source (api.body="document_source");
// document_source 自定义原始内容: 表格型知识库需要符合的格式json list<map<string, string>>
5: optional string custom_content (api.body="custom_content")
// document_source 本地: 如果不传 tos 地址, 则需要传文件 base64, 类型
7: optional string file_base64 // 文件经过 base64 后的字符串
8: optional string file_type // 文件类型, 比如 pdf
// imagex_uri, 和 tos_uri 二选一, imagex_uri 优先,需要通过 imagex 的方法获取数据和签发 url
10: optional string imagex_uri
}
struct TableSheet {
1: i64 sheet_id (agw.js_conv="str", agw.key="sheet_id", api.js_conv="true", api.body="sheet_id") , // 用户选择的 sheet id
2: i64 header_line_idx (agw.js_conv="str", agw.key="header_line_idx", api.js_conv="true", api.body="header_line_idx"), // 用户选择的表头行数,从 0 开始编号
3: i64 start_line_idx (agw.js_conv="str", agw.key="start_line_idx", api.js_conv="true", api.body="start_line_idx") , // 用户选择的起始行号,从 0 开始编号
}
struct GetDocumentProgressRequest {
1: list<string> document_ids
255: optional base.Base Base
}
struct GetDocumentProgressResponse {
1: list<DocumentProgress> data
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct DocumentProgress {
1: i64 document_id(agw.js_conv="str", api.js_conv='true')
2: i32 progress // 知识库进度百分比
3: common.DocumentStatus status
4: optional string status_descript // 状态的详细描述;如果切片失败,返回失败信息
5: string document_name
6: optional i64 remaining_time // 剩余时间单位秒
7: optional i64 size
8: optional string type
9: optional string url
}
// 获取 database 上传的表格文件元信息
struct GetTableSchemaRequest {
1: optional TableSheet table_sheet; // 表格解析信息, 默认初始值0,0,1表示第1个表格表头行为第1行数据行从第2行开始
2: optional TableDataType table_data_type; // 不传默认返回所有数据
3: optional i64 document_id(agw.js_conv="str", agw.key="document_id", api.js_conv="true", api.body="document_id"); // 兼容重构前的版本:如果需要拉取的是当前 document 的 schema 时传递该值
4: optional SourceInfo source_file; // source file 的信息,新增 segment / 之前逻辑迁移到这里
5: optional list<TableColumn> origin_table_meta; // 表格预览前端需要传递原始的数据表结构
6: optional list<TableColumn> preview_table_meta; // 表格预览前端需要传递用户编辑之后的数据表结构
255: optional base.Base Base
}
enum TableDataType {
AllData = 0 // schema sheets 和 preview data
OnlySchema = 1 // 只需要 schema 结构 & Sheets
OnlyPreview = 2 // 只需要 preview data
}
struct DocTableSheet {
1: i64 id; // sheet 的编号
2: string sheet_name; // sheet 名
3: i64 total_row; // 总行数
}
struct GetTableSchemaResponse {
1: required i32 code
2: required string msg
3: list<DocTableSheet> sheet_list
4: list<TableColumn> table_meta // 选中的 sheet 的 schema, 不选择默认返回第一个 sheet
5: list<map<string,string>> preview_data(api.body="preview_data") // knowledge table 场景中会返回
255: optional base.BaseResp BaseResp(api.none="true")
}
// 判断用户配置的 schema 是否和对应 document id 的一致
struct ValidateTableSchemaRequest {
1: i64 space_id (agw.js_conv="str", agw.key="space_id", api.js_conv="true", api.body="space_id") // 空间ID
2: i64 document_id (agw.js_conv="str", agw.key="document_id", api.js_conv="true", api.body="document_id") // 要校验的文档ID
3: SourceInfo source_info (api.body="source_file") // source file 的信息
4: TableSheet table_sheet (api.body="table_sheet") // 表格解析信息, 默认初始值0,0,1表示第1个表格表头行为第1行数据行从第2行开始
255: optional base.Base Base
}
struct ValidateTableSchemaResponse {
1: optional map<string,string> ColumnValidResult (api.body="column_valid_result");
// 如果失败会返回错误码
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp(api.none="true")
}
struct ExtractPhotoCaptionRequest {
1: required i64 document_id (agw.js_conv="str", agw.key="document_id", api.js_conv="true", api.body="document_id")
255: optional base.Base Base
}
struct ExtractPhotoCaptionResponse {
1: string caption // 图片描述
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp(api.none="true")
}

View File

@@ -0,0 +1,40 @@
include "slice.thrift"
include "dataset.thrift"
include "document.thrift"
include "common.thrift"
include "review.thrift"
namespace go flow.dataengine.dataset
service DatasetService {
// 知识库相关
dataset.GetIconResponse GetIconForDataset(1:dataset.GetIconRequest req) (api.post='/api/knowledge/icon/get', api.category="knowledge",agw.preserve_base="true")
dataset.CreateDatasetResponse CreateDataset(1:dataset.CreateDatasetRequest req) (api.post='/api/knowledge/create', api.category="knowledge",agw.preserve_base="true")
dataset.DatasetDetailResponse DatasetDetail(1:dataset.DatasetDetailRequest req) (api.post='/api/knowledge/detail', api.category="knowledge",agw.preserve_base="true")
dataset.ListDatasetResponse ListDataset(1:dataset.ListDatasetRequest req) (api.post='/api/knowledge/list', api.category="knowledge",agw.preserve_base="true")
dataset.DeleteDatasetResponse DeleteDataset(1:dataset.DeleteDatasetRequest req) (api.post='/api/knowledge/delete', api.category="knowledge",agw.preserve_base="true")
dataset.UpdateDatasetResponse UpdateDataset(1:dataset.UpdateDatasetRequest req) (api.post='/api/knowledge/update', api.category="knowledge",agw.preserve_base="true")
// Document相关
document.CreateDocumentResponse CreateDocument(1:document.CreateDocumentRequest req) (api.post='/api/knowledge/document/create', api.category="knowledge",agw.preserve_base="true")
document.ListDocumentResponse ListDocument(1:document.ListDocumentRequest req) (api.post='/api/knowledge/document/list', api.category="knowledge",agw.preserve_base="true")
document.DeleteDocumentResponse DeleteDocument(1:document.DeleteDocumentRequest req) (api.post='/api/knowledge/document/delete', api.category="knowledge",agw.preserve_base="true")
document.UpdateDocumentResponse UpdateDocument(1:document.UpdateDocumentRequest req) (api.post='/api/knowledge/document/update', api.category="knowledge",agw.preserve_base="true")
document.GetDocumentProgressResponse GetDocumentProgress(1:document.GetDocumentProgressRequest req) (api.post='/api/knowledge/document/progress/get', api.category="knowledge",agw.preserve_base="true")
document.ResegmentResponse Resegment(1:document.ResegmentRequest req) (api.post='/api/knowledge/document/resegment', api.category="knowledge",agw.preserve_base="true")
document.UpdatePhotoCaptionResponse UpdatePhotoCaption(1:document.UpdatePhotoCaptionRequest req) (api.post='/api/knowledge/photo/caption', api.category="knowledge",agw.preserve_base="true")
document.ListPhotoResponse ListPhoto(1:document.ListPhotoRequest req) (api.post='/api/knowledge/photo/list', api.category="knowledge",agw.preserve_base="true")
document.PhotoDetailResponse PhotoDetail(1:document.PhotoDetailRequest req) (api.post='/api/knowledge/photo/detail', api.category="knowledge",agw.preserve_base="true")
document.ExtractPhotoCaptionResponse ExtractPhotoCaption(1:document.ExtractPhotoCaptionRequest req) (api.post='/api/knowledge/photo/extract_caption', api.category="knowledge",agw.preserve_base="true")
document.GetTableSchemaResponse GetTableSchema(1:document.GetTableSchemaRequest req) (api.post='/api/knowledge/table_schema/get', api.category="knowledge",agw.preserve_base="true")
document.ValidateTableSchemaResponse ValidateTableSchema(1:document.ValidateTableSchemaRequest req) (api.post='/api/knowledge/table_schema/validate', api.category="knowledge",agw.preserve_base="true")
// slice相关
slice.DeleteSliceResponse DeleteSlice(1:slice.DeleteSliceRequest req) (api.post='/api/knowledge/slice/delete', api.category="knowledge",agw.preserve_base="true")
slice.CreateSliceResponse CreateSlice(1:slice.CreateSliceRequest req) (api.post='/api/knowledge/slice/create', api.category="knowledge",agw.preserve_base="true")
slice.UpdateSliceResponse UpdateSlice(1:slice.UpdateSliceRequest req) (api.post='/api/knowledge/slice/update', api.category="knowledge",agw.preserve_base="true")
slice.ListSliceResponse ListSlice(1:slice.ListSliceRequest req) (api.post='/api/knowledge/slice/list', api.category="knowledge",agw.preserve_base="true")
/** 预分片相关 **/
review.CreateDocumentReviewResponse CreateDocumentReview(1:review.CreateDocumentReviewRequest req) (api.post='/api/knowledge/review/create', api.category="knowledge",agw.preserve_base="true")
review.MGetDocumentReviewResponse MGetDocumentReview(1:review.MGetDocumentReviewRequest req) (api.post='/api/knowledge/review/mget', api.category="knowledge",agw.preserve_base="true")
review.SaveDocumentReviewResponse SaveDocumentReview(1:review.SaveDocumentReviewRequest req) (api.post='/api/knowledge/review/save', api.category="knowledge",agw.preserve_base="true")
}

View File

@@ -0,0 +1,69 @@
include "../../base.thrift"
include "common.thrift"
namespace go flow.dataengine.dataset
struct ReviewInput {
1: string document_name
2: string document_type
3: string tos_uri
4: optional i64 document_id (agw.js_conv="str",api.js_conv="true")
}
struct Review {
1: optional i64 review_id (agw.js_conv="str",api.js_conv="true")
2: string document_name
3: string document_type
4: string tos_url
5: optional common.ReviewStatus status // 状态
6: optional string doc_tree_tos_url
7: optional string preview_tos_url
}
struct CreateDocumentReviewRequest {
1: i64 dataset_id (agw.js_conv="str",api.js_conv="true")
2: list<ReviewInput> reviews
3: optional common.ChunkStrategy chunk_strategy
4: optional common.ParsingStrategy parsing_strategy
255: optional base.Base Base
}
struct CreateDocumentReviewResponse {
1: i64 dataset_id (agw.js_conv="str",api.js_conv="true")
2: list<Review> reviews
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct MGetDocumentReviewRequest {
1: i64 dataset_id (agw.js_conv="str",api.js_conv="true")
2: list<string> review_ids (agw.js_conv="str")
255: optional base.Base Base
}
struct MGetDocumentReviewResponse {
1: i64 dataset_id (agw.js_conv="str",api.js_conv="true")
2: list<Review> reviews
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct SaveDocumentReviewRequest {
1: i64 dataset_id (agw.js_conv="str",api.js_conv="true")
2: i64 review_id (agw.js_conv="str",api.js_conv="true")
3: string doc_tree_json
255: optional base.Base Base
}
struct SaveDocumentReviewResponse {
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}

View File

@@ -0,0 +1,78 @@
include "../../base.thrift"
include "common.thrift"
namespace go flow.dataengine.dataset
struct DeleteSliceRequest {
4: optional list<string> slice_ids (api.body="slice_ids") // 要删除的分片ID列表
255: optional base.Base Base
}
struct DeleteSliceResponse {
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp(api.none="true")
}
struct CreateSliceRequest {
2: required i64 document_id(agw.js_conv="str", api.js_conv="true") // 新增分片插入的文档ID
5: optional string raw_text // 新增分片的内容
6: optional i64 sequence(agw.js_conv="str", api.js_conv="true") // 分片插入位置1表示文档开头最大值为最后一个分片位置+1
255: optional base.Base Base
}
struct CreateSliceResponse {
1: i64 slice_id (agw.js_conv="str", api.js_conv="true") // 新增分片ID
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct UpdateSliceRequest {
2: required i64 slice_id (agw.js_conv="str", api.js_conv="true") // 要更新的分片ID
7: optional string raw_text // 要更新的内容
255: optional base.Base Base
}
enum SliceStatus {
PendingVectoring = 0 // 未向量化
FinishVectoring = 1 // 已向量化
Deactive = 9 // 禁用
}
struct UpdateSliceResponse {
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct ListSliceRequest {
2: optional i64 document_id(agw.js_conv="str", api.js_conv="true") // 要list的分片所属的文档ID
3: optional i64 sequence(agw.js_conv="str", api.js_conv="true") // 分片序号表示从该序号的分片开始list
4: optional string keyword // 查询关键字
5: optional i64 dataset_id (agw.js_conv="str", api.js_conv="true") // 如果只传 dataset_id则返回该知识库下的分片
21: i64 page_size(agw.js_conv="str", api.js_conv="true") // 每页大小
255: optional base.Base Base
}
struct ListSliceResponse {
1: list<SliceInfo> slices // 返回的分片列表
2: i64 total(agw.js_conv="str", api.js_conv="true") // 总分片数
3: bool hasmore // 是否还有更多分片
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct SliceInfo {
1: i64 slice_id (agw.js_conv="str", api.js_conv="true") // 分片ID
2: string content // 分片内容
3: SliceStatus status // 分片状态
4: i64 hit_count(agw.js_conv="str", api.js_conv="true") // 命中次数
5: i64 char_count(agw.js_conv="str", api.js_conv="true") // 字符数
7: i64 sequence(agw.js_conv="str", api.js_conv="true") // 序号
8: i64 document_id(agw.js_conv="str", api.js_conv="true") // 分片所属的文档ID
9: string chunk_info // 分片相关的元信息, 透传 slice 表里的 extra->chunk_info 字段 (json)
}

View File

@@ -0,0 +1,26 @@
struct DocTableSheet {
1: i64 id; // sheet 的编号
2: string sheet_name; // sheet 名
3: i64 total_row; // 总行数
}
enum ColumnType {
Unknown = 0
Text = 1 // 文本
Number = 2 // 数字
Date = 3 // 时间
Float = 4 // float
Boolean = 5 // bool
Image = 6 // 图片
}
// 表格的列信息
struct DocTableColumn {
1: i64 id(agw.js_conv="str", api.js_conv="true", api.body="id"); // 列 id
2: string column_name; // 列名
3: bool is_semantic; // 是否为语义匹配列
4: i64 sequence(agw.js_conv="str", api.js_conv="true", api.body="sequence"); // 列原本在 excel 的序号
5: optional ColumnType column_type; // 列类型
6: optional bool contains_empty_value
7: optional string desc; // 描述
}

View File

@@ -0,0 +1,33 @@
include "../../../base.thrift"
include "common.thrift"
namespace go knowledge.document
// 获取表格结构、预览数据
struct GetDocumentTableInfoRequest {
2: optional string tos_uri; // 如果为第一次本地文件上传的表格,传递该值
3: optional i64 document_id(agw.js_conv="str", api.js_conv="true", api.body="document_id"); // 如果为已有 document 的表格,传递该值
4: i64 creator_id; // 创建人[http接口不需要传递]
255: optional base.Base Base
}
struct GetDocumentTableInfoResponse {
1: i32 code
2: string msg
3: list<common.DocTableSheet> sheet_list
4: map<string, list<common.DocTableColumn>> table_meta(api.body="table_meta") // key: sheet_id -> list<common.DocTableColumn>
5: map<string, list<map<string,string>>> preview_data(api.body="preview_data") // key: sheet_id -> list_preview_data
255: required base.BaseResp BaseResp(api.none="true")
}
struct GetTableSchemaInfoResponse {
1: i32 code
2: string msg
3: list<common.DocTableSheet> sheet_list
4: list<common.DocTableColumn> table_meta // 选中的 sheet 的 schema, 不选择默认返回第一个 sheet
5: list<map<i64,string>> preview_data(agw.js_conv="str", agw.key="preview_data") // knowledge table 场景中会返回
255: optional base.BaseResp BaseResp(api.none="true")
}

View File

@@ -0,0 +1,110 @@
include "../../../base.thrift"
include "../table/table.thrift"
include "./project_memory.thrift"
struct KVItem {
1: string keyword
2: string value
3: i64 create_time
4: i64 update_time
5: bool is_system
6: bool prompt_disabled
7: string schema
}
struct VariableInfo {
1: string key
2: string default_value
3: string description
4: string sensitive
5: string must_not_use_in_prompt
6: string can_write
7: string example
8: string ext_desc
9: string group_name
10: string group_desc
11: string group_ext_desc
12: optional list<string> EffectiveChannelList
}
struct GroupVariableInfo {
1: string group_name
2: string group_desc
3: string group_ext_desc
4: list<VariableInfo> var_info_list
5: list<GroupVariableInfo> sub_group_info
}
struct SetKvMemoryReq {
1: required i64 bot_id(agw.js_conv="str", api.js_conv="true", api.body="bot_id")
2: optional i64 user_id
3: required list<KVItem> data
4: optional i64 connector_id
5: optional table.RefInfo ref_info // 引用信息
6: optional string project_id
7: optional i64 ProjectVersion
255: optional base.Base Base
}
struct SetKvMemoryResp {
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct GetSysVariableConfRequest {
255: optional base.Base Base
}
struct GetSysVariableConfResponse {
1: list<VariableInfo> conf
2: list<GroupVariableInfo> group_conf
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct DelProfileMemoryResponse {
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct DelProfileMemoryRequest {
1: i64 user_id
2: i64 bot_id(agw.js_conv="str", api.js_conv="true", api.body="bot_id")
3: list<string> keywords
4: optional i64 connector_id
5: optional table.RefInfo ref_info // 引用信息
6: string project_id
255: optional base.Base Base
}
struct GetProfileMemoryRequest {
1: i64 user_id
2: i64 bot_id(agw.js_conv="str", api.js_conv="true", api.body="bot_id")
3: list<string> keywords
4: optional i64 connector_id
5: optional string version
6: optional table.RefInfo ref_info // 引用信息
7: optional string ext
8: optional string project_id
9: optional i64 ProjectVersion
10: optional project_memory.VariableChannel VariableChannel
255: optional base.Base Base
}
struct GetProfileMemoryResponse {
1: list<KVItem> memories
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}

View File

@@ -0,0 +1,93 @@
include "../../../base.thrift"
enum VariableType{
KVVariable = 1
ListVariable = 2
}
enum VariableChannel{
Custom = 1
System = 2
Location = 3
Feishu = 4
APP = 5 // 项目变量
}
struct Variable{
1: string Keyword
2: string DefaultValue
3: VariableType VariableType
4: VariableChannel Channel
5: string Description
6: bool Enable
7: optional list<string> EffectiveChannelList //生效渠道
8: string Schema //新老数据都会有schema除项目变量外其他默认为string
9: bool IsReadOnly
}
struct GroupVariableInfo{
1: string GroupName
2: string GroupDesc
3: string GroupExtDesc
4: list<Variable> VarInfoList
5: list<GroupVariableInfo> SubGroupList
6: bool IsReadOnly
7: optional VariableChannel DefaultChannel
}
struct GetProjectVariableListReq {
1: string ProjectID
2: i64 UserID
3: i64 version (agw.js_conv="str", api.js_conv="true")
255: optional base.Base Base
}
struct GetProjectVariableListResp {
1: list<Variable> VariableList
2: bool CanEdit
3: list<GroupVariableInfo> GroupConf
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct UpdateProjectVariableReq {
1: string ProjectID
2: i64 UserID
3: list<Variable> VariableList
255: optional base.Base Base
}
struct UpdateProjectVariableResp {
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
enum VariableConnector{
Bot = 1
Project = 2
}
struct GetMemoryVariableMetaReq {
1: string ConnectorID
2: VariableConnector ConnectorType
3: optional string version
255: optional base.Base Base
}
//应该是给workflow用的rpc接口不需要鉴权VariableChannel
struct GetMemoryVariableMetaResp {
1: map<VariableChannel, list<Variable>> VariableMap
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}

View File

@@ -0,0 +1,24 @@
include "kvmemory/kvmemory.thrift"
include "kvmemory/project_memory.thrift"
include "knowledge/kdocument.thrift"
include "table/table.thrift"
namespace go ocean.cloud.memory
service MemoryService {
// --- variable
project_memory.GetProjectVariableListResp GetProjectVariableList(1:project_memory.GetProjectVariableListReq req)(api.get='/api/memory/project/variable/meta_list', api.category="memory_project")
project_memory.UpdateProjectVariableResp UpdateProjectVariable(1:project_memory.UpdateProjectVariableReq req)(api.post='/api/memory/project/variable/meta_update', api.category="memory_project")
project_memory.GetMemoryVariableMetaResp GetMemoryVariableMeta(1:project_memory.GetMemoryVariableMetaReq req)(api.post='/api/memory/variable/get_meta', api.category="memory",agw.preserve_base="true")
kvmemory.DelProfileMemoryResponse DelProfileMemory(1:kvmemory.DelProfileMemoryRequest req)(api.post='/api/memory/variable/delete', api.category="memory",agw.preserve_base="true")
kvmemory.GetProfileMemoryResponse GetPlayGroundMemory(1:kvmemory.GetProfileMemoryRequest req)(api.post='/api/memory/variable/get', api.category="memory",agw.preserve_base="true")
kvmemory.GetSysVariableConfResponse GetSysVariableConf(1:kvmemory.GetSysVariableConfRequest req)(api.get='/api/memory/sys_variable_conf', api.category="memory")
kvmemory.SetKvMemoryResp SetKvMemory(1: kvmemory.SetKvMemoryReq req)(api.post='/api/memory/variable/upsert', api.category="memory",agw.preserve_base="true")
// ---
table.GetModeConfigResponse GetModeConfig(1:table.GetModeConfigRequest req)(api.get='/api/memory/table_mode_config', api.category="memory", agw.preserve_base="true")
kdocument.GetDocumentTableInfoResponse GetDocumentTableInfo(1:kdocument.GetDocumentTableInfoRequest req) (api.get='/api/memory/doc_table_info', api.category="memory", agw.preserve_base="true")
}

View File

@@ -0,0 +1,886 @@
include "../../../base.thrift"
enum RefType {
NoRef = 0
Bot = 1
ChatGroup = 2
}
struct RefInfo {
1: RefType ref_type // 引用类型
2: string ref_id // 引用 id
}
enum BotTableStatus {
Online = 1 // 已上线
Delete = 2 // 删除
}
enum FieldItemType {
Text = 1 // 文本
Number = 2 // 数字
Date = 3 // 时间
Float = 4 // float
Boolean = 5 // bool
}
struct FieldItem {
1: string name
2: string desc
3: FieldItemType type
4: bool must_required
5: i64 id // 该字段只用来判断是否发布,不为 0 就是已发布的,前端对已发布的字段不能修改字段类型
6: i64 alterId // 修改字段时alter、publish用来判断增删改0 表示新增,非 0 表示修改或删除
7: bool is_system_field // 是否是系统字段
}
enum BotTableRWMode {
LimitedReadWrite = 1 // 单用户模式
ReadOnly = 2 // 只读模式
UnlimitedReadWrite = 3 // 多用户模式
RWModeMax = 4 // Max 边界值
}
struct OrderBy {
1: string field
2: SortDirection direction
}
enum SortDirection {
ASC = 1
Desc = 2
}
struct Criterion{
1: list<Condition> conditions
2: string logic_expression
}
struct ListDatabaseRequest {
1: optional i64 creator_id (api.js_conv="str") // 获取创建者为某个用户的的数据库
2: optional i64 project_id (api.js_conv="str") // 获取project下的数据库
3: optional i64 space_id (api.js_conv="str") //获取空间下的可见数据库
4: optional i64 bot_id (api.js_conv="str") //对bot_id进行过滤过滤掉已经添加到bot中的database
5: optional string table_name // 表格名称,模糊搜索
6: required TableType table_type // 查草稿态database
7: optional list<OrderBy> order_by // 排序
8: optional i32 offset
9: optional i32 limit
10: optional Criterion filter_criterion //筛选条件
11: optional list<OrderBy> order_by_list //排序条件
255: optional base.Base Base
}
struct DatabaseInfo {
1: i64 id (api.js_conv="str", api.key="id") // online_database_info的主键id
2: i64 space_id (api.js_conv="str") // 空间的id
3: i64 project_id (api.js_conv="str") // project id
4: string datamodel_table_id // datamodel侧的表id
5: string icon_url // 头像url
6: string icon_uri // 头像url
7: string table_name // 表名
8: string table_desc // 表描述
9: BotTableStatus status // 状态
10: i64 creator_id (api.js_conv="str") // 创建者id
11: i64 create_time // 创建时间
12: i64 update_time // 更新时间
13: list<FieldItem> field_list // 字段信息
14: string actual_table_name // 数据表实际名称
15: BotTableRWMode rw_mode // 读写模式
16: bool prompt_disabled // 是否支持prompt调用
17: bool is_visible // 是否可见
18: optional i64 draft_id (api.js_conv="str") // 对应草稿态的id
19: optional i64 bot_id (api.js_conv="str", api.key="bot_id") // 相关id. bot_id老的有新的没有
20: optional map<string,string> extra_info // 扩展信息
21: optional bool is_added_to_bot // 是否已经添加到bot中
}
struct ListDatabaseResponse{
1: list<DatabaseInfo> database_info_list
2: bool has_more
3: i64 total_count
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct SingleDatabaseRequest{
1: i64 id (api.js_conv="str", api.key="id") // database_info的主键id
2: bool is_draft (api.key="is_draft") //传入的是否是草稿态数据默认是false
3: bool need_sys_fields (api.key="need_sys_fields") //是否需要系统字段
4: i64 version (api.js_conv="str") // 版本号,不传默认是最新的
255: optional base.Base Base
}
struct SingleDatabaseResponse{
1: DatabaseInfo database_info
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct AddDatabaseRequest{
1: i64 creator_id (api.js_conv="str") // 创建者id
2: i64 space_id (api.js_conv="str") // 空间的id
3: i64 project_id (api.js_conv="str") // project id
4: string icon_uri // 头像url
5: string table_name // 表名
6: string table_desc // 表描述
7: list<FieldItem> field_list // 字段信息
8: BotTableRWMode rw_mode // 读写模式,单用户模式/多用户模式
9: bool prompt_disabled // 是否支持prompt调用
10: optional map<string,string> extra_info // 扩展信息
255: optional base.Base Base
}
struct UpdateDatabaseRequest{
1: i64 id (api.js_conv="str", api.key="id") // database_info的主键id
2: string icon_uri // 头像url
3: string table_name // 表名
5: string table_desc // 表描述
6: list<FieldItem> field_list // 字段信息
7: BotTableRWMode rw_mode // 读写模式,单用户模式/多用户模式
8: bool prompt_disabled // 是否支持prompt调用
9: optional map<string,string> extra_info // 扩展信息
255: optional base.Base Base
}
struct DeleteDatabaseRequest{
1: i64 id (api.js_conv="str", api.key="id") // database_info的主键id
255: optional base.Base Base
}
struct DeleteDatabaseResponse {
1: required i64 code
2: required string msg
255: optional base.BaseResp BaseResp
}
struct BindDatabaseToBotRequest{
1: i64 database_id (api.js_conv="str") // 草稿态数据database表主键id注意是草稿态哈
2: i64 bot_id (api.js_conv="str") // bot_id
255: optional base.Base Base
}
struct BindDatabaseToBotResponse{
1: required i64 code
2: required string msg
255: optional base.BaseResp BaseResp
}
struct ListDatabaseRecordsRequest{
1: required i64 database_id (api.js_conv="str") // database_id
2: optional i64 bot_id (api.js_conv="str", api.key="bot_id") // bot id这里是查找bot关联的草稿态数据的时候填这个
3: optional i64 workflow_id (api.js_conv="str", api.key="workflow_id") // workflow_id这里是查找wk_flow关联的草稿态表的时候填这个
4: optional bool not_filter_by_user_id // 为true不根据user_id进行过滤Records
5: optional bool not_filter_by_connector_id // 为true不根据ConnectorID进行过滤Records
6: TableType table_type // 要查的是草稿态还是线上态
7: i64 limit // 别超过100建议50
8: i64 offset // 偏移量
9: optional i64 project_id (api.js_conv="str") // 同个project下数据不隔离
10: optional ComplexCondition filter_criterion //筛选条件
11: optional list<OrderBy> order_by_list //排序条件
255: optional base.Base Base
}
struct ListDatabaseRecordsRequestRPC{
1: required i64 database_id (api.js_conv="str") // database_id
2: TableType table_type // 要查的是草稿态还是线上态
3: i64 limit // 别超过100建议50
4: i64 offset // 偏移量
5: string user_id // 用户id
255: optional base.Base Base
}
struct ListDatabaseRecordsResponseRPC{
1: required list<map<string,string>> data
2: required bool HasMore=false
3: required i32 TotalNum
4: list<FieldItem> field_list // 字段信息
255: required base.BaseResp BaseResp
}
struct ListDatabaseRecordsResponse{
1: required list<map<string,string>> data
2: required bool HasMore=false
3: required i32 TotalNum
4: optional list<FieldItem> field_list // 字段信息
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct UpdateDatabaseRecordsRequest{
1: required i64 database_id (api.js_conv="str") // database_id
2: optional list<map<string,string>> record_data_add // 新增的
3: optional list<map<string,string>> record_data_alter // 修改的
4: optional list<map<string,string>> record_data_delete // 删除的
5: optional TableType table_type // 要更新的的是草稿态还是线上态
6: optional string ori_connector_id // 更新时需穿入connector id
255: optional base.Base Base
}
struct UpdateDatabaseRecordsResponse{
1: required list<map<string,string>> data
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct GetOnlineDatabaseIdRequest{
1: required i64 id (api.js_conv="str") // draft 的database_id
255: optional base.Base Base
}
struct GetOnlineDatabaseIdResponse{
1: optional i64 id (api.js_conv="str") // 根据草稿的id查询线上的id
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct BotTable {
1: i64 id (api.js_conv="str", api.key="id") // 自增idtable id
2: i64 bot_id (api.js_conv="str", api.key="bot_id") // 相关id. bot_id
3: string table_id // table_id
4: string table_name // 表名
5: string table_desc // 表描述
6: BotTableStatus status // 状态
7: i64 creator_id // 创建着id
8: i64 create_time // 创建时间
9: i64 update_time // 更新时间
10: list<FieldItem> field_list // 字段信息
11: string actual_table_name // 数据表实际名称
12: BotTableRWMode rw_mode // 读写模式
13: optional map<string,string> extra_info // 扩展信息
}
struct InsertBotTableRequest {
1: BotTable bot_table // 保存表信息
255: optional base.Base Base
}
struct InsertBotTableResponse {
1: i64 table_id(api.js_conv="str", api.key="table_id") // table id
255: required base.BaseResp BaseResp
}
struct AlterBotTableRequest {
1: BotTable bot_table // 修改表信息
255: optional base.Base Base
}
struct AlterBotTableResponse {
1: i64 table_id(api.js_conv="str", api.key="table_id") // table id
255: required base.BaseResp BaseResp
}
struct DeleteBotTableRequest {
1: required i64 related_id(api.js_conv="str", api.key="related_id")
2: required i64 table_id(api.js_conv="str", api.key="table_id")
3: optional i64 user_id
255: optional base.Base Base
}
struct DeleteBotTableResponse {
1: i64 table_id(api.js_conv="str", api.key="table_id") // table id
255: required base.BaseResp BaseResp
}
struct GetBotTableRequest {
1: optional i64 creator_id
2: optional i64 bot_id(api.js_conv="str", api.key="bot_id")
3: optional list<i64> table_ids(api.js_conv="str", api.key="table_ids")
4: required TableType table_type
255: optional base.Base Base
}
struct GetBotTableResponse {
1: list<BotTable> BotTableList
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct CopyDatabaseRequest {
1: required string IdempotentId //ID生成器生成
2: required list<i64> TableIds //原来的tableId
3: required i64 ToSpaceId
4: required i64 ToUserId
5: required i64 ToBotId
6: required TableType table_type
255: optional base.Base Base
}
struct CopyDatabaseResponse {
1: required map<i64, i64> TableIdsMapping
255: required base.BaseResp BaseResp
}
struct CopyDatabaseRollbackRequest {
1: required string IdempotentId // ID生成器生成
2: required map<i64, i64> TableIdsMapping // CopyDatabaseResponse返回的参数
255: optional base.Base Base
}
struct CopyDatabaseRollbackResponce {
1: required bool Result
255: required base.BaseResp BaseResp
}
struct GetNL2SQLRequest {
1: required string text // 数据库请求的自然语言描述
2: required i64 bot_id // bot id
3: optional i64 connector_id // 业务线id
4: optional string connector_uid // 业务线用户id
5: required TableType table_type // table类型分 draft 和 online 两种
6: optional i64 database_id (api.js_conv="str") // 数据库id
255: optional base.Base Base
}
struct GetNL2SQLResponse {
1: i32 code
2: string msg
3: required string sql
4: optional map<string,string> extraMap
255: optional base.BaseResp BaseResp
}
struct GetModeConfigRequest {
1: required i64 bot_id // bot id
2: optional i64 connector_id // 业务线id
3: optional string connector_uid // 业务线用户id
255: optional base.Base Base
}
struct GetModeConfigResponse {
1: i32 code
2: string msg
3: string mode
4: i64 bot_id
5: i64 max_table_num
6: i64 max_column_num
7: i64 max_capacity_kb
8: i64 max_row_num
255: optional base.BaseResp BaseResp
}
struct ResetBotTableRequest {
1: optional i64 creator_id (api.js_conv="str", api.key="creator_id")
2: optional i64 bot_id (api.js_conv="str", api.key="bot_id")
3: optional i64 table_id (api.js_conv="str", api.key="table_id")
4: required TableType table_type
5: optional i64 connector_id // 业务线id
6: optional string connector_uid // 业务线用户id
7: optional i64 workflow_id (api.js_conv="str") // 工作流id
8: optional i64 database_info_id (api.js_conv="str") // 用户id
9: optional i64 project_id (api.js_conv="str") // 项目id
255: optional base.Base Base
}
struct ResetBotTableResponse {
253: optional i64 code
254: optional string msg
255: required base.BaseResp BaseResp(api.none="true")
}
/******** bot_table end ********/
/******** Bytedoc bot_table_info start ********/
struct BatchInsertBotTableInfoRequest {
1: string db_name // 数据库名称
2: string collection_name // 集合名
3: list<map<string,string>> data // 保存数据
4: i64 user_id // 用户id
5: i64 bot_id // bot id
255: optional base.Base Base
}
struct BatchInsertBotTableInfoResponse {
255: required base.BaseResp BaseResp
}
struct UpdateBotTableInfoRequest {
1: string db_name // 数据库名称
2: string collection_name // 集合名
3: list<map<string,string>> data_list // 更新数据
4: i64 user_id // 用户id
5: i64 bot_id // bot id
255: optional base.Base Base
}
struct UpdateBotTableInfoResponse {
255: required base.BaseResp BaseResp
}
struct DeleteBotTableInfoRequest {
1: string db_name // 数据库名称
2: string collection_name // 集合名
3: list<string> ids // 删除id 列表
4: i64 user_id // 用户id
5: i64 bot_id // bot id
255: optional base.Base Base
}
struct DeleteBotTableInfoResponse {
255: required base.BaseResp BaseResp
}
struct SearchBotTableInfoRequest {
1: string key_word // 搜素词,目前忽略
2: i64 limit
3: i64 offset
4: string connector_uid // 用户id
5: i64 connector_id
6: i64 bot_id(api.js_conv="str", api.key="bot_id") // bot id
7: string table_name // 目前忽略
8: i64 table_id(api.js_conv="str", api.key="table_id")
9: optional RefInfo ref_info // 引用信息
255: optional base.Base Base
}
struct SearchBotTableInfoResponse {
1: required list<map<string,string>> data
2: required bool HasMore=false
3: required i32 TotalNum
255: required base.BaseResp BaseResp
}
enum TableType {
DraftTable = 1 // 草稿
OnlineTable = 2 // 线上
}
struct ExecuteSqlRequest {
1: string sql // RunCommand 能执行的sql
2: i64 bot_id // bot id
3: i64 connector_id // 业务线id
4: string connector_uid // 业务线用户id
5: TableType table_type // table类型
6: string wftest_id // workflow test run 标识
7: optional RefInfo ref_info // 引用信息
8: optional list<SqlParamVal> SqlParams (api.key="sql_params") // SQL params
9: i64 database_info_id // database info 的id
10: i64 workflow_id // workflow id
11: i64 project_id // 项目id
255: optional base.Base Base
}
struct SqlParamVal {
1: required FieldItemType ValueType (go.tag="json:\"value_type\"")
2: required bool ISNull (go.tag="json:\"is_null\"")
3: optional string Value (go.tag="json:\"value\"")
4: optional string Name (go.tag="json:\"name\"")
}
struct ExecuteSqlResponse {
1: required list<map<string,string>> data
255: required base.BaseResp BaseResp
}
struct BotTablePublishReq {
1: required i64 bot_id
2: optional i64 connector_id // 业务线id
3: optional string connector_uid // 业务线用户id
255: optional base.Base Base
}
struct BotTablePublishResp {
1: i64 status // 执行状态: 0-执行成功 1-执行全部失败 2-执行部分失败
2: string msg // 错误信息
255: optional base.BaseResp BaseResp
}
struct NL2SQLRequest {
1: required string text // 数据库请求的自然语言描述
2: required i64 bot_id // bot id
3: optional i64 connector_id // 业务线id
4: optional string connector_uid // 业务线用户id
5: required TableType table_type // table类型分 draft 和 online 两种
255: optional base.Base Base
}
struct NL2SQLResponse {
1: required string sql
2: optional map<string,string> extraMap
255: optional base.BaseResp BaseResp
}
struct QueryTableByNLRequest {
1: required string text // 数据库请求的自然语言描述
2: required i64 bot_id // bot id
3: required i64 connector_id // 业务线id
4: required string connector_uid // 业务线用户id
5: required TableType table_type // table类型分 draft 和 online 两种
6: optional string x_aiplugin_tako_bot_history // chat history 透传到 nl2query 服务,由 nl2query 进行解析
7: optional string x_aiplugin_bot_system_message // bot_system_message 透传到 nl2query 服务,由 nl2query 进行解析
255: optional base.Base Base
}
struct QueryTableByNLResponse {
1: required list<map<string,string>> data
255: required base.BaseResp BaseResp
}
enum SceneType {
BotPersona = 1 // bot 个性描述
ModelDesc = 2 // 开发者给的模型文本描述
}
struct RecommendDataModelRequest {
1: required i64 bot_id (api.js_conv="str", api.key="bot_id")
2: required SceneType scene_type (api.key="scene_type")
3: optional string text (api.key="text")
255: optional base.Base Base
}
struct RecommendDataModelResponse {
1: list<BotTable> BotTableList (api.key="bot_table_list")
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
/******** Bytedoc bot_table_info end ********/
struct BatchAlterTableRequest {
1: string params
255: optional base.Base Base
}
struct BatchAlterTableResponse {
1: string res
255: required base.BaseResp BaseResp
}
struct MigrateDatabaseRequest{
1: i64 bot_id
2: i64 to_space_id
255: optional base.Base Base
}
struct MigrateDatabaseResponse{
1: required i64 code
2: required string msg
255: required base.BaseResp BaseResp
}
struct MigrateOldDataRequest{
1: TableType bot_type // 迁移哪个表
2: i64 bot_id (api.js_conv="str") // 迁移哪个bot
3: list<i64> table_ids (api.js_conv="str") // 失败重试
255: optional base.Base Base
}
struct MigrateOldDataResponse{
1: required i64 code
2: required string msg
255: required base.BaseResp BaseResp
}
struct MGetDisplayResourceInfoRequest {
1 : list<i64> ResIDs, // 最大传一页的数量实现方可以限制最大100个
2 : i64 CurrentUserID, // 当前的用户,实现方用于判断权限
255: base.Base Base ,
}
struct MGetDisplayResourceInfoResponse {
1 : list<DisplayResourceInfo> ResourceList,
255: required base.BaseResp BaseResp,
}
enum ActionKey{
Copy = 1, //复制
Delete = 2, //删除
EnableSwitch = 3, //启用/禁用
Edit = 4, //编辑
CrossSpaceCopy = 10, // 跨空间复制
}
enum PublishStatus{
UnPublished = 1, //未发布
Published = 2, //已发布
}
// Library资源操作
struct ResourceAction{
// 一个操作对应一个唯一的keykey由资源侧约束
1 : required ActionKey Key (go.tag = "json:\"key\"", api.key = "key"),
//ture=可以操作该Actionfalse=置灰
2 : required bool Enable (go.tag = "json:\"enable\"", api.key = "enable"),
}
// 展示用,实现方提供展示信息
struct DisplayResourceInfo{
1 : optional i64 ResID, // 资源id
5 : optional string Desc,// 资源描述
6 : optional string Icon,// 资源Icon完整url
12 : optional i32 BizResStatus, // 资源状态,各类型资源自身定义
13 : optional bool CollaborationEnable, // 是否开启多人编辑
16 : optional map<string, string> BizExtend, // 业务携带的扩展信息以res_type区分每个res_type定义的schema和含义不一样使用前需要判断res_type
17 : optional list<ResourceAction> Actions, // 不同类型的不同操作按钮,由资源实现方和前端约定。返回则展示,要隐藏某个按钮,则不要返回;
18 : optional bool DetailDisable, // 是否禁止进详情页
19 : optional string Name // 资源名称
20 : optional PublishStatus PublishStatus, // 资源发布状态1-未发布2-已发布
21 : optional i64 EditTime, // 最近编辑时间, unix秒级时间戳
}
enum OperateType {
Insert = 1
Update = 2
Delete = 3
Select = 4
}
struct SelectFieldList{
1: required list<string> FieldID
2: required bool isDistinct
}
enum Operation {
EQUAL = 1, // "="
NOT_EQUAL = 2, // "<>" 或 "!="
GREATER_THAN = 3, // ">"
LESS_THAN = 4, // "<"
GREATER_EQUAL = 5, // ">="
LESS_EQUAL = 6, // "<="
IN = 7, // "IN"
NOT_IN = 8, // "NOT IN"
IS_NULL = 9, // "IS NULL"
IS_NOT_NULL = 10 // "IS NOT NULL"
LIKE = 11, // "LIKE" 模糊匹配字符串
NOT_LIKE = 12, // "NOT LIKE" 反向模糊匹配
}
struct Condition {
1: required string left; // 左值填字段名
2: required Operation operation;
3: required string right; // 右值
}
struct ComplexCondition {
1: optional list<Condition> conditions;
2: optional ComplexCondition nestedConditions; // 为了拓展,先不用
3: required string logic; // "AND" 或 "OR"
}
struct UpsertValues {
1: string field_id
2: string field_value
}
struct Row {
1: list<UpsertValues> values
}
struct CRUDDatabaseRequest {
1: required i64 database_info_id // database的id
2: i64 workflow_id // workflow idwk flow纬度数据隔离
3: i64 project_id // 项目id同project下不隔离
4: i64 bot_id // bot id
5: i64 connector_id // 业务线id
6: string connector_uid // 业务线用户id
7: required TableType table_type // table类型
8: string wftest_id // workflow test run 标识
9: optional RefInfo ref_info // 引用信息
10: optional list<SqlParamVal> sql_params (api.key="sql_params") // SQL params
11: required OperateType operate_type // 操作类型
12: optional SelectFieldList field_list // select时要查询的字段列表
13: optional list<OrderBy> order_by_list // order by 字段列表
14: optional i64 limit // limit
15: optional i64 offset // offset
16: optional ComplexCondition condition // 查询条件
17: optional list<Row> rows // 需要upsert的数据
}
struct SourceInfo {
// 本地文件上传的 tos 地址
1: optional string tos_uri (api.key="tos_uri");
// imagex_uri, 和 tos_uri 二选一, imagex_uri 优先,需要通过 imagex 的方法获取数据和签发 url
2: optional string imagex_uri
}
struct ValidateTableSchemaRequest {
1: i64 space_id (api.js_conv="str", api.key="space_id")
2: i64 database_id (api.js_conv="str", api.key="database_id")
3: SourceInfo source_info (api.key="source_file", api.body="source_file") // source file 的信息
4: TableSheet table_sheet (api.key="table_sheet")
5: TableType table_type (api.key="table_type")
255: optional base.Base Base
}
struct TableSheet {
1: i64 sheet_id (api.js_conv="str", api.key="sheet_id") , // 用户选择的 sheet id
2: i64 header_line_idx (api.js_conv="str", api.key="header_line_idx"), // 用户选择的表头行数,从 0 开始编号
3: i64 start_line_idx (api.js_conv="str", api.key="start_line_idx") , // 用户选择的起始行号,从 0 开始编号
}
struct ValidateTableSchemaResponse {
1: optional map<string,string> SchemaValidResult (api.key="schema_valid_result");
// 如果失败会返回错误码
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp(api.none="true")
}
struct GetTableSchemaRequest {
1: optional TableSheet table_sheet; // 表格解析信息, 默认初始值0,0,1
2: optional TableDataType table_data_type; // 不传默认返回所有数据
3: optional i64 database_id(api.js_conv="str", api.key="database_id"); // 兼容重构前的版本:如果需要拉取的是当前 document 的 schema 时传递该值
4: optional SourceInfo source_file; // source file 的信息,新增 segment / 之前逻辑迁移到这里
255: optional base.Base Base
}
enum TableDataType {
AllData = 0 // schema sheets 和 preview data
OnlySchema = 1 // 只需要 schema 结构 & Sheets
OnlyPreview = 2 // 只需要 preview data
}
struct DocTableSheet {
1: i64 id; // sheet 的编号
2: string sheet_name; // sheet 名
3: i64 total_row; // 总行数
}
struct TableColumn {
1: i64 id(api.js_conv="str", api.key="id") // 列 id
2: string column_name // 列名
3: i64 sequence(api.js_conv="str", api.key="sequence")// 列原本在 excel 的序号
4: optional ColumnType column_type // 列类型
5: optional bool contains_empty_value
6: optional string desc // 描述
}
enum ColumnType {
Unknown = 0
Text = 1 // 文本
Number = 2 // 数字
Date = 3 // 时间
Float = 4 // float
Boolean = 5 // bool
Image = 6 // 图片
}
struct GetDatabaseFileProgressRequest {
1: i64 database_id (api.js_conv="str")
2: required TableType table_type // table类型
255: optional base.Base Base
}
struct GetDatabaseFileProgressResponse {
1: DatabaseFileProgressData data
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct DatabaseFileProgressData {
1: string file_name
2: i32 progress
3: optional string status_descript //描述信息,如果有代表文件处理失败
}
struct SubmitDatabaseInsertRequest {
1: i64 database_id (api.js_conv="str")
2: string file_uri
3: TableType table_type // table类型要往草稿表插入还是线上表插入
4: optional TableSheet table_sheet
5: optional i64 connector_id (api.js_conv="str") // 要写入的渠道id
255: optional base.Base Base
}
struct SubmitDatabaseInsertResponse {
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct SubmitBatchInsertTaskRequest {
1: string msg
255: optional base.Base Base
}
struct SubmitBatchInsertTaskResponse {
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct GetSpaceConnectorListRequest {
1: required i64 SpaceId (api.js_conv="str")
2: optional string Version // release inhouse
3: optional i64 ConnectorID
4: optional bool ListAll
255: optional base.Base Base
}
struct GetSpaceConnectorListResponse {
1: list<ConnectorInfo> ConnectorList
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct ConnectorInfo{
1: i64 ConnectorID
2: string ConnectorName
}
typedef GetDatabaseFileProgressRequest GetDatabaseTemplateRequest
struct GetDatabaseTemplateResponse {
1: string TosUrl // 下载地址
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}
struct UpdateDatabaseBotSwitchRequest{
1: required i64 bot_id (api.js_conv="str")
2: required i64 database_id (api.js_conv="str")
3: required bool prompt_disable // 是否禁用prompt
255: optional base.Base Base
}
struct UpdateDatabaseBotSwitchResponse{
253: required i64 code
254: required string msg
255: optional base.BaseResp BaseResp
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
namespace go flow.devops.debugger.domain.infra
// ComponentType 支持组件类型
enum ComponentType {
Undefined = 0
CozePlugin = 10000 // Coze Plugin
CozeTool = 10001 // Coze Tool
CozeWorkflow = 10002 // Coze Workflow
CozeSubWorkflow = 10003 // Coze SubWorkflow即在Workflow中被引用的子Workflow
CozeLLMNode = 10004 // Coze workflow中的LLM节点
CozeCodeNode = 10005 // Coze workflow中的Code节点
CozeKnowledgeNode = 10006 // Coze workflow中的Knowledge节点
CozeToolNode = 10007 // Coze workflow中的Tool节点
CozeStartNode = 10008 // Coze workflow中的start节点
CozeVariableNode = 10009 // Coze workflow中的variable节点
CozeVariableBot = 20000 // Coze 虚拟节点用于标识 variable 依赖的bot
CozeVariableChat = 20001 // Coze 虚拟节点用于标识 variable 依赖的chat
}
// TrafficScene 流量请求场景
enum TrafficScene {
Undefined = 0
CozeSingleAgentDebug = 10000 // 单Agent调试页
CozeMultiAgentDebug = 10001 // 多Agent调试页
CozeToolDebug = 10002 // Tool调试页
CozeWorkflowDebug = 10003 // Workflow调试页
}
// ComponentMappingType 组件映射类型
enum ComponentMappingType {
Undefined = 0
MockSet = 1
}
// BizCtx 业务上下文
struct BizCtx {
1: optional string connectorID // connectorID
2: optional string connectorUID // connector下用户ID
3: optional TrafficScene trafficScene // 业务场景
4: optional string trafficCallerID // 业务场景组件ID比如Bot调试页则trafficSceneID为BotID
5: optional string bizSpaceID // 业务线SpaceID用于访问控制
6: optional map<string,string> ext // 额外信息
}
// ComponentSubject 业务组件的二级结构
struct ComponentSubject {
1: optional string componentID // 组件ID例如Tool ID、Node ID等
2: optional ComponentType componentType // 组件类型
3: optional string parentComponentID // 父组件ID例如Tool->Plugin, Node->Workflow
4: optional ComponentType parentComponentType // 父组件类型
}
enum OrderBy {
UpdateTime = 1
}
struct Creator {
1: optional string ID
2: optional string name
3: optional string avatarUrl
}
enum DebugScene {
Debug = 0 // 默认play ground Debug场景
}
enum CozeChannel {
Coze = 0 // 默认为Coze, 未来扩展到其他渠道
}

View File

@@ -0,0 +1,21 @@
namespace go flow.devops.debugger.domain.testcase
include "infra.thrift"
struct CaseDataBase {
1: optional i64 caseID (go.tag="json:\"caseID,string\"")// 新增时不填,更新时填写
2: optional string name
3: optional string description
4: optional string input // json格式的输入信息
5: optional bool isDefault
}
struct CaseDataDetail{
1: optional CaseDataBase caseBase
2: optional string creatorID
3: optional i64 createTimeInSec
4: optional i64 updateTimeInSec
5: optional bool schemaIncompatible // schema不兼容
6: optional infra.Creator updater,
}

View File

@@ -0,0 +1,70 @@
namespace go flow.devops.debugger.coze
include "../../../base.thrift"
include "./domain/infra.thrift"
include "./domain/testcase.thrift"
// ========== TestCase =========== //
struct SaveCaseDataReq {
1: optional infra.BizCtx bizCtx // 业务信息
2: optional infra.ComponentSubject bizComponentSubject
3: optional testcase.CaseDataBase caseBase // case基本数据
255: optional base.Base Base
}
struct SaveCaseDataResp {
1: optional testcase.CaseDataDetail caseDetail
253: optional i32 code
254: optional string msg
255: optional base.BaseResp BaseResp
}
struct DeleteCaseDataReq {
1: optional infra.BizCtx bizCtx // 业务信息
2: optional list<i64> caseIDs // 单次上限20个
255: optional base.Base Base
}
struct DeleteCaseDataResp {
1: optional list<i64> deletedCaseIDS
253: optional i32 code
254: optional string msg
255: optional base.BaseResp BaseResp
}
struct CheckCaseDuplicateReq {
1: optional infra.BizCtx bizCtx
2: optional string caseName // case名称
3: optional infra.ComponentSubject bizComponentSubject
255: optional base.Base Base
}
struct CheckCaseDuplicateResp {
1: optional bool isPass
2: optional string failReason // 当pass=false时给出具体的校验不通过的原因
3: optional i32 failCode
253: optional i32 code
254: optional string msg
255: optional base.BaseResp BaseResp
}
struct GetSchemaByIDReq {
1: optional infra.BizCtx bizCtx // 业务信息
2: optional infra.ComponentSubject bizComponentSubject
255: optional base.Base Base
}
struct GetSchemaByIDResp {
1: optional string schemaJson // Json格式的组件input信息与Input Json Schema保持一致不包含Value值信息
253: optional i32 code
254: optional string msg
255: optional base.BaseResp BaseResp
}

View File

@@ -0,0 +1,181 @@
include "../marketplace_common.thrift"
namespace go flow.marketplace.product_common
enum ProductEntityType {
Bot = 1 ,
Plugin = 2 ,
// Workflow = 3 ,
SocialScene = 4,
Project = 6,
WorkflowTemplate = 13, // 历史工作流,后续不会再有(废弃)
ImageflowTemplate = 15, // 历史图像流模板,后续不会再有(废弃)
TemplateCommon = 20, // 模板通用标识,仅用于绑定模板相关的配置,不绑定商品
BotTemplate = 21, // Bot 模板
WorkflowTemplateV2 = 23, // 工作流模板
ImageflowTemplateV2 = 25, // 图像流模板(该类型已下线,合并入 workflow但历史数据会保留前端视作 workflow 展示)
ProjectTemplate = 26, // 项目模板
CozeToken = 50, // coze token 类商品,理论上只会有一个
MsgCredit = 55, // 订阅 credit 的流量包,理论上只会有一个
SubsMsgCredit = 60, // 消息订阅类商品,理论上只有一个
Common = 99,
Topic = 101 // 专题(兼容之前的设计)
}
enum SortType {
Heat = 1,
Newest = 2,
FavoriteTime = 3, // 收藏时间
Relative = 4, // 相关性,只用于搜索场景
}
enum ProductPublishMode {
OpenSource = 1,
ClosedSource = 2,
}
enum ProductListSource {
Recommend = 1, // 推荐列表页
CustomizedRecommend = 2, // 个性化推荐
}
enum PluginType {
CLoudPlugin = 0 , // default
LocalPlugin = 1 ,
}
enum ProductPaidType {
Free = 0;
Paid = 1;
}
struct CommercialSetting {
1: required ProductPaidType commercial_type (agw.key = "commercial_type", api.body= "commercial_type")
}
enum ProductStatus {
NeverListed = 0, // 从未上架
Listed = 1,
Unlisted = 2,
Banned = 3,
}
struct UserLabel {
1: string label_id (agw.key = "label_id", api.body= "label_id") ,
2: string label_name (agw.key = "label_name", api.body= "label_name"),
3: string icon_uri (agw.key = "icon_uri", api.body= "icon_uri") ,
4: string icon_url (agw.key = "icon_url", api.body= "icon_url") ,
5: string jump_link (agw.key = "jump_link", api.body= "jump_link") ,
}
struct UserInfo {
1: i64 user_id (agw.js_conv="str",api.js_conv="true",agw.cli_conv="str", agw.key = "user_id", api.body= "user_id"),
2: string user_name (agw.key = "user_name", api.body= "user_name") ,
3: string name (agw.key = "name", api.body= "name") ,
4: string avatar_url (agw.key = "avatar_url", api.body= "avatar_url") ,
5: optional UserLabel user_label (agw.key = "user_label", api.body= "user_label") ,
6: optional marketplace_common.FollowType follow_type (agw.key = "follow_type", api.body= "follow_type") ,
}
struct ImageInfo {
1: string uri (agw.key = "uri", api.body= "uri"),
2: string url (agw.key = "url", api.body= "url"),
}
enum ProductDraftStatus {
Default = 0, // 默认
Pending = 1, // 审核中
Approved = 2, // 审核通过
Rejected = 3, // 审核不通过
Abandoned = 4, // 已废弃
}
typedef ProductDraftStatus AuditStatus
struct OpeningDialog { // Bot开场白
1: string content (agw.key = "content", api.body= "content"),
}
enum InputType {
String = 1,
Integer = 2,
Boolean = 3,
Double = 4,
List = 5,
Object = 6,
}
enum PluginParamTypeFormat {
ImageUrl = 1,
}
enum WorkflowNodeType {
Start = 1 , // 开始
End = 2 , // 结束
LLM = 3 , // 大模型
Api = 4 , // 插件
Code = 5 , // 代码
Dataset = 6 , // 知识库
If = 8 , // 选择器
SubWorkflow = 9 , // 工作流
Variable = 11, // 变量
Database = 12, // 数据库
Message = 13, // 消息
}
enum SocialSceneRoleType {
Host = 1
PresetBot = 2
Custom = 3
}
enum UIPreviewType { // UI 预览类型,定义对齐 UI Builder目前用于 Project
Web = 1, // 网页端
Client = 2, // 移动端
}
struct ChargeSKUExtra{
1: i64 Quantity (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "quantity", api.body= "quantity"),
2: bool IsSelfDefine (agw.key = "is_self_define", api.body= "is_self_define")
}
enum FavoriteListSource {
CreatedByMe = 1, // 用户自己创建的
}
struct FavoriteEntity {
1 : i64 EntityID (agw.js_conv="str", agw.cli_conv="str", agw.key = "entity_id", api.body="entity_id", api.js_conv="true") ,
2 : ProductEntityType EntityType (agw.key = "entity_type", api.body="entity_type") ,
4 : string Name (agw.key = "name", api.body="name") ,
5 : string IconURL (agw.key = "icon_url", api.body="icon_url") ,
6 : string Description (agw.key = "description", api.body="description") ,
7 : SellerInfo Seller (agw.key = "seller", api.body="seller") , // 废弃使用UserInfo
8 : i64 SpaceID (agw.js_conv="str", agw.cli_conv="str", agw.key = "space_id", api.body="space_id", api.js_conv="true") , // 用于跳转到Bot编辑页
9 : bool HasSpacePermission (agw.key = "has_space_permission", api.body="has_space_permission") , // 用户是否有该实体所在Space的权限
10: i64 FavoriteAt (agw.js_conv="str", agw.cli_conv="str", agw.key = "favorite_at", api.body="favorite_at", api.js_conv="true"), // 收藏时间
11: optional FavoriteProductExtra ProductExtra (agw.key = "product_extra", api.body="product_extra") ,
12: UserInfo UserInfo (agw.key = "user_info", api.body="user_info") ,
13: optional FavoritePluginExtra PluginExtra (agw.key = "plugin_extra", api.body="plugin_extra") ,
}
struct SellerInfo {
1: i64 UserID (agw.js_conv="str", agw.cli_conv="str", agw.key = "user_id", api.body="user_id", api.js_conv="true"),
2: string UserName (agw.key = "user_name", api.body="user_name") ,
3: string AvatarURL (agw.key = "avatar_url", agw.key="avatar_url", api.body="avatar_url") ,
}
struct FavoriteProductExtra {
1: i64 ProductID (agw.js_conv="str", agw.cli_conv="str", agw.key = "product_id", api.body="product_id", api.js_conv="true"),
2: ProductStatus ProductStatus (agw.key="product_status", api.body="product_status") ,
}
struct FavoritePluginExtra {
1: list<PluginTool> Tools (agw.key="tools", api.body="tools"),
}
struct PluginTool {
1: i64 ID (agw.js_conv="str", agw.cli_conv="str", agw.key = "id", api.body="id", api.js_conv="true"),
2: string Name (agw.key="name", api.body="name"),
3: string Description (agw.key="description", api.body="description"),
}

View File

@@ -0,0 +1,569 @@
include "../../../base.thrift"
include "product_common.thrift"
include "../marketplace_common.thrift"
namespace go flow.marketplace.product_public_api
service PublicProductService {
GetProductListResponse PublicGetProductList(1: GetProductListRequest req)(api.get = "/api/marketplace/product/list", api.category = "PublicAPI")
GetProductDetailResponse PublicGetProductDetail(1: GetProductDetailRequest req)(api.get ="/api/marketplace/product/detail", api.category = "PublicAPI")
FavoriteProductResponse PublicFavoriteProduct(1: FavoriteProductRequest req)(api.post = "/api/marketplace/product/favorite", api.category = "PublicAPI")
GetUserFavoriteListV2Response PublicGetUserFavoriteListV2(1: GetUserFavoriteListV2Request req)(api.get = "/api/marketplace/product/favorite/list.v2", api.category = "PublicAPI")
DuplicateProductResponse PublicDuplicateProduct (1: DuplicateProductRequest req) (api.post = "/api/marketplace/product/duplicate", api.category = "PublicAPI")
}
struct FavoriteProductResponse {
1 : required i32 Code (agw.key = "code", api.body = "code") ,
2 : required string Message (agw.key = "message", api.body = "message") ,
3 : optional bool IsFirstFavorite (agw.key = "is_first_favorite", api.body = "is_first_favorite"),
255: optional base.BaseResp BaseResp ,
}
struct FavoriteProductRequest {
1 : optional i64 ProductID (agw.js_conv="str", api.js_conv="true", api.body = "product_id"),
2 : required product_common.ProductEntityType EntityType (api.body = "entity_type") ,
3 : optional bool IsCancel (api.body = "is_cancel") ,
4 : optional i64 EntityID (agw.js_conv="str", api.js_conv="true", api.body = "entity_id") ,
5 : optional i64 TopicID (agw.js_conv="str", api.js_conv="true", api.body = "topic_id") ,
100: optional string Cookie (agw.source = "header", agw.key = "Cookie", go.tag="jsonlog:\"-\" json:\"-\"" ),
255: optional base.Base Base ,
}
struct GetProductListRequest {
1 : optional product_common.ProductEntityType EntityType (api.body = "entity_type") ,
2 : optional i64 CategoryID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.query = "category_id", agw.key="category_id") ,
3 : required product_common.SortType SortType (api.body = "sort_type") ,
4 : required i32 PageNum (api.body = "page_num") ,
5 : required i32 PageSize (api.body = "page_size") ,
6 : optional string Keyword (api.body = "keyword") , // 不为空则搜索
7 : optional product_common.ProductPublishMode PublishMode (api.body = "publish_mode") , // 公开方式1-开源2-闭源 , // 公开方式
8 : optional list<i64> PublishPlatformIDs (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.source = "query", agw.key = "publish_platform_ids"), // 发布渠道
9 : optional product_common.ProductListSource Source (agw.key = "source", api.body= "source") , // 列表页 tab; 1-运营推荐
// 个性化推荐场景, 传入当前的实体信息, 获取推荐的商品
10: optional product_common.ProductEntityType CurrentEntityType (api.body = "current_entity_type") , // 当前实体类型
11: optional i64 CurrentEntityID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.query = "current_entity_id", agw.key="current_entity_id") , // 当前实体 ID
12: optional i64 CurrentEntityVersion (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.query = "current_entity_version", agw.key="current_entity_version") , // 当前实体版本
// 专题场景
13 : optional i64 TopicID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.query = "topic_id", agw.key="topic_id") ,
14 : optional string PreviewTopicID (agw.key = "preview_topic_id", api.body= "preview_topic_id") ,
15 : optional bool IsOfficial (api.body = "is_official") , // 是否需要过滤出官方商品
16 : optional bool NeedExtra (api.body = "need_extra") , // 是否需要返回额外信息
17 : optional list<product_common.ProductEntityType> EntityTypes (api.body = "entity_types"), // 商品类型列表, 优先使用该参数,其次使用 EntityType
18 : optional bool IsFree (api.body = "is_free"), // true = 筛选免费的false = 筛选付费的;不传则不区分免费和付费
19 : optional product_common.PluginType PluginType (api.body = "plugin_type") , // 插件类型
101: optional string ClientIP (api.header="Tt-Agw-Client-Ip") ,
255: optional base.Base Base ,
}
struct GetProductListResponse {
1 : required i32 Code (agw.key = "code", api.body= "code") ,
2 : required string Message (agw.key = "message", api.body= "message"),
3 : GetProductListData Data (agw.key = "data", api.body= "data") ,
255: optional base.BaseResp BaseResp ,
}
struct GetProductListData{
1: optional list<ProductInfo> Products (agw.key = "products", api.body= "products"),
2: bool HasMore (agw.key = "has_more", api.body= "has_more"),
3: i32 Total (agw.key = "total", api.body= "total") ,
}
struct ProductInfo {
1 : required ProductMetaInfo MetaInfo (agw.key = "meta_info", api.body= "meta_info") ,
2 : optional UserBehaviorInfo UserBehavior (agw.key = "user_behavior", api.body= "user_behavior"),
3 : optional product_common.CommercialSetting CommercialSetting (agw.key = "commercial_setting", api.body= "commercial_setting"),
20: optional PluginExtraInfo PluginExtra (agw.key = "plugin_extra", api.body= "plugin_extra"),
21: optional BotExtraInfo BotExtra (agw.key = "bot_extra", api.body= "bot_extra") ,
22: optional WorkflowExtraInfo WorkflowExtra (agw.key = "workflow_extra", api.body= "workflow_extra"),
23: optional SocialSceneExtraInfo SocialSceneExtra (agw.key = "social_scene_extra", api.body= "social_scene_extra"),
24: optional ProjectExtraInfo ProjectExtra (agw.key = "project_extra", api.body= "project_extra"),
}
struct SellerInfo {
1: i64 ID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "id", api.body= "id"),
2: string Name (agw.key = "name", api.body= "name") ,
3: string AvatarURL (agw.key = "avatar_url", api.body= "avatar_url") ,
}
struct ProductCategory {
1: i64 ID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "id", api.body= "id"),
2: string Name (agw.key = "name", api.body= "name") ,
3: string IconURL (agw.key = "icon_url", api.body= "icon_url") ,
4: string ActiveIconURL (agw.key = "active_icon_url", api.body= "active_icon_url") ,
5: i32 Index (agw.key = "index", api.body= "index") ,
6: i32 Count (agw.key = "count", api.body= "count") ,
}
struct ProductLabel{
1: string Name (agw.key = "name", api.body= "name"),
}
struct ProductMetaInfo {
1 : i64 ID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "id", api.body= "id") ,
2 : string Name (agw.key = "name", api.body= "name") , // 商品/模板名称
3 : i64 EntityID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "entity_id", api.body= "entity_id") , // 素材 ID由 entity_type 来决定是 bot/plugin 的ID
4 : product_common.ProductEntityType EntityType (agw.key = "entity_type", api.body= "entity_type") , // 商品素材类型
5 : string IconURL (agw.key = "icon_url", agw.key="icon_url", api.body= "icon_url") , // 商品/模板头像
6 : i32 Heat (agw.key = "heat", api.body= "heat") , // 热度:模板热度=复制量(用于卡片展示/排序);商品热度=不同商品有独立的计算逻辑(仅用于排序)—— heat的计算有一定延迟
7 : i32 FavoriteCount (agw.key = "favorite_count", api.body= "favorite_count") ,
8 : SellerInfo Seller (agw.key = "seller", api.body= "seller") , // 废弃,使用UserInfo代替
9 : string Description (agw.key = "description", api.body= "description") , // 商品描述
10: i64 ListedAt (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "listed_at", api.body= "listed_at") ,
11: product_common.ProductStatus Status (agw.key = "status", api.body= "status") ,
12: optional ProductCategory Category (agw.key = "category", api.body= "category") , // 商品/模板分类信息
13: bool IsFavorited (agw.key = "is_favorited", api.body= "is_favorited") , // 是否收藏
14: bool IsFree (agw.key = "is_free", api.body= "is_free") ,
15: string Readme (agw.key = "readme", api.body= "readme") , // 模板介绍/插件介绍(目前是富文本格式)
16: optional i64 EntityVersion (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "entity_version", api.body= "entity_version"),
17: optional list<ProductLabel> Labels (agw.key = "labels", api.body= "labels") ,
18: product_common.UserInfo UserInfo (agw.key = "user_info", api.body= "user_info") ,
19: string MediumIconURL (agw.key = "medium_icon_url", api.body= "medium_icon_url") ,
20: string OriginIconURL (agw.key = "origin_icon_url", api.body= "origin_icon_url") ,
21: optional list<product_common.ImageInfo> Covers (agw.key = "covers", api.body= "covers") , // 模板封面
22: optional bool IsProfessional (agw.key = "is_professional", api.body= "is_professional") , // 是否专业版特供
23: bool IsTemplate (agw.key = "is_template", api.body= "is_template") , // 是否为模板
24: bool IsOfficial (agw.key = "is_official", api.body= "is_official") , // 是否官方商品
25: optional marketplace_common.Price Price (agw.key = "price", api.body= "price") , // 价格,当前只有模板有
}
struct UserBehaviorInfo {
// 用户主页需要返回最近浏览/使用商品的时间
1: optional i64 ViewedAt (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "viewed_at", api.body= "viewed_at") , // 最近浏览时间戳
2: optional i64 UsedAt (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "used_at", api.body= "used_at") , // 最近使用时间戳
}
enum PluginAuthMode {
NoAuth = 0, // 不需要授权
Required = 1, // 需要授权,但无授权配置
Configured = 2, // 需要授权,且已经配置
Supported = 3, // 需要授权,但授权配置可能是用户级别,可由用户自己配置
}
struct PluginExtraInfo {
1: optional list<PluginToolInfo> Tools (agw.key = "tools", api.body= "tools") ,
2: i32 TotalAPICount (agw.key = "total_api_count", api.body= "total_api_count") ,
3: i32 BotsUseCount (agw.key = "bots_use_count", api.body= "bots_use_count") ,
4: optional bool HasPrivacyStatement (agw.key = "has_private_statement", api.body= "has_private_statement"), // 是否有隐私声明, 目前只有 PublicGetProductDetail 会取数据
5: optional string PrivacyStatement (agw.key = "private_statement", api.body= "private_statement") , // 隐私声明, 目前只有 PublicGetProductDetail 会取数据
6: i32 AssociatedBotsUseCount (agw.key = "associated_bots_use_count", api.body= "associated_bots_use_count"),
7: bool IsPremium (agw.key="is_premium", api.body= "is_premium"),
8: bool IsOfficial (agw.key="is_official", api.body= "is_official"),
9: optional i32 CallAmount (agw.key = "call_amount", api.body= "call_amount") // 调用量
10: optional double SuccessRate (agw.key = "success_rate", api.body= "success_rate") // 成功率
11: optional double AvgExecTime (agw.key = "avg_exec_time", api.body= "avg_exec_time") // 平均执行时长
12: optional bool IsDefaultIcon (agw.key = "is_default_icon", api.body= "is_default_icon"),
13: optional i64 SpaceID (agw.key = "space_id", agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.body= "space_id"),
14: optional i64 MaterialID (agw.key = "material_id", agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.body= "material_id"),
15: list<PluginConnectorInfo> Connectors (agw.key = "connectors", api.body= "connectors"),
16: optional product_common.PluginType PluginType (agw.key = "plugin_type", api.body= "plugin_type"),
// for opencoze
50: optional PluginAuthMode AuthMode (agw.key = "auth_mode", api.body= "auth_mode"),
}
struct ToolParameter {
1: string Name (agw.key = "name", api.body= "name") ,
2: bool IsRequired (agw.key = "required", api.body= "required") ,
3: string Description (agw.key = "description", api.body= "description"),
4: string Type (agw.key = "type", api.body= "type") ,
5: list<ToolParameter> SubParameter (agw.key = "sub_params", api.body= "sub_params") ,
}
struct CardInfo {
1: string CardURL (agw.key = "card_url", api.body= "card_url"),
// 以下只有详情页返回
2: i64 CardID (agw.js_conv="str", api.js_conv="true" agw.cli_conv="str", agw.key = "card_id", api.body= "card_id"),
3: string MappingRule (agw.key = "mapping_rule"),
4: i64 MaxDisplayRows (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "max_display_rows", api.body= "max_display_rows"),
5: i64 CardVersion (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "card_version", api.body= "card_version"),
}
struct PluginToolExample{
1: string ReqExample (agw.key = "req_example", api.body= "req_example"),
2: string RespExample (agw.key = "resp_example", api.body= "resp_example"),
}
enum PluginRunMode {
DefaultToSync = 0
Sync = 1
Async = 2
Streaming = 3
}
struct PluginToolInfo{
1: i64 ID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key="id", api.body= "id"),
2: string Name (agw.key = "name", api.body= "name") ,
3: string Description (agw.key = "description", api.body= "description") ,
4: optional list<ToolParameter> Parameters (agw.key = "parameters", api.body= "parameters") ,
5: optional CardInfo CardInfo (agw.key = "card_info", api.body= "card_info"),
6: optional PluginToolExample Example (agw.key = "example", api.body= "example"),
7: optional i32 CallAmount (agw.key = "call_amount", api.body= "call_amount") // 调用量
8: optional double SuccessRate (agw.key = "success_rate", api.body= "success_rate") // 成功率
9: optional double AvgExecTime (agw.key = "avg_exec_time", api.body= "avg_exec_time") // 平均执行时长
10: optional i32 BotsUseCount (agw.key = "bots_use_count", api.body= "bots_use_count") // tool 被bot引用数
11: optional PluginRunMode RunMode (agw.key = "run_mode", api.body= "run_mode"), // 运行模式
}
struct PluginConnectorInfo {
1: i64 ID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "id", api.body= "id"),
2: string Name (agw.key = "name", api.body= "name"),
3: string Icon (agw.key = "icon", api.body= "icon"),
}
struct BotPublishPlatform {
1: i64 ID (agw.js_conv="str", api.js_conv="true",agw.cli_conv="str", agw.key = "id", api.body= "id"),
2: string IconURL (agw.key = "icon_url", api.body= "icon_url") ,
3: string PlatformURL (agw.key = "url", api.body= "url") ,
4: string Name (agw.key = "name", api.body= "name") ,
}
struct ProductMaterial {
1: string Name (agw.key = "name", api.body= "name") ,
2: string IconURL (agw.key = "icon_url", api.body= "icon_url"),
}
struct BotVoiceInfo {
1: i64 VoiceID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "id", api.body= "id"),
2: string LanguageCode (agw.key="language_code", api.body= "language_code") ,
3: string LanguageName (agw.key="language_name", api.body= "language_name") ,
4: string Name (agw.key="name", api.body= "name") ,
5: string StyleID (agw.key="style_id", api.body= "style_id") ,
6: bool IsSupportVoiceCall (agw.key = "is_support_voice_call", api.body= "is_support_voice_call"),
}
enum TimeCapsuleMode {
Off = 0
On = 1
}
enum FileboxInfoMode {
Off = 0
On = 1
}
struct UserQueryCollectConf { // bot用户query收集配置
1: bool IsCollected (agw.key="is_collected", api.body= "is_collected") , // 是否开启收集开关
2: string PrivatePolicy (agw.key="private_policy", api.body= "private_policy") , // 隐私协议链接
}
struct BotConfig {
1: optional list<ProductMaterial> Models (agw.key = "models", api.body= "models") , // 模型
2: optional list<ProductMaterial> Plugins (agw.key = "plugins", api.body= "plugins") , // 插件
3: optional list<ProductMaterial> Knowledges (agw.key = "knowledges", api.body= "knowledges") , // 知识库
4: optional list<ProductMaterial> Workflows (agw.key = "workflows", api.body= "workflows") , // 工作流
5: optional i32 PrivatePluginsCount (agw.key = "private_plugins_count", api.body= "private_plugins_count") , // 私有插件数量
6: optional i32 PrivateKnowledgesCount (agw.key = "private_knowledges_count", api.body= "private_knowledges_count"), // 私有知识库数量
7: optional i32 PrivateWorkflowsCount (agw.key = "private_workflows_count", api.body= "private_workflows_count") , // 私有工作流数量
8: optional bool HasBotAgent (agw.key = 'has_bot_agent', api.body= "has_bot_agent") , // 判断 multiagent 是否有 bot 节点
9: optional list<BotVoiceInfo> BotVoices (agw.key = 'bot_voices', api.body= "bot_voices") , // bot 配置的声音列表
10: optional i32 TotalPluginsCount (agw.key = "total_plugins_count", api.body= "total_plugins_count") , // 所有插件数量
11: optional i32 TotalKnowledgesCount (agw.key = "total_knowledges_count", api.body= "total_knowledges_count"), // 所有知识库数量
12: optional i32 TotalWorkflowsCount (agw.key = "total_workflows_count", api.body= "total_workflows_count") , // 所有工作流数量
13: optional TimeCapsuleMode TimeCapsuleMode (agw.key = "time_capsule_mode", api.body= "time_capsule_mode") // 时间胶囊模式
14: optional FileboxInfoMode FileboxMode (agw.key = "filebox_mode", api.body= "filebox_mode") // 文件盒模式
15: optional i32 PrivateImageWorkflowCount (agw.key = "private_image_workflow_count", api.body= "private_image_workflow_count"), // 私有图片工作流数量
16: optional UserQueryCollectConf UserQueryCollectConf (agw.key = "user_query_collect_conf", api.body= "user_query_collect_conf") // 用户qeury收集配置
17: optional bool IsCloseVoiceCall (agw.key = "is_close_voice_call", api.body= "is_close_voice_call"), // 是否关闭语音通话(默认是打开)
}
// 消息涉及的bot信息,在home分享场景,消息属于多个bot
struct ConversationRelateBot {
1: i64 ID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "id", api.body= "id"),
2: string Name (agw.key = "name", api.body= "name") ,
3: string Description (agw.key = "description", api.body= "description") ,
4: string IconURL (agw.key = "icon_url", api.body= "icon_url") ,
}
// 消息涉及的user信息,在home分享场景,消息属于多个user
struct ConversationRelateUser {
1: optional product_common.UserInfo UserInfo (agw.key = "user_info", api.body= "user_info")
}
struct Conversation {
1: optional list<string> Snippets (agw.key = "snippets", api.body= "snippets") , // 对话示例
2: optional string Title (agw.key = "title", api.body= "title") , // 对话标题
3: optional i64 ID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key="id", api.body= "id"), // 对话IDidGen生成
4: optional bool GenTitle (agw.key = "gen_title", api.body= "gen_title") , // 是否需要生成对话
5: optional product_common.AuditStatus AuditStatus (agw.key = "audit_status", api.body= "audit_status") , // 对话审核状态
6: optional product_common.OpeningDialog OpeningDialog (agw.key = "opening_dialog", api.body= "opening_dialog") , // 开场白
7: optional map<string,ConversationRelateBot> RelateBots (agw.key = "relate_bots", api.body= "relate_bots") , // 消息涉及的bot信息,key bot_id
8: optional map<string,ConversationRelateUser> RelateUsers (agw.key = "relate_users", api.body= "relate_users") , // 消息涉及的user信息,key user_id
}
struct BotExtraInfo {
1: list<BotPublishPlatform> PublishPlatforms (agw.key = "publish_platforms", api.body= "publish_platforms") , // 发布渠道
2: i32 UserCount (agw.key = "user_count", api.body= "user_count") , // 用户数
3: product_common.ProductPublishMode PublishMode (agw.key = "publish_mode", api.body= "publish_mode") , // 公开方式
// 详情页特有
4: optional list<list<string>> ConversationSnippets (agw.key = "conversation_snippets", api.body= "conversation_snippets") , // 对话示例, 废弃
5: optional BotConfig Config (agw.key = "config", api.body= "config") , // 配置
6: optional bool IsInhouseUser (agw.key = "is_inhouse_user", api.body= "is_inhouse_user") , // 白名单
7: optional i32 DuplicateBotCount (agw.key = 'duplicate_bot_count', api.body= "duplicate_bot_count") , // 复制创建 bot 数量
8: optional list<Conversation> Conversations (agw.key = "conversations", api.body= "conversations") , // 分享对话
9: optional i64 ChatConversationCount (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "chat_conversation_count", api.body= "chat_conversation_count"), // 与 Bot 聊天的对话数
10: optional i64 RelatedProductCount (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "related_product_count", api.body= "related_product_count"), // 关联商品数
}
struct WorkflowParameter {
1: string Name (agw.key = "name", api.body= "name")
2: string Desc (agw.key = "desc", api.body= "desc")
3: bool IsRequired (agw.key = "is_required", api.body= "is_required")
4: product_common.InputType InputType (agw.key = "input_type", api.body= "input_type")
5: list<WorkflowParameter> SubParameters(agw.key = "sub_parameters", api.body= "sub_parameters")
6: product_common.InputType SubType (agw.key = "sub_type", api.body= "sub_type") // 如果Type是数组则有subtype
7: optional string Value (agw.key = "value", api.body= "value") // 如果入参是用户手输 就放这里
8: optional product_common.PluginParamTypeFormat Format (agw.key = "format", api.body= "format")
9: optional string FromNodeId (agw.key = "from_node_id", api.body= "from_node_id")
10: optional list<string> FromOutput (agw.key = "from_output", api.body= "from_output")
11: optional i64 AssistType (agw.key = "assist_type", api.body= "assist_type")// InputType (+ AssistType) 定义一个变量的最终类型,仅需透传
12: optional string ShowName (agw.key = "show_name", api.body= "show_name") // 展示名称( store 独有的,用于详情页 GUI 展示参数)
13: optional i64 SubAssistType (agw.key = "sub_assist_type", api.body= "sub_assist_type") // 如果InputType是数组则有subassisttype
14: optional string ComponentConfig (agw.key = "component_config", api.body= "component_config") // 组件配置,由前端解析并渲染
15: optional string ComponentType (agw.key = "component_type", api.body= "component_type") // 组件配置类型,前端展示需要
}
struct WorkflowTerminatePlan {
1: i32 TerminatePlanType (agw.key = "terminate_plan_type", api.body= "terminate_plan_type") // 对应 workflow 结束节点的回答模式1-返回变量由Bot生成回答2-使用设定的内容直接回答
2: string Content (agw.key = "content", api.body= "content") // 对应 terminate_plan_type = 2 的场景配置的返回内容
}
struct WorkflowNodeParam {
1: optional list<WorkflowParameter> InputParameters (agw.key = "input_parameters", api.body= "input_parameters")
2: optional WorkflowTerminatePlan TerminatePlan (agw.key = "terminate_plan", api.body= "terminate_plan")
3: optional list<WorkflowParameter> OutpurParameters (agw.key = "output_parameters", api.body= "output_parameters")
}
struct WorkflowNodeInfo {
1: string NodeID (agw.key = "node_id", api.body= "node_id")
2: product_common.WorkflowNodeType NodeType (agw.key = "node_type", api.body= "node_type")
3: optional WorkflowNodeParam NodeParam (agw.key = "node_param", api.body= "node_param")
4: string NodeIconURL (agw.key = "node_icon_url", api.body= "node_icon_url") // 节点icon
5: optional string ShowName (agw.key = "show_name", api.body= "show_name"), // 展示名称( store 独有的,用于详情页 GUI 展示消息节点的名称)
}
struct WorkflowEntity {
1 : i64 ProductID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "product_id", api.body= "product_id") , // 商品ID
2 : string Name (agw.key = "name", api.body= "name") ,
3 : i64 EntityID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "entity_id", api.body= "entity_id") ,
4 : product_common.ProductEntityType EntityType (agw.key = "entity_type", api.body= "entity_type") ,
5 : i64 EntityVersion (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "entity_version", api.body= "entity_version"),
6 : string IconURL (agw.key = "icon_url", agw.key="icon_url", api.body= "icon_url") ,
7 : string EntityName (agw.key = "entity_name", api.body= "entity_name")
8 : string Readme (agw.key = "readme", api.body= "readme")
9 : ProductCategory Category (agw.key = "category", api.body= "category")
10: optional ProductCategory RecommendedCategory (agw.key = "recommended_category", api.body= "recommended_category")// 推荐分类 ,
11: optional list<WorkflowNodeInfo> Nodes (agw.key = "nodes", api.body= "nodes")
12: string Desc (agw.key = "desc", api.body= "desc")
13: optional string CaseInputIconURL (agw.key = "case_input_icon_url", api.body= "case_input_icon_url") // 入参 图片icon
14: optional string CaseOutputIconURL (agw.key = "case_output_icon_url", api.body= "case_output_icon_url") // 出参 图片icon
15: optional string LatestPublishCommitID (agw.key = "latest_publish_commit_id", api.body= "latest_publish_commit_id")
}
struct WorkflowGUIConfig { // 用于将 workflow 的输入/输出/中间消息节点节点转为用户可视化配置
1: WorkflowNodeInfo StartNode (agw.key = "start_node", api.body= "start_node"),
2: WorkflowNodeInfo EndNode (agw.key = "end_node", api.body= "end_node"),
3: optional list<WorkflowNodeInfo> MessageNodes (agw.key = "message_nodes", api.body= "message_nodes"), // 消息节点会输出中间过程,也需要展示
}
struct WorkflowExtraInfo {
1: list<WorkflowEntity> RelatedWorkflows (agw.key = "related_workflows", api.body= "related_workflows")
2: optional i32 DuplicateCount (agw.key = "duplicate_count", api.body= "duplicate_count")
3: optional string WorkflowSchema (agw.key = "workflow_schema", api.body= "workflow_schema") // workflow画布信息
// /api/workflowV2/query schema_json
4: optional ProductCategory RecommendedCategory (agw.key = "recommended_category", api.body= "recommended_category")// 推荐分类
5: optional list<WorkflowNodeInfo> Nodes (agw.key = "nodes", api.body= "nodes")
6: optional WorkflowNodeInfo StartNode (agw.key = "start_node", api.body= "start_node")
7: optional string EntityName (agw.key = "entity_name", api.body= "entity_name") // 实体名称(用于展示)
8: optional string CaseInputIconURL (agw.key = "case_input_icon_url", api.body= "case_input_icon_url") // 用例图入参
9: optional string CaseOutputIconURL (agw.key = "case_output_icon_url", api.body= "case_output_icon_url") // 用例图出参
10: optional i64 CaseExecuteID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "case_execute_id", api.body= "case_execute_id") // 案例执行ID
11: optional string HoverText (agw.key = "hover_text", api.body= "hover_text")
12: optional string LatestPublishCommitID (agw.key = "latest_publish_commit_id", api.body= "latest_publish_commit_id")
13: optional i32 UsedCount (agw.key = "used_count", api.body= "used_count") // 试运行次数,从数仓取
14: optional WorkflowGUIConfig GUIConfig (agw.key = "gui_config", api.body= "gui_config") // 用于将 workflow 的输入/输出/中间消息节点节点转为用户可视化配置
}
struct SocialScenePlayerInfo {
1: i64 ID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key="id", api.body= "id"),
2: string Name (agw.key = "name", api.body= "name")
3: product_common.SocialSceneRoleType RoleType (agw.key = "role_type", api.body= "role_type")
}
struct SocialSceneExtraInfo {
1: optional list<SocialScenePlayerInfo> Players (agw.key = "players", api.body= "players") // 角色
2: i64 UsedCount (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "used_count", api.body= "used_count") // 使用过的人数
3: i64 StartedCount (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "started_count", api.body= "started_count") // 开始过的次数
4: product_common.ProductPublishMode PublishMode (agw.key = "publish_mode", api.body= "publish_mode") // 开闭源
}
struct ProjectConfig {
1: i32 PluginCount (agw.key = "plugin_count", api.body= "plugin_count"), // 插件数量
2: i32 WorkflowCount (agw.key = "workflow_count", api.body= "workflow_count"), // 工作流数量
3: i32 KnowledgeCount (agw.key = "knowledge_count", api.body= "knowledge_count"), // 知识库数量
4: i32 DatabaseCount (agw.key = "database_count", api.body= "database_count"), // 数据库数量
}
struct ProjectExtraInfo {
// Project 上架为模板前生成一个模板副本,使用或者复制模板,需要用 TemplateProjectID 和 TemplateProjectVersion
1: i64 TemplateProjectID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key="template_project_id", api.body= "template_project_id"),
2: i64 TemplateProjectVersion (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key="template_project_version", api.body= "template_project_version"),
3: list<product_common.UIPreviewType> PreviewTypes (agw.key = "preview_types", api.body= "preview_types") // Project 绑定的 UI 支持的预览类型
4: i32 UserCount (agw.key="user_count", api.body= "user_count"), // 用户数
5: i32 ExecuteCount (agw.key="execute_count", api.body= "execute_count"), // 运行数
6: list<BotPublishPlatform> PublishPlatforms (agw.key = "publish_platforms", api.body= "publish_platforms"), // 发布渠道
7: i32 DupliacateCount (agw.key = "duplicate_count", api.body= "duplicate_count"), // 近实时复制量,从数仓接口获取(复制 - 上报埋点 - 数仓计算落库)
8: optional ProjectConfig Config (agw.key = "config", api.body= "config"), // 配置
}
struct GetProductDetailRequest{
1 : optional i64 ProductID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.query = "product_id", agw.key="product_id"),
2 : optional product_common.ProductEntityType EntityType (api.body = "entity_type") ,
3 : optional i64 EntityID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.query = "entity_id", agw.key="entity_id") ,
4 : optional bool NeedAuditFailed (api.body = "need_audit_failed") , // 是否查看最新的审核失败草稿
101: optional string ClientIP (api.header="Tt-Agw-Client-Ip") ,
255: optional base.Base Base ,
}
struct GetProductDetailResponse {
1 : required i32 Code (agw.key = "code", api.body= "code") ,
2 : required string Message (agw.key = "message", api.body= "message"),
3 : GetProductDetailData Data (agw.key = "data", api.body= "data") ,
255: optional base.BaseResp BaseResp ,
}
struct Price{
1: i32 Value (agw.key = "value", api.body= "value") ,
2: string Currency (agw.key = "currency", api.body= "currency") ,
3: string DisplayPrice (agw.key = "display_price", api.body= "display_price"),
}
struct SKUInfo {
1: i64 ID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "id", api.body= "id"),
2: list<Price> Price (agw.key = "price", api.body= "price") , // 待废弃
3: string Description (agw.key = "description", api.body= "description") ,
4: list<marketplace_common.Price> PriceV2 (agw.key = "price_v2", api.body= "price_v2") ,
5: optional product_common.ChargeSKUExtra ChargeInfoExtra (agw.key = "charge_sku_info", api.body= "charge_sku_info"),
}
struct SellAttrValue {
1: i64 ID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "id", api.body= "id"),
2: string Value (agw.key = "value", api.body= "value") ,
}
struct SellAttr {
1: string DisplayName (agw.key = "display_name", api.body= "display_name"),
2: string Key (agw.key = "key", api.body= "key") ,
3: list<SellAttrValue> Values (agw.key = "values", api.body= "values") ,
}
struct SellInfo{
1: map<i64,SKUInfo> SKUs (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "skus", api.body= "skus") ,
2: list<SellAttr> Attr (agw.key = "attr", api.body= "attr") ,
3: map<string,i64> SKUAttrRef (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "sku_attr_ref", api.body= "sku_attr_ref"), // Key 是 attrkey:attrvalue 路径value 是 skuID
}
struct Topic {
1: i64 ID (agw.key = "id", agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.body= "id"),
2: string Name (agw.key = "name", api.body= "name") ,
3: string Description (agw.key = "description", api.body= "description") ,
4: string BannerURL (agw.key = "banner_url", api.body= "banner_url") ,
5: string BannerURLSmall (agw.key = "banner_url_small", api.body= "banner_url_small") , // 背景小图,前端优先加载
6: string Reason (agw.key = "reason", api.body= "reason") ,
7: string IntroductionURL (agw.key = "introduction_url", api.body= "introduction_url") , // 运营提供的专题介绍文档,用户可见
8: bool IsFavorite (agw.key = "is_favorite", api.body= "is_favorite") , // 用户是否收藏专题
}
struct ProductDataIndicator { // 数据分析指标,来源数仓,比如模板购买量、复制量等
1: optional i32 PurchaseCount (agw.key = "purchase_count", api.body= "purchase_count"), // 购买量
}
struct GetProductDetailData { // 下架的商品只返回非 optional 字段
1 : required ProductMetaInfo MetaInfo (agw.key = "meta_info", api.body= "meta_info") ,
2 : required bool IsOwner (agw.key = "is_owner", api.body= "is_owner") , // 用以区分主/客态
3 : product_common.ProductDraftStatus AuditStatus (agw.key = "audit_status", api.body= "audit_status") , // 审核状态,主态下返回需要关注,如果主态且审核中,需要展示审核中状态
4 : optional SellInfo SellInfo (agw.key = "sell_info", api.body= "sell_info") ,
5 : optional i64 SpaceID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", agw.key = "space_id", api.body= "space_id"),
6 : optional Topic Topic (agw.key = "topic", api.body= "topic") , // 详情页返回
7 : optional bool CanDuplicate (agw.key = "can_duplicate", api.body= "can_duplicate") , // 详情页返回
8 : optional product_common.CommercialSetting CommercialSetting (agw.key = "commercial_setting", api.body= "commercial_setting")
20: optional PluginExtraInfo PluginExtra (agw.key = "plugin_extra", api.body= "plugin_extra") ,
21: optional BotExtraInfo BotExtra (agw.key = "bot_extra", api.body= "bot_extra")
22: optional WorkflowExtraInfo WorkflowExtra (agw.key = "workflow_extra", api.body= "workflow_extra"),
23: optional SocialSceneExtraInfo SocialSceneExtra (agw.key = "social_scene_extra", api.body= "social_scene_extra"),
24: optional ProjectExtraInfo ProjectExtra (agw.key = "project_extra", api.body= "project_extra"),
25: optional ProductDataIndicator DataIndicator (agw.key = "data_indicator", api.body= "data_indicator"),
}
struct GetUserFavoriteListV2Request {
1 : optional string CursorID (api.query = "cursor_id") , // 第一页不传后续调用时传上一次返回的cursor_id
2 : required i32 PageSize (api.query = "page_size") ,
3 : optional product_common.ProductEntityType EntityType (api.query = "entity_type"),
4 : required product_common.SortType SortType (api.query = "sort_type") ,
5 : optional string Keyword (api.query = "keyword") , // 不为空则搜索
6 : optional product_common.FavoriteListSource Source (api.query = "source") , // 列表页 tab
7 : optional bool NeedUserTriggerConfig (api.query = "need_user_trigger_config") // 是否需要查询用户对Bot的触发器配置为true时才会返回EntityUserTriggerConfig
8 : optional i64 BeginAt (api.query = "begin_at", api.js_conv="true") , // 筛选收藏时间
9 : optional i64 EndAt (api.query = "end_at", api.js_conv="true") , // 筛选收藏时间
10 : optional list<product_common.ProductEntityType> EntityTypes (api.query = "entity_types"),
11 : optional i64 OrganizationID (agw.js_conv="str", agw.cli_conv="str", api.query = "organization_id"), // 组织ID企业版想获取用户收藏的所有内容时需传递
255: optional base.Base Base ,
}
struct GetUserFavoriteListV2Response {
1 : required i32 Code (agw.key = "code") ,
2 : required string Message (agw.key = "message"),
3 : optional GetUserFavoriteListDataV2 Data (agw.key = "data") ,
255: optional base.BaseResp BaseResp ,
}
struct GetUserFavoriteListDataV2{
1: list<product_common.FavoriteEntity> FavoriteEntities (agw.key = "favorite_entities", api.body="favorite_entities"),
2: string CursorID (agw.key = "cursor_id", api.body="cursor_id") ,
3: bool HasMore (agw.key = "has_more", api.body="has_more") ,
// 用户定时任务配置对应flow.bot.task服务的TriggerEnabled
4: map<i64, UserTriggerConfig> EntityUserTriggerConfig (agw.key = "entity_user_trigger_config", api.body="entity_user_trigger_config"), // key: entity_id; value: UserTriggerConfig
}
struct UserTriggerConfig {
1: TriggerEnable TriggerEnabled (agw.key = "trigger_enabled")
}
enum TriggerEnable {
Init = 0
Open = 1
Close = 2
}
struct DuplicateProductRequest {
1: required i64 ProductID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.body = "product_id")
2: required product_common.ProductEntityType EntityType (api.body = "entity_type")
3: optional i64 SpaceID (agw.js_conv="str", api.js_conv="true", agw.cli_conv="str", api.body = "space_id")
4: optional string Name (api.body = "name")
100: optional string Cookie (agw.source = "header", agw.key = "Cookie", go.tag="jsonlog:\"-\" json:\"-\"" ),
255: optional base.Base Base
}
struct DuplicateProductResponse {
1: required i32 Code (agw.key = "code", api.body= "code"),
2: required string Message (agw.key = "message", api.body= "message"),
3: DuplicateProductData Data (agw.key = "data", api.body= "data"),
255: optional base.BaseResp BaseResp
}
struct DuplicateProductData {
// 复制后的新id
1: i64 NewEntityID (agw.js_conv="str", api.js_conv="str", agw.cli_conv="str", api.body = "new_entity_id")
2: optional i64 NewPluginID (agw.js_conv="str", api.js_conv="str", agw.cli_conv="str", api.body = "new_plugin_id") // workflow对应的插件id
}

View File

@@ -0,0 +1,15 @@
include "../../base.thrift"
namespace go flow.marketplace.marketplace_common
struct Price {
1: i64 Amount (agw.key = "amount",agw.js_conv="str",api.js_conv="true",agw.cli_conv="str",api.body= "amount"), // 金额
2: string Currency (agw.key = "currency",api.body= "currency") , // 币种如USD、CNY
3: byte DecimalNum (agw.key = "decimal_num",api.body= "decimal_num") , // 小数位数
}
enum FollowType {
Unknown = 0, // 无关系
Followee = 1, // 关注
Follower = 2, // 粉丝
MutualFollow = 3, // 互相关注
}

View File

@@ -0,0 +1,93 @@
namespace go intelligence.common
struct UserLabel {
1: string label_id ,
2: string label_name ,
3: string icon_uri ,
4: string icon_url ,
5: string jump_link ,
}
struct User {
1: i64 user_id (agw.js_conv="str", api.js_conv="true"),
2: string nickname, // 用户昵称
3: string avatar_url, // 用户头像
4: string user_unique_name, // 用户名
5: UserLabel user_label, // 用户标签
}
/****************************** audit **********************************/
enum AuditStatus {
Auditing = 0, // 审核中
Success = 1, // 审核通过
Failed = 2, // 审核失败
}
struct AuditInfo {
1: optional AuditStatus audit_status,
2: optional string publish_id,
3: optional string commit_version,
}
// 审核结果
struct AuditData {
1: bool check_not_pass // true机审校验不通过
2: optional string check_not_pass_msg // 机审校验不通过文案
}
/****************************** publish **********************************/
enum ConnectorDynamicStatus {
Normal = 0
Offline = 1
TokenDisconnect = 2
}
struct ConnectorInfo {
1: string id
2: string name
3: string icon
4: ConnectorDynamicStatus connector_status
5: optional string share_link
}
struct IntelligencePublishInfo {
1: string publish_time,
2: bool has_published,
3: list<ConnectorInfo> connectors,
}
enum ResourceType {
Plugin = 1
Workflow = 2
Imageflow = 3
Knowledge = 4
UI = 5
Prompt = 6
Database = 7
Variable = 8
}
enum OrderByType {
Asc = 1
Desc = 2
}
enum PermissionType {
NoDetail = 1 //不能查看详情
Detail = 2 //可以查看详情
Operate = 3 //可以查看和操作
}
enum SpaceStatus {
Valid = 1
Invalid = 2
}
struct Space {
1: i64 id,
2: i64 owner_id,
3: SpaceStatus status,
4: string name,
}

View File

@@ -0,0 +1,32 @@
namespace go intelligence.common
enum IntelligenceStatus {
Using = 1,
Deleted = 2,
Banned = 3,
MoveFailed = 4, // 迁移失败
Copying = 5, // 复制中
CopyFailed = 6, // 复制失败
}
enum IntelligenceType {
Bot = 1
Project = 2
}
struct IntelligenceBasicInfo {
1: i64 id (agw.js_conv="str", api.js_conv="true"),
2: string name,
3: string description,
4: string icon_uri,
5: string icon_url,
6: i64 space_id (agw.js_conv="str", api.js_conv="true"),
7: i64 owner_id (agw.js_conv="str", api.js_conv="true"),
8: i64 create_time (agw.js_conv="str", api.js_conv="true"),
9: i64 update_time (agw.js_conv="str", api.js_conv="true"),
10: IntelligenceStatus status,
11: i64 publish_time (agw.js_conv="str", api.js_conv="true"),
12: optional string enterprise_id,
13: optional i64 organization_id,
}

View File

@@ -0,0 +1,3 @@
struct ProjectInnerTaskInfo {
1: i64 task_id (agw.js_conv="str",api.js_conv="true") // 任务id
}

View File

@@ -0,0 +1,31 @@
include "../base.thrift"
include "search.thrift"
include "common_struct/intelligence_common_struct.thrift"
include "common_struct/common_struct.thrift"
include "./project.thrift"
include "publish.thrift"
include "task.thrift"
namespace go intelligence
service IntelligenceService {
project.DraftProjectCreateResponse DraftProjectCreate(1: project.DraftProjectCreateRequest request)(api.post='/api/intelligence_api/draft_project/create', api.category="draft_project",agw.preserve_base="true")
project.DraftProjectUpdateResponse DraftProjectUpdate(1: project.DraftProjectUpdateRequest request)(api.post='/api/intelligence_api/draft_project/update', api.category="draft_project",agw.preserve_base="true")
project.DraftProjectDeleteResponse DraftProjectDelete(1: project.DraftProjectDeleteRequest request)(api.post='/api/intelligence_api/draft_project/delete', api.category="draft_project",agw.preserve_base="true")
project.DraftProjectCopyResponse DraftProjectCopy(1: project.DraftProjectCopyRequest request)(api.post='/api/intelligence_api/draft_project/copy', api.category="draft_project",agw.preserve_base="true")
task.DraftProjectInnerTaskListResponse DraftProjectInnerTaskList(1: task.DraftProjectInnerTaskListRequest request)(api.post='/api/intelligence_api/draft_project/inner_task_list', api.category="draft_project",agw.preserve_base="true")
search.GetDraftIntelligenceListResponse GetDraftIntelligenceList(1: search.GetDraftIntelligenceListRequest req) (api.post='/api/intelligence_api/search/get_draft_intelligence_list', api.category="search",agw.preserve_base="true")
search.GetDraftIntelligenceInfoResponse GetDraftIntelligenceInfo(1: search.GetDraftIntelligenceInfoRequest req) (api.post='/api/intelligence_api/search/get_draft_intelligence_info', api.category="search",agw.preserve_base="true")
search.GetUserRecentlyEditIntelligenceResponse GetUserRecentlyEditIntelligence(1: search.GetUserRecentlyEditIntelligenceRequest req) (api.post='/api/intelligence_api/search/get_recently_edit_intelligence', api.category="search",agw.preserve_base="true")
publish.PublishConnectorListResponse ProjectPublishConnectorList(1: publish.PublishConnectorListRequest request)(api.post='/api/intelligence_api/publish/connector_list', api.category="publish",agw.preserve_base="true")
publish.GetProjectPublishedConnectorResponse GetProjectPublishedConnector(1: publish.GetProjectPublishedConnectorRequest request) (api.post='/api/intelligence_api/publish/get_published_connector', api.category="publish",agw.preserve_base="true")
publish.CheckProjectVersionNumberResponse CheckProjectVersionNumber(1: publish.CheckProjectVersionNumberRequest request)(api.post='/api/intelligence_api/publish/check_version_number', api.category="publish",agw.preserve_base="true")
publish.PublishProjectResponse PublishProject(1: publish.PublishProjectRequest request)(api.post='/api/intelligence_api/publish/publish_project', api.category="publish",agw.preserve_base="true")
publish.GetPublishRecordListResponse GetPublishRecordList(1: publish.GetPublishRecordListRequest request)(api.post='/api/intelligence_api/publish/publish_record_list', api.category="publish",agw.preserve_base="true")
publish.GetPublishRecordDetailResponse GetPublishRecordDetail(1: publish.GetPublishRecordDetailRequest request)(api.post='/api/intelligence_api/publish/publish_record_detail', api.category="publish",agw.preserve_base="true")
}

View File

@@ -0,0 +1,89 @@
include "../base.thrift"
include "common_struct/intelligence_common_struct.thrift"
include "common_struct/common_struct.thrift"
struct DraftProjectCreateRequest {
1 : i64 space_id (agw.js_conv="str", api.js_conv="true"),
2 : string name ,
3 : string description,
4 : string icon_uri ,
5 : optional MonetizationConf monetization_conf,
6 : optional string create_from, // 创建来源 navi:导航栏 space:空间
255: optional base.Base Base (api.none="true") ,
}
struct MonetizationConf {
1: optional bool is_enable
}
struct DraftProjectCreateResponse {
1 : DraftProjectCreateData data
253: required i64 code,
254: required string msg,
255: optional base.BaseResp BaseResp (api.none="true")
}
struct DraftProjectCreateData {
1: i64 project_id (agw.js_conv="str", api.js_conv="true")
2: common_struct.AuditData audit_data
}
struct DraftProjectUpdateRequest {
1 : required i64 project_id (agw.js_conv="str", api.js_conv="true")
2 : optional string name
3 : optional string description
4 : optional string icon_uri
255: optional base.Base Base (api.none="true")
}
struct DraftProjectUpdateResponse {
1 : DraftProjectUpdateData data
253: required i64 code,
254: required string msg,
255: optional base.BaseResp BaseResp (api.none="true")
}
struct DraftProjectUpdateData {
1 : common_struct.AuditData audit_data
}
struct DraftProjectDeleteRequest {
1 : required i64 project_id (agw.js_conv="str", api.js_conv="true")
255: optional base.Base Base (api.none="true")
}
struct DraftProjectDeleteResponse {
253: required i64 code,
254: required string msg,
255: optional base.BaseResp BaseResp (api.none="true")
}
struct DraftProjectCopyRequest {
1 : i64 project_id (agw.js_conv="str", api.js_conv="true")
3 : i64 to_space_id (agw.js_conv="str", api.js_conv="true")
4 : string name ,
5 : string description,
6 : string icon_uri ,
255: optional base.Base Base (api.none="true")
}
struct DraftProjectCopyResponse {
1 : DraftProjectCopyResponseData data
253: required i64 code,
254: required string msg,
255: optional base.BaseResp BaseResp (api.none="true")
}
struct DraftProjectCopyResponseData {
1 : intelligence_common_struct.IntelligenceBasicInfo basic_info
2 : common_struct.AuditData audit_data
3 : common_struct.User user_info
}

View File

@@ -0,0 +1,268 @@
include "../base.thrift"
include "common_struct/common_struct.thrift"
include "common_struct/intelligence_common_struct.thrift"
struct GetProjectPublishedConnectorRequest {
1: required i64 project_id (agw.js_conv="str", api.js_conv="true")
255: optional base.Base Base (api.none="true")
}
struct GetProjectPublishedConnectorResponse {
1: list<common_struct.ConnectorInfo> data
253: i64 code
254: string msg
255: optional base.BaseResp BaseResp (api.none="true")
}
struct PublishConnectorListRequest {
1: required i64 project_id (agw.js_conv="str", api.js_conv="true")
255: optional base.Base Base (api.none="true")
}
struct PublishConnectorListResponse {
1: PublishConnectorListData data
253: i64 code
254: string msg
255: optional base.BaseResp BaseResp (api.none="true")
}
struct PublishConnectorListData {
1: list<PublishConnectorInfo> connector_list
2: LastPublishInfo last_publish_info
3: map<i64, ConnectorUnionInfo> connector_union_info_map // 渠道集合信息key是connector_union_id
}
struct PublishConnectorInfo {
1: required i64 id (agw.js_conv="str", api.js_conv="true")
2: required string name
3: required string icon_url
4: required string description // 描述
5: string description_extra // 描述扩展
6: required ConnectorClassification connector_classification // 渠道类型
7: required ConnectorConfigStatus config_status // 配置状态
8: ConnectorStatus connector_status // 渠道状态
9: required ConnectorBindType bind_type // 绑定类型
10: required map<string,string> bind_info // 绑定信息 key字段名 value是值
11: optional string bind_id // 绑定id信息用于解绑使用
12: optional AuthLoginInfo auth_login_info // 用户授权登陆信息
13: string privacy_policy // 隐私政策
14: string user_agreement // 用户协议
15: bool allow_publish // 是否允许发布
16: optional string not_allow_publish_reason // 不允许发布的原因
17: optional i64 connector_union_id (agw.js_conv="str", api.js_conv="true") // 渠道集合id表示需要聚合展示的渠道
18: optional list<UIOption> UIOptions // UI选项
19: optional bool support_monetization // 支持商业化
20: optional string installation_guide // 安装指引
21: optional UserAuthStatus auth_status // 目前仅 bind_type == 8 时这个字段才有
22: optional string config_status_toast // 配置状态toast
23: optional string to_complete_info_url // connector_status为审核中时补全信息按钮的url
24: optional string connector_tips // 渠道发布提示
}
struct LastPublishInfo {
1: string version_number
2: list<i64> connector_ids (agw.js_conv="str", api.js_conv="true")
3: map<i64,ConnectorPublishConfig> connector_publish_config // 渠道发布配置
}
enum ConnectorClassification {
APIOrSDK = 1 // api或sdk
SocialPlatform = 2 // 社交平台
Coze = 3 // Coze商店/模板
MiniProgram = 4 // 小程序
CozeSpaceExtensionLibrary = 5 // MCP扩展库
}
enum ConnectorConfigStatus {
Configured = 1 // 已配置
NotConfigured = 2 // 未配置
Disconnected = 3 // Token发生变化
Configuring = 4 // 配置中,授权中
NeedReconfiguring = 5 // 需要重新配置
}
enum ConnectorStatus {
Normal = 0 // 正常
InReview = 1 // 审核中
Offline = 2 // 已下线
}
struct ConnectorUnionInfo {
1: required i64 id (agw.js_conv="str", api.js_conv="true")
2: required string name
3: required string description
4: required string icon_url
5: required list<ConnectorUnionInfoOption> connector_options
}
enum ConnectorBindType {
NoBindRequired = 1 // 无需绑定
AuthBind = 2 // Auth绑定
KvBind = 3 // Kv绑定
KvAuthBind = 4 // Kv并Auth授权
ApiBind = 5 // api渠道绑定
WebSDKBind = 6
StoreBind = 7
AuthAndConfig = 8 // 授权和配置各一个按钮
TemplateBind = 9 // 模板渠道绑定
}
struct AuthLoginInfo {
1: string app_id
2: string response_type
3: string authorize_url
4: string scope
5: string client_id
6: string duration
7: string aid
8: string client_key
}
struct UIOption {
1: i64 ui_channel (agw.js_conv="str", api.js_conv="true") // UIChannel选项
2: bool available // 是否可选
3: string unavailable_reason // 不可选原因
}
enum UserAuthStatus {
Authorized = 1 // 已授权
UnAuthorized = 2 // 未授权
Authorizing = 3 // 授权中
}
struct ConnectorPublishConfig {
1: list<SelectedWorkflow> selected_workflows // 发布渠道选择的Workflow/ChatFlow
}
struct ConnectorUnionInfoOption {
1: required i64 connector_id (agw.js_conv="str", api.js_conv="true") // 渠道 ID
2: required string show_name // 展示名,如:托管发布、下载代码
}
struct SelectedWorkflow {
1: i64 workflow_id (agw.js_conv="str", api.js_conv="true")
2: string workflow_name
}
struct CheckProjectVersionNumberRequest {
1: required i64 project_id (agw.js_conv="str", api.js_conv="true")
2: required string version_number
255: optional base.Base Base (api.none="true")
}
struct CheckProjectVersionNumberResponse {
1: CheckProjectVersionNumberData data
253: i64 code
254: string msg
255: optional base.BaseResp BaseResp (api.none="true")
}
struct CheckProjectVersionNumberData {
1: bool is_duplicate
}
struct PublishProjectRequest {
1: required i64 project_id (agw.js_conv="str", api.js_conv="true")
2: required string version_number // 版本号
3: optional string description // 描述
4: optional map<i64,map<string,string>> connectors // key代表connector_idvalue是渠道发布的参数
5: optional map<i64,ConnectorPublishConfig> connector_publish_config // 渠道发布配置key代表connector_id
255: optional base.Base Base (api.none="true")
}
struct PublishProjectResponse {
1: PublishProjectData data
253: i64 code
254: string msg
255: optional base.BaseResp BaseResp (api.none="true")
}
struct PublishProjectData {
1: i64 publish_record_id (agw.js_conv="str", api.js_conv="true") // 发布记录ID用于前端轮询
2: optional bool publish_monetization_result // 收费配置发布结果,海外环境才有
}
struct GetPublishRecordListRequest {
1: required i64 project_id (agw.js_conv="str", api.js_conv="true")
255: optional base.Base Base (api.none="true")
}
struct GetPublishRecordListResponse {
1: list<PublishRecordDetail> data
253: i64 code
254: string msg
255: optional base.BaseResp BaseResp (api.none="true")
}
struct PublishRecordDetail {
1: i64 publish_record_id (agw.js_conv="str", api.js_conv="true")
2: string version_number
3: PublishRecordStatus publish_status // 发布状态
4: string publish_status_msg // 该字段废弃请使用publish_status_detail
5: optional list<ConnectorPublishResult> connector_publish_result // 渠道发布结果
6: optional PublishRecordStatusDetail publish_status_detail // 发布状态补充信息
}
enum PublishRecordStatus {
Packing = 0 // 打包中
PackFailed = 1 // 打包失败
Auditing = 2 // 审核中
AuditNotPass = 3 // 审核未通过
ConnectorPublishing = 4 // 渠道发布中
PublishDone = 5 // 发布完成
}
struct ConnectorPublishResult {
1: i64 connector_id (agw.js_conv="str", api.js_conv="true")
2: string connector_name
3: string connector_icon_url
4: ConnectorPublishStatus connector_publish_status // 渠道发布状态
5: string connector_publish_status_msg // 渠道发布状态补充信息
6: optional string share_link // OpenIn链接
7: optional string download_link // 小程序渠道下载链接
8: optional ConnectorPublishConfig connector_publish_config // 渠道发布配置
9: optional map<string,string> connector_bind_info // 渠道绑定信息 key字段名 value是值
}
struct PublishRecordStatusDetail {
1: optional list<PackFailedDetail> pack_failed_detail // 打包失败详情
}
//project
enum ConnectorPublishStatus {
Default = 0 // 发布中
Auditing = 1 // 审核中
Success = 2 // 成功
Failed = 3 // 失败
Disable = 4 //禁用
}
struct PackFailedDetail {
1: i64 entity_id (agw.js_conv="str", api.js_conv="true")
2: common_struct.ResourceType entity_type
3: string entity_name
}
struct GetPublishRecordDetailRequest {
1: required i64 project_id (agw.js_conv="str", api.js_conv="true")
2: optional i64 publish_record_id (agw.js_conv="str", api.js_conv="true") // 不传则获取最近一次发布记录
255: optional base.Base Base (api.none="true")
}
struct GetPublishRecordDetailResponse {
1: PublishRecordDetail data
253: i64 code
254: string msg
255: optional base.BaseResp BaseResp (api.none="true")
}

View File

@@ -0,0 +1,152 @@
include "../base.thrift"
include "common_struct/intelligence_common_struct.thrift"
include "common_struct/common_struct.thrift"
namespace go intelligence
enum OrderBy {
UpdateTime = 0
CreateTime = 1
PublishTime = 2
}
enum OceanProjectOrderBy {
UpdateTime = 0
CreateTime = 1
}
enum SearchScope {
All = 0,
CreateByMe = 1,
}
struct GetDraftIntelligenceListOption {
1: bool need_replica, // 是否需要个人版本Bot数据
}
struct GetDraftIntelligenceListRequest {
1: required i64 space_id (agw.js_conv="str", api.js_conv="true"),
2: optional string name,
3: optional bool has_published,
4: optional list<intelligence_common_struct.IntelligenceStatus> status,
5: optional list<intelligence_common_struct.IntelligenceType> types,
6: optional SearchScope search_scope,
51: optional bool is_fav,
52: optional bool recently_open,
99: optional GetDraftIntelligenceListOption option,
100: optional OrderBy order_by,
101: optional string cursor_id,
102: optional i32 size,
255: optional base.Base Base
}
struct IntelligencePublishInfo {
1: string publish_time,
2: bool has_published,
3: list<common_struct.ConnectorInfo> connectors,
}
struct IntelligencePermissionInfo {
1: bool in_collaboration,
2: bool can_delete, // 当前用户是否可删除
3: bool can_view, // 当前用户是否可查看当前判断逻辑为用户是否在bot所在空间
}
struct FavoriteInfo {
1: bool is_fav, // 是否收藏;收藏列表使用
2: string fav_time, // 收藏时间;收藏列表使用
}
enum BotMode {
SingleMode = 0
MultiMode = 1
WorkflowMode = 2
}
struct OtherInfo {
1: string recently_open_time, // 最近打开时间;最近打开筛选时使用
2: BotMode bot_mode, // 仅bot类型返回
}
struct Intelligence {
1: intelligence_common_struct.IntelligenceBasicInfo basic_info, // 基本信息
2: intelligence_common_struct.IntelligenceType type, // 智能体类型
3: IntelligencePublishInfo publish_info, // 智能体发布信息,可选
4: common_struct.User owner_info, // 智能体所有者信息,可选
5: IntelligencePermissionInfo permission_info, // 当前用户对智能体的权限信息,可选
}
// For前端
struct IntelligenceData {
1: intelligence_common_struct.IntelligenceBasicInfo basic_info,
2: intelligence_common_struct.IntelligenceType type,
3: IntelligencePublishInfo publish_info,
4: IntelligencePermissionInfo permission_info,
5: common_struct.User owner_info,
6: common_struct.AuditInfo latest_audit_info,
7: FavoriteInfo favorite_info,
50: OtherInfo other_info,
}
struct DraftIntelligenceListData {
1: list<IntelligenceData> intelligences,
2: i32 total,
3: bool has_more,
4: string next_cursor_id,
}
struct GetDraftIntelligenceListResponse {
1: DraftIntelligenceListData data,
253: i32 code,
254: string msg,
255: optional base.BaseResp BaseResp (api.none="true"),
}
struct GetDraftIntelligenceInfoRequest {
1: i64 intelligence_id (agw.js_conv="str", api.js_conv="true"),
2: intelligence_common_struct.IntelligenceType intelligence_type,
3: optional i64 version (agw.js_conv="str", api.js_conv="true"), // 预览版本时传入
255: optional base.Base Base
}
struct GetDraftIntelligenceInfoData {
1: intelligence_common_struct.IntelligenceType intelligence_type,
2: intelligence_common_struct.IntelligenceBasicInfo basic_info,
3: optional IntelligencePublishInfo publish_info,
4: optional common_struct.User owner_info,
}
struct GetDraftIntelligenceInfoResponse {
1: GetDraftIntelligenceInfoData data,
253: i32 code,
254: string msg,
255: optional base.BaseResp BaseResp,
}
struct GetUserRecentlyEditIntelligenceRequest {
1: i32 size,
2: optional list<intelligence_common_struct.IntelligenceType> types,
3: optional string enterprise_id, // 企业id
4: optional string organization_id, // 组织id
255: optional base.Base Base
}
struct GetUserRecentlyEditIntelligenceData {
1: list<IntelligenceData> intelligence_info_list,
}
struct GetUserRecentlyEditIntelligenceResponse {
1: GetUserRecentlyEditIntelligenceData data,
253: i32 code,
254: string msg,
255: optional base.BaseResp BaseResp,
}

View File

@@ -0,0 +1,20 @@
include "../base.thrift"
include "common_struct/task_struct.thrift"
struct DraftProjectInnerTaskListRequest {
1 : required i64 project_id (agw.js_conv="str", api.js_conv="true")
255: optional base.Base Base (api.none="true")
}
struct DraftProjectInnerTaskListResponse {
1: DraftProjectInnerTaskListData data
253: required i64 code,
254: required string msg,
255: optional base.BaseResp BaseResp (api.none="true")
}
struct DraftProjectInnerTaskListData {
1: list<task_struct.ProjectInnerTaskInfo> task_list
}

View File

@@ -0,0 +1,26 @@
include "../data_engine/ocean_cloud_memory/table/table.thrift"
include "../data_engine/ocean_cloud_memory/knowledge/kdocument.thrift"
namespace go database
service DatabaseService {
table.ListDatabaseResponse ListDatabase(1: table.ListDatabaseRequest req)(api.post='/api/memory/database/list', api.category="memory",agw.preserve_base="true")
table.SingleDatabaseResponse GetDatabaseByID(1: table.SingleDatabaseRequest req)(api.post='/api/memory/database/get_by_id', api.category="memory",agw.preserve_base="true")
table.SingleDatabaseResponse AddDatabase(1: table.AddDatabaseRequest req)(api.post='/api/memory/database/add', api.category="memory",agw.preserve_base="true")
table.SingleDatabaseResponse UpdateDatabase(1: table.UpdateDatabaseRequest req)(api.post='/api/memory/database/update', api.category="memory",agw.preserve_base="true")
table.DeleteDatabaseResponse DeleteDatabase(1: table.DeleteDatabaseRequest req)(api.post='/api/memory/database/delete', api.category="memory",agw.preserve_base="true")
table.BindDatabaseToBotResponse BindDatabase(1: table.BindDatabaseToBotRequest req)(api.post='/api/memory/database/bind_to_bot', api.category="memory",agw.preserve_base="true")
table.BindDatabaseToBotResponse UnBindDatabase(1: table.BindDatabaseToBotRequest req)(api.post='/api/memory/database/unbind_to_bot', api.category="memory",agw.preserve_base="true")
table.ListDatabaseRecordsResponse ListDatabaseRecords(1: table.ListDatabaseRecordsRequest req)(api.post='/api/memory/database/list_records', api.category="memory",agw.preserve_base="true")
table.UpdateDatabaseRecordsResponse UpdateDatabaseRecords(1: table.UpdateDatabaseRecordsRequest req)(api.post='/api/memory/database/update_records', api.category="memory",agw.preserve_base="true")
table.GetOnlineDatabaseIdResponse GetOnlineDatabaseId(1: table.GetOnlineDatabaseIdRequest req)(api.post='/api/memory/database/get_online_database_id', api.category="memory",agw.preserve_base="true")
table.ResetBotTableResponse ResetBotTable(1: table.ResetBotTableRequest req)(api.post='/api/memory/database/table/reset', api.category="memory",agw.preserve_base="true")
table.GetDatabaseTemplateResponse GetDatabaseTemplate(1:table.GetDatabaseTemplateRequest req)(api.post='/api/memory/database/get_template', api.category="memory",agw.preserve_base="true")
table.GetSpaceConnectorListResponse GetConnectorName(1:table.GetSpaceConnectorListRequest req)(api.post='/api/memory/database/get_connector_name', api.category="memory",agw.preserve_base="true")
table.GetBotTableResponse GetBotDatabase(1: table.GetBotTableRequest req)(api.post='/api/memory/database/table/list_new', api.category="memory",agw.preserve_base="true")
table.UpdateDatabaseBotSwitchResponse UpdateDatabaseBotSwitch(1:table.UpdateDatabaseBotSwitchRequest req)(api.post='/api/memory/database/update_bot_switch', api.category="memory",agw.preserve_base="true")
kdocument.GetTableSchemaInfoResponse GetDatabaseTableSchema(1:table.GetTableSchemaRequest req)(api.post='/api/memory/table_schema/get', api.category="memory",agw.preserve_base="true")
table.ValidateTableSchemaResponse ValidateDatabaseTableSchema(1:table.ValidateTableSchemaRequest req)(api.post='/api/memory/table_schema/validate', api.category="memory",agw.preserve_base="true")
table.SubmitDatabaseInsertResponse SubmitDatabaseInsertTask(1:table.SubmitDatabaseInsertRequest req)(api.post='/api/memory/table_file/submit', api.category="memory",agw.preserve_base="true")
table.GetDatabaseFileProgressResponse DatabaseFileProgressData(1:table.GetDatabaseFileProgressRequest req)(api.post='/api/memory/table_file/get_progress', api.category="memory",agw.preserve_base="true")
}

View File

@@ -0,0 +1,128 @@
namespace go passport
struct AppUserInfo {
1: required string user_unique_name
}
struct User {
// 与原接口字段名对齐
1: required i64 user_id_str (agw.js_conv="str", api.js_conv="true")
2: required string name
3: required string user_unique_name
4: required string email
5: required string description
6: required string avatar_url
7: optional string screen_name
8: optional AppUserInfo app_user_info
9: optional string locale
10: i64 user_create_time // unix timestamp in seconds
}
struct PassportWebEmailRegisterV2PostRequest {
11: required string password
23: string email
}
struct PassportWebEmailRegisterV2PostResponse {
1: required User data
253: required i32 code
254: required string msg
}
struct PassportWebLogoutGetRequest {
}
struct PassportWebLogoutGetResponse {
1: required string redirect_url
253: required i32 code
254: required string msg
}
struct PassportWebEmailLoginPostRequest {
6: required string email
7: required string password
}
struct PassportWebEmailLoginPostResponse {
1: required User data
253: required i32 code
254: required string msg
}
struct PassportWebEmailPasswordResetGetRequest {
1: string password
2: string code
3: string email
}
struct PassportWebEmailPasswordResetGetResponse {
253: required i32 code
254: required string msg
}
struct PassportAccountInfoV2Request {}
struct PassportAccountInfoV2Response {
1: required User data
253: required i32 code
254: required string msg
}
struct UserUpdateAvatarRequest {
3: required binary avatar (api.form="avatar")
}
struct UserUpdateAvatarResponseData {
1: required string web_uri
}
struct UserUpdateAvatarResponse {
1: required UserUpdateAvatarResponseData data
253: required i32 code
254: required string msg
}
struct UserUpdateProfileRequest {
2: optional string name
3: optional string user_unique_name
5: optional string description
6: optional string locale
}
struct UserUpdateProfileResponse {
253: required i32 code
254: required string msg
}
service PassportService {
// 邮箱密码注册
PassportWebEmailRegisterV2PostResponse PassportWebEmailRegisterV2Post(1: PassportWebEmailRegisterV2PostRequest req) (api.post="/api/passport/web/email/register/v2/")
// 退出登录
PassportWebLogoutGetResponse PassportWebLogoutGet(1: PassportWebLogoutGetRequest req) (api.get="/api/passport/web/logout/")
// 邮箱帐密登录
PassportWebEmailLoginPostResponse PassportWebEmailLoginPost(1: PassportWebEmailLoginPostRequest req) (api.post="/api/passport/web/email/login/")
// 通过邮箱重置密码
PassportWebEmailPasswordResetGetResponse PassportWebEmailPasswordResetGet(1: PassportWebEmailPasswordResetGetRequest req) (api.get="/api/passport/web/email/password/reset/")
// 账号信息
PassportAccountInfoV2Response PassportAccountInfoV2(1: PassportAccountInfoV2Request req) (api.post="/api/passport/account/info/v2/")
UserUpdateAvatarResponse UserUpdateAvatar(1: UserUpdateAvatarRequest req) (api.post="/api/web/user/update/upload_avatar/", api.serializer="form")
UserUpdateProfileResponse UserUpdateProfile(1: UserUpdateProfileRequest req) (api.post="/api/user/update_profile")
}

View File

@@ -0,0 +1,115 @@
include "../base.thrift"
namespace go permission.openapiauth
typedef string PatSearchOption
const PatSearchOption all = "all"
const PatSearchOption others = "others"
const PatSearchOption owned = "owned"
typedef string UserStatus
const UserStatus active = "active"
const UserStatus deactivated = "deactivated"
const UserStatus offboarded = "offboarded"
struct CreatePersonalAccessTokenAndPermissionRequest {
1: required string name // PAT名称
2: i64 expire_at // PAT自定义过期时间
3: string duration_day // PAT用户枚举过期时间 1、30、60、90、180、365、permanent
4: string organization_id // organization id
}
struct PersonalAccessToken {
1: required i64 id (api.js_conv="true")
2: required string name
3: required i64 created_at
4: required i64 updated_at
5: required i64 last_used_at // -1 表示未使用
6: required i64 expire_at // -1 表示无限期
}
struct CreatePersonalAccessTokenAndPermissionResponseData {
1: required PersonalAccessToken personal_access_token
2: required string token // PAT token 明文
}
struct CreatePersonalAccessTokenAndPermissionResponse {
1: required CreatePersonalAccessTokenAndPermissionResponseData data
2: required i32 code
3: required string msg
}
struct ListPersonalAccessTokensRequest {
1: optional string organization_id (api.query="organization_id") // organization id
2: optional i64 page (api.query="page") // zero-indexed
3: optional i64 size (api.query="size") // page size
4: optional PatSearchOption search_option (api.query="search_option") // search option
}
struct PersonalAccessTokenWithCreatorInfo {
1: required i64 id (api.js_conv="true")
2: required string name
3: required i64 created_at
4: required i64 updated_at
5: required i64 last_used_at // -1 表示未使用
6: required i64 expire_at // -1 表示无限期
7: string creator_name
8: string creator_unique_name
9: string creator_avatar_url
10: string creator_icon_url
11: bool locked
12: UserStatus creator_status
}
struct ListPersonalAccessTokensResponse {
1: required ListPersonalAccessTokensResponseData data
2: required i32 code
3: required string msg
}
struct ListPersonalAccessTokensResponseData {
1: required list<PersonalAccessTokenWithCreatorInfo> personal_access_tokens // PAT 列表
2: bool has_more // 是否还有更多数据
}
struct DeletePersonalAccessTokenAndPermissionRequest {
1: required i64 id (api.js_conv="true")// PAT Id
}
struct DeletePersonalAccessTokenAndPermissionResponse {
1: required i32 code
2: required string msg
}
struct GetPersonalAccessTokenAndPermissionRequest {
1: required i64 id (api.query="id", api.js_conv="true") // PAT Id
}
struct GetPersonalAccessTokenAndPermissionResponseData {
1: required PersonalAccessToken personal_access_token
}
struct GetPersonalAccessTokenAndPermissionResponse {
1: required GetPersonalAccessTokenAndPermissionResponseData data
2: required i32 code
3: required string msg
}
struct UpdatePersonalAccessTokenAndPermissionRequest {
1: required i64 id (api.js_conv="true") // PAT Id
2: string name // PAT 名称
}
struct UpdatePersonalAccessTokenAndPermissionResponse {
1: required i32 code
2: required string msg
}

View File

@@ -0,0 +1,13 @@
include "../base.thrift"
include "./openapiauth.thrift"
namespace go permission.openapiauth
service OpenAPIAuthService {
openapiauth.GetPersonalAccessTokenAndPermissionResponse GetPersonalAccessTokenAndPermission (1: openapiauth.GetPersonalAccessTokenAndPermissionRequest req) (api.get="/api/permission_api/pat/get_personal_access_token_and_permission")
openapiauth.DeletePersonalAccessTokenAndPermissionResponse DeletePersonalAccessTokenAndPermission (1: openapiauth.DeletePersonalAccessTokenAndPermissionRequest req) (api.post="/api/permission_api/pat/delete_personal_access_token_and_permission")
openapiauth.ListPersonalAccessTokensResponse ListPersonalAccessTokens (1: openapiauth.ListPersonalAccessTokensRequest req) (api.get="/api/permission_api/pat/list_personal_access_tokens")
openapiauth.CreatePersonalAccessTokenAndPermissionResponse CreatePersonalAccessTokenAndPermission (1: openapiauth.CreatePersonalAccessTokenAndPermissionRequest req) (api.post="/api/permission_api/pat/create_personal_access_token_and_permission")
openapiauth.UpdatePersonalAccessTokenAndPermissionResponse UpdatePersonalAccessTokenAndPermission (1: openapiauth.UpdatePersonalAccessTokenAndPermissionRequest req) (api.post="/api/permission_api/pat/update_personal_access_token_and_permission")
}

View File

@@ -0,0 +1,514 @@
include "../base.thrift"
include "../bot_common/bot_common.thrift"
include "shortcut_command.thrift"
include "prompt_resource.thrift"
namespace go ocean.cloud.playground
struct UpdateDraftBotInfoAgwResponse {
1: required UpdateDraftBotInfoAgwData data,
253: required i64 code,
254: required string msg,
255: required base.BaseResp BaseResp (api.none="true")
}
struct UpdateDraftBotInfoAgwData {
1: optional bool has_change // 是否有变更
2: bool check_not_pass // true机审校验不通过
3: optional Branch branch // 当前是在哪个分支
4: optional bool same_with_online
5: optional string check_not_pass_msg // 机审校验不通过文案
}
// 分支
enum Branch {
Undefined = 0
PersonalDraft = 1 // 草稿
Base = 2 // space草稿
Publish = 3 // 线上版本,diff场景下使用
}
struct UpdateDraftBotInfoAgwRequest {
1: optional bot_common.BotInfoForUpdate bot_info
2: optional i64 base_commit_version (api.js_conv='true',agw.js_conv="str")
255: base.Base Base (api.none="true")
}
struct GetDraftBotInfoAgwRequest {
1: required i64 bot_id (api.js_conv='true',agw.js_conv="str") // 草稿bot_id
2: optional string version // 查历史记录历史版本的id对应 bot_draft_history的id
3: optional string commit_version // 查询指定commit_version版本预发布使用貌似和version是同一个东西但是获取逻辑有区别
255: base.Base Base (api.none="true")
}
struct GetDraftBotInfoAgwResponse {
1: required GetDraftBotInfoAgwData data,
253: required i64 code,
254: required string msg,
255: required base.BaseResp BaseResp (api.none="true")
}
struct GetDraftBotInfoAgwData {
1: required bot_common.BotInfo bot_info // 核心bot数据
2: optional BotOptionData bot_option_data // bot选项信息
3: optional bool has_unpublished_change // 是否有未发布的变更
4: optional BotMarketStatus bot_market_status // bot上架后的商品状态
5: optional bool in_collaboration // bot是否处于多人协作模式
6: optional bool same_with_online // commit内容是否和线上内容一致
7: optional bool editable // for前端权限相关当前用户是否可编辑此bot
8: optional bool deletable // for前端权限相关当前用户是否可删除此bot
9: optional UserInfo publisher // 是最新发布版本时传发布人
10: bool has_publish // 是否已发布
11: i64 space_id (api.js_conv='true',agw.js_conv="str") // 空间id
12: list<BotConnectorInfo> connectors // 发布的业务线详情
13: optional Branch branch // 获取的是什么分支的内容
14: optional string commit_version // 如果branch=PersonalDraft则为checkout/rebase的版本号如果branch=base则为提交的版本
15: optional string committer_name // for前端最近一次的提交人
16: optional string commit_time // for前端提交时间
17: optional string publish_time // for前端发布时间
18: optional BotCollaboratorStatus collaborator_status // 多人协作相关操作权限
19: optional AuditInfo latest_audit_info // 最近一次审核详情
20: optional string app_id // 抖音分身的bot会有appId
}
struct BotOptionData {
1: optional map<i64,ModelDetail> model_detail_map // 模型详情
2: optional map<i64,PluginDetal> plugin_detail_map // 插件详情
3: optional map<i64,PluginAPIDetal> plugin_api_detail_map // 插件API详情
4: optional map<i64,WorkflowDetail> workflow_detail_map // workflow详情
5: optional map<string,KnowledgeDetail> knowledge_detail_map // knowledge详情
6: optional list<shortcut_command.ShortcutCommand> shortcut_command_list // 快捷指令list
}
struct ModelDetail {
1: optional string name // 模型展示名(对用户)
2: optional string model_name // 模型名(对内部)
3: optional i64 model_id (agw.js_conv="str" api.js_conv="true") // 模型ID
4: optional i64 model_family // 模型类别
5: optional string model_icon_url // IconURL
}
struct PluginDetal {
1: optional i64 id (agw.js_conv="str" api.js_conv="true")
2: optional string name
3: optional string description
4: optional string icon_url
5: optional i64 plugin_type (agw.js_conv="str" api.js_conv="true")
6: optional i64 plugin_status (agw.js_conv="str" api.js_conv="true")
7: optional bool is_official
}
struct PluginAPIDetal {
1: optional i64 id (agw.js_conv="str" api.js_conv="true")
2: optional string name
3: optional string description
4: optional list<PluginParameter> parameters
5: optional i64 plugin_id (agw.js_conv="str" api.js_conv="true")
}
struct PluginParameter {
1: optional string name
2: optional string description
3: optional bool is_required
4: optional string type
5: optional list<PluginParameter> sub_parameters
6: optional string sub_type // 如果Type是数组则有subtype
7: optional i64 assist_type
}
struct WorkflowDetail {
1: optional i64 id (agw.js_conv="str" api.js_conv="true")
2: optional string name
3: optional string description
4: optional string icon_url
5: optional i64 status
6: optional i64 type // 类型1:官方模版
7: optional i64 plugin_id (agw.js_conv="str" api.js_conv="true") // workfklow对应的插件id
8: optional bool is_official
9: optional PluginAPIDetal api_detail
}
struct KnowledgeDetail {
1: optional string id
2: optional string name
3: optional string icon_url
4: DataSetType format_type
}
enum DataSetType {
Text = 0 // 文本
Table = 1 // 表格
Image = 2 // 图片
}
enum BotMarketStatus {
Offline = 0 // 下架
Online = 1 // 上架
}
struct UserInfo {
1: i64 user_id (api.js_conv='true',agw.js_conv="str") // 用户id
2: string name // 用户名称
3: string icon_url // 用户图标
}
struct BotConnectorInfo {
1: string id
2: string name
3: string icon
4: ConnectorDynamicStatus connector_status
5: optional string share_link
}
enum ConnectorDynamicStatus {
Normal = 0
Offline = 1
TokenDisconnect = 2
}
struct BotCollaboratorStatus {
1: bool commitable // 当前用户是否可以提交
2: bool operateable // 当前用户是否可运维
3: bool manageable // 当前用户是否可管理协作者
}
struct AuditInfo {
1: optional AuditStatus audit_status
2: optional string publish_id
3: optional string commit_version
}
struct AuditResult {
1: AuditStatus AuditStatus ,
2: string AuditMessage,
}
enum AuditStatus {
Auditing = 0, // 审核中
Success = 1, // 审核通过
Failed = 2, // 审核失败
}
// Onboarding json结构
struct OnboardingContent {
1: optional string prologue // 开场白C端使用场景只有1个后台场景可能为多个
2: optional list<string> suggested_questions // 建议问题
3: optional bot_common.SuggestedQuestionsShowMode suggested_questions_show_mode
}
enum ScopeType {
All = 0 // 企业下所有的(企业下生效)
Self = 1 // 我加入的(企业&个人都生效不传默认Self
}
struct GetSpaceListV2Request {
1: optional string search_word // 搜索词
2: optional i64 enterprise_id (api.js_conv='true',agw.js_conv="str") // 企业id
3: optional i64 organization_id (api.js_conv='true',agw.js_conv="str") // 组织id
4: optional ScopeType scope_type // 范围类型
5: optional i32 page // 分页信息
6: optional i32 size // 分页大小 -- page 和 size不传则认为不分页
255: optional base.Base Base (api.none="true")
}
enum SpaceType {
Personal = 1 // 个人
Team = 2 // 小组
}
enum SpaceMode {
Normal = 0
DevMode = 1
}
enum SpaceTag {
Professional = 1 // 专业版
}
enum SpaceRoleType {
Default = 0 // 默认
Owner = 1 // owner
Admin = 2 // 管理员
Member = 3 // 普通成员
}
// 申请管理列表
enum SpaceApplyStatus {
All = 0 // 所有
Joined = 1 // 已加入
Confirming = 2 // 确认中
Rejected = 3 // 已拒绝
}
struct AppIDInfo{
1: string id
2: string name
3: string icon
}
struct ConnectorInfo{
1: string id
2: string name
3: string icon
}
struct BotSpaceV2 {
1: i64 id (api.js_conv='true',agw.js_conv="str") // 空间id新建为0
2: list<AppIDInfo> app_ids // 发布平台
3: string name // 空间名称
4: string description // 空间描述
5: string icon_url // 图标url
6: SpaceType space_type // 空间类型
7: list<ConnectorInfo> connectors // 发布平台
8: bool hide_operation // 是否隐藏新建,复制删除按钮
9: i32 role_type // 在team中的角色 1-owner 2-admin 3-member
10: optional SpaceMode space_mode // 空间模式
11: bool display_local_plugin // 是否显示端侧插件创建入口
12: SpaceRoleType space_role_type // 角色类型,枚举
13: optional SpaceTag space_tag // 空间标签
14: optional i64 enterprise_id (api.js_conv='true',agw.js_conv="str") // 企业id
15: optional i64 organization_id (api.js_conv='true',agw.js_conv="str") // 组织id
16: optional i64 owner_user_id (api.js_conv='true',agw.js_conv="str") // 空间owner uid
17: optional string owner_name // 空间owner昵称
18: optional string owner_user_name // 空间owner用户名
19: optional string owner_icon_url // 空间owner图像
20: optional SpaceApplyStatus space_apply_status // 当前访问用户加入空间状态
21: optional i64 total_member_num // 空间成员总数,只有组织空间才查询
}
struct SpaceInfo {
1: list<BotSpaceV2> bot_space_list // 用户加入空间列表
2: bool has_personal_space // 是否有个人空间
3: i32 team_space_num // 个人创建team空间数量
4: i32 max_team_space_num // 个人最大能创建的空间数量
5: list<BotSpaceV2> recently_used_space_list // 最近使用空间列表
6: optional i32 total // 分页时生效
7: optional bool has_more // 分页时生效
}
struct GetSpaceListV2Response {
1: SpaceInfo data
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct GetImagexShortUrlResponse{
1 : GetImagexShortUrlData data
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp (api.none="true")
}
struct GetImagexShortUrlData {
1: map<string,UrlInfo> url_info //审核状态key urivalue url 和 审核状态
}
struct UrlInfo {
1: string url
2: bool review_status
}
enum GetImageScene {
Onboarding = 0
BackgroundImage = 1
}
struct GetImagexShortUrlRequest{
1: list<string> uris
2: GetImageScene scene
255: base.Base Base (api.none="true"),
}
struct UserBasicInfo {
1: required i64 UserId (api.js_conv='true',agw.js_conv="str", api.body="user_id")
3: required string Username (api.body="user_name") // 昵称
4: required string UserAvatar (api.body="user_avatar") // 头像
5: optional string UserUniqueName (api.body="user_unique_name") // 用户名
6: optional bot_common.UserLabel UserLabel (api.body="user_label") // 用户标签
7: optional i64 CreateTime (api.body="create_time") // 用户创建时间
}
struct MGetUserBasicInfoRequest {
1 : required list<string> UserIds (agw.js_conv="str", api.js_conv="true", api.body="user_ids")
2 : optional bool NeedUserStatus (api.body="need_user_status")
3 : optional bool NeedEnterpriseIdentity (api.body="need_enterprise_identity") // 是否需要企业认证信息前端通过AGW调用时默认为true
4 : optional bool NeedVolcanoUserName (api.body="need_volcano_user_name") // 是否需要火山用户名
255: optional base.Base Base (api.none="true")
}
struct MGetUserBasicInfoResponse {
1 : optional map<string, UserBasicInfo> UserBasicInfoMap (api.body="id_user_info_map")
253: i64 code
254: string msg
255: optional base.BaseResp BaseResp (api.none="true")
}
struct GetBotPopupInfoRequest {
1: required list<BotPopupType> bot_popup_types
2: required i64 bot_id (agw.js_conv="str" api.js_conv="true")
255: base.Base Base (api.none="true")
}
struct GetBotPopupInfoResponse {
1: required BotPopupInfoData data
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp (api.none="true")
}
struct BotPopupInfoData {
1: required map<BotPopupType,i64> bot_popup_count_info
}
enum BotPopupType {
AutoGenBeforePublish = 1
}
struct UpdateBotPopupInfoResponse {
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp (api.none="true")
}
struct UpdateBotPopupInfoRequest {
1: required BotPopupType bot_popup_type
2: required i64 bot_id (agw.js_conv="str" api.js_conv="true")
255: base.Base Base (api.none="true")
}
struct ReportUserBehaviorRequest {
1: required i64 ResourceID (api.body = "resource_id",api.js_conv="true")
2: required SpaceResourceType ResourceType (api.body="resource_type")
3: required BehaviorType BehaviorType (api.body="behavior_type")
4: optional i64 SpaceID (agw.js_conv="str",api.js_conv="true",api.body="space_id",agw.key="space_id") // 本需求必传
255: base.Base Base (api.none="true")
}
struct ReportUserBehaviorResponse {
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
enum SpaceResourceType {
DraftBot = 1
Project = 2
Space = 3
DouyinAvatarBot = 4
}
enum BehaviorType {
Visit = 1
Edit = 2
}
struct FileInfo {
1 : string url
2 : string uri
}
enum GetFileUrlsScene {
shorcutIcon = 1
}
struct GetFileUrlsRequest {
1 : GetFileUrlsScene scene
255: base.Base Base
}
struct GetFileUrlsResponse {
1 : list<FileInfo> file_list
253: i64 code
254: string msg
255: base.BaseResp BaseResp
}
struct UploadFileOpenRequest {
1: required string ContentType (api.header = "Content-Type", agw.source = "header", agw.key = "Content-Type"), // 文件类型
2: required binary Data (api.raw_body = ""), // 二进制数据
255: base.Base Base
}
struct UploadFileOpenResponse {
1: optional File File (api.body = "data")
253: required i64 code
254: required string msg
255: base.BaseResp BaseResp
}
struct File{
1: string URI (api.body = "uri"), // 文件URI
2: i64 Bytes (api.body = "bytes"), // 文件字节数
3: i64 CreatedAt (agw.key = "created_at"), // 上传时间戳单位s
4: string FileName (api.body = "file_name"), // 文件名
5: string URL (api.body = "url")
}
struct GetBotOnlineInfoReq {
1 : required i64 bot_id (api.js_conv="true") // botId
2: optional string connector_id // 先保留,不暴露且不使用该字段
3 : optional string version // bot版本不传则获取最新版本
}
// resp
struct GetBotOnlineInfoResp {
1: required i32 code
2: required string msg
3: required bot_common.OpenAPIBotInfo data
}
service PlaygroundService {
UpdateDraftBotInfoAgwResponse UpdateDraftBotInfoAgw(1:UpdateDraftBotInfoAgwRequest request)(api.post='/api/playground_api/draftbot/update_draft_bot_info', api.category="draftbot",agw.preserve_base="true")
GetDraftBotInfoAgwResponse GetDraftBotInfoAgw(1:GetDraftBotInfoAgwRequest request)(api.post='/api/playground_api/draftbot/get_draft_bot_info', api.category="draftbot",agw.preserve_base="true")
GetImagexShortUrlResponse GetImagexShortUrl (1:GetImagexShortUrlRequest request)(api.post='/api/playground_api/get_imagex_url', api.category="file",agw.preserve_base="true")
// public popup_info
GetBotPopupInfoResponse GetBotPopupInfo (1:GetBotPopupInfoRequest request)(api.post='/api/playground_api/operate/get_bot_popup_info', api.category="account",agw.preserve_base="true")
UpdateBotPopupInfoResponse UpdateBotPopupInfo (1:UpdateBotPopupInfoRequest request)(api.post='/api/playground_api/operate/update_bot_popup_info', api.category="account",agw.preserve_base="true")
ReportUserBehaviorResponse ReportUserBehavior(1:ReportUserBehaviorRequest request)(api.post='/api/playground_api/report_user_behavior', api.category="playground_api",agw.preserve_base="true")
// 创建快捷指令
shortcut_command.CreateUpdateShortcutCommandResponse CreateUpdateShortcutCommand(1: shortcut_command.CreateUpdateShortcutCommandRequest req)(api.post='/api/playground_api/create_update_shortcut_command', api.category="playground_api", agw.preserve_base="true")
GetFileUrlsResponse GetFileUrls(1: GetFileUrlsRequest req)(api.post='/api/playground_api/get_file_list', api.category="playground_api", agw.preserve_base="true")
// prompt resource
prompt_resource.GetOfficialPromptResourceListResponse GetOfficialPromptResourceList(1:prompt_resource.GetOfficialPromptResourceListRequest request)(api.post='/api/playground_api/get_official_prompt_list', api.category="prompt_resource",agw.preserve_base="true")
prompt_resource.GetPromptResourceInfoResponse GetPromptResourceInfo(1:prompt_resource.GetPromptResourceInfoRequest request)(api.get='/api/playground_api/get_prompt_resource_info', api.category="prompt_resource",agw.preserve_base="true")
prompt_resource.UpsertPromptResourceResponse UpsertPromptResource(1:prompt_resource.UpsertPromptResourceRequest request)(api.post='/api/playground_api/upsert_prompt_resource', api.category="prompt_resource",agw.preserve_base="true")
prompt_resource.DeletePromptResourceResponse DeletePromptResource(1:prompt_resource.DeletePromptResourceRequest request)(api.post='/api/playground_api/delete_prompt_resource', api.category="prompt_resource",agw.preserve_base="true")
GetSpaceListV2Response GetSpaceListV2(1:GetSpaceListV2Request request)(api.post='/api/playground_api/space/list', api.category="space",agw.preserve_base="true")
MGetUserBasicInfoResponse MGetUserBasicInfo(1: MGetUserBasicInfoRequest request) (api.post='/api/playground_api/mget_user_info', api.category="playground_api",agw.preserve_base="true")
//openapi
GetBotOnlineInfoResp GetBotOnlineInfo(1: GetBotOnlineInfoReq request)(api.get='/v1/bot/get_online_info', api.category="bot", api.tag="openapi", api.gen_path="personal_api")
// File 相关 OpenAPI
UploadFileOpenResponse UploadFileOpen(1: UploadFileOpenRequest request)(api.post = "/v1/files/upload", api.category="file", api.tag="openapi", agw.preserve_base="true")
}

View File

@@ -0,0 +1,130 @@
namespace go ocean.cloud.playground
include "../base.thrift"
struct GetOfficialPromptResourceListRequest {
1: optional string Keyword (api.body = "keyword")
255: base.Base Base (api.none="true")
}
struct PromptResource {
1: optional i64 ID (agw.js_conv="str",api.js_conv="true",api.body="id")
2: optional i64 SpaceID (agw.js_conv="str",api.js_conv="true",api.body="space_id")
3: optional string Name (api.body="name")
4: optional string Description (api.body="description")
5: optional string PromptText (api.body="prompt_text")
}
struct GetOfficialPromptResourceListResponse {
1: list<PromptResource> PromptResourceList (api.body="data")
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct GetPromptResourceInfoRequest {
1: required i64 PromptResourceID (agw.js_conv="str",api.js_conv="true",api.body="prompt_resource_id")
255: base.Base Base (api.none="true")
}
struct GetPromptResourceInfoResponse {
1: optional PromptResource Data (api.body="data")
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct UpsertPromptResourceRequest {
1: required PromptResource Prompt (api.body="prompt")
255: base.Base Base (api.none="true")
}
struct UpsertPromptResourceResponse {
1: optional ShowPromptResource data
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
struct ShowPromptResource {
1: i64 ID (agw.js_conv="str",api.js_conv="true",api.body="id")
}
struct DeletePromptResourceRequest {
1: required i64 PromptResourceID (agw.js_conv="str",api.js_conv="true",api.body="prompt_resource_id")
255: base.Base Base (api.none="true")
}
struct DeletePromptResourceResponse {
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}
// 参数优先级从上往下
struct SyncPromptResourceToEsRequest {
1: optional bool SyncAll
2: optional list<i64> PromptResourceIDList
3: optional list<i64> SpaceIDList
255: base.Base Base
}
struct SyncPromptResourceToEsResponse {
255: required base.BaseResp BaseResp
}
struct MGetDisplayResourceInfoRequest {
1 : list<i64> ResIDs, // 最大传一页的数量实现方可以限制最大100个
2 : i64 CurrentUserID, // 当前的用户,实现方用于判断权限
255: base.Base Base ,
}
struct MGetDisplayResourceInfoResponse {
1 : list<DisplayResourceInfo> ResourceList,
255: required base.BaseResp BaseResp,
}
enum ActionKey{
Copy = 1, //复制
Delete = 2, //删除
EnableSwitch = 3, //启用/禁用
Edit = 4, //编辑
CrossSpaceCopy = 10, // 跨空间复制
}
struct ResourceAction{
// 一个操作对应一个唯一的keykey由资源侧约束
1 : required ActionKey Key (go.tag = "json:\"key\""),
//ture=可以操作该Actionfalse=置灰
2 : required bool Enable (go.tag = "json:\"enable\""),
}
// 展示用,实现方提供展示信息
struct DisplayResourceInfo{
1 : optional i64 ResID, // 资源id
5 : optional string Desc,// 资源描述
6 : optional string Icon,// 资源Icon完整url
12 : optional i32 BizResStatus, // 资源状态,各类型资源自身定义
13 : optional bool CollaborationEnable, // 是否开启多人编辑
16 : optional map<string, string> BizExtend, // 业务携带的扩展信息以res_type区分每个res_type定义的schema和含义不一样使用前需要判断res_type
17 : optional list<ResourceAction> Actions, // 不同类型的不同操作按钮,由资源实现方和前端约定。返回则展示,要隐藏某个按钮,则不要返回;
18 : optional bool DetailDisable, // 是否禁止进详情页
19 : optional string Name // 资源名称
20 : optional ResourcePublishStatus PublishStatus, // 资源发布状态1-未发布2-已发布
21 : optional i64 EditTime, // 最近编辑时间, unix秒级时间戳
}
enum ResourcePublishStatus{
UnPublished = 1, //未发布
Published = 2, //已发布
}

View File

@@ -0,0 +1,119 @@
namespace go ocean.cloud.playground
include "../base.thrift"
struct CreateShortcutCommandRequest {
1: string object_id
2: ShortcutCommand shortcuts
255: base.Base Base
}
struct CreateShortcutCommandResponse {
1: ShortcutCommand shortcuts
255: required base.BaseResp BaseResp
}
struct ShortcutStruct {
16: optional list<string> shortcut_sort // 快捷指令ID列表 实体上绑定的
17: optional list<ShortcutCommand> shortcut_list // 快捷指令内容list
}
struct ShortcutCommand {
2 : i64 object_id (api.js_conv="true") // 绑定实体ID
3 : string command_name // 命令名称
4 : string shortcut_command // 快捷指令
5 : string description // 描述
6 : SendType send_type // 发送类型
7 : ToolType tool_type // 使用工具type
8 : string work_flow_id
9 : string plugin_id
10: string plugin_api_name
11 : string template_query // 模板query
12 : list<Components> components_list // panel参数
15 : string card_schema // 表单的schema
16 : i64 command_id (api.js_conv="true") // 指令ID
17 : ToolInfo tool_info //工具信息 包含name+变量列表+...
18 : ShortcutFileInfo shortcut_icon // 指令图标
21 : optional string agent_id //multi的指令时该指令由哪个节点执行
22 : i64 plugin_api_id (api.js_conv="true")
}
struct ShortcutFileInfo {
1 : string url
2 : string uri
}
struct Components { // panel参数
1 : string name
2 : string description
3 : InputType input_type
4 : string parameter // 请求工具时参数的key
5 : list<string> options
6 : DefaultValue default_value
7 : bool hide // 是否隐藏不展示
8 : list<InputType> upload_options // input_type为MixUpload时支持哪些类型
}
struct DefaultValue {
1: string value
2: InputType type
}
struct ToolInfo {
1:string tool_name
2:list<ToolParams> tool_params_list // 变量列表 插件&workFLow
}
struct ToolParams { // 参数列表
1 : string name
2 : bool required
3 : string desc
4 : string type
6 : string default_value // 默认值
8 : bool refer_component // 是否是panel参数
}
enum SendType {
SendTypeQuery = 0 // 直接发query
SendTypePanel = 1 // 使用面板
}
enum ToolType {
ToolTypeWorkFlow = 1 // 使用WorkFlow
ToolTypePlugin = 2 // 使用插件
}
enum InputType {
TextInput = 0,
Select = 1,
UploadImage = 2,
UploadDoc = 3,
UploadTable = 4,
UploadAudio = 5,
MixUpload = 6,
VIDEO = 7,
ARCHIVE = 8,
CODE = 9,
TXT = 10,
PPT = 11,
}
struct CreateUpdateShortcutCommandRequest {
1: required i64 object_id (api.js_conv="true")
2: required i64 space_id (api.js_conv="true")
3: required ShortcutCommand shortcuts
255: base.Base Base
}
struct CreateUpdateShortcutCommandResponse {
1: ShortcutCommand shortcuts
253: required i64 code
254: required string msg
255: required base.BaseResp BaseResp
}

View File

@@ -0,0 +1,625 @@
include "../base.thrift"
include "./plugin_develop_common.thrift"
namespace go ocean.cloud.plugin_develop
service PluginDevelopService {
GetOAuthSchemaResponse GetOAuthSchema(1: GetOAuthSchemaRequest request)(api.post='/api/plugin/get_oauth_schema', api.category="plugin", api.gen_path="plugin")
GetOAuthSchemaResponse GetOAuthSchemaAPI(1: GetOAuthSchemaRequest request)(api.post='/api/plugin_api/get_oauth_schema', api.category="plugin", api.gen_path='plugin')
// 获取已发布 workflow、plugin 列表,或者多个插件的详情
GetPlaygroundPluginListResponse GetPlaygroundPluginList(1: GetPlaygroundPluginListRequest request) (api.post = '/api/plugin_api/get_playground_plugin_list', api.category = "plugin")
// 通过 code 创建插件
RegisterPluginResponse RegisterPlugin(1: RegisterPluginRequest request)(api.post='/api/plugin_api/register', api.category="plugin", api.gen_path="plugin", agw.preserve_base="true")
// 通过 UI 创建插件
RegisterPluginMetaResponse RegisterPluginMeta(1: RegisterPluginMetaRequest request) (api.post = '/api/plugin_api/register_plugin_meta', api.category = "plugin")
// 获取插件工具列表,或者多个工具详情
GetPluginAPIsResponse GetPluginAPIs(1: GetPluginAPIsRequest request) (api.post = '/api/plugin_api/get_plugin_apis', api.category = "plugin")
// 获取插件详情
GetPluginInfoResponse GetPluginInfo(1: GetPluginInfoRequest request) (api.post = '/api/plugin_api/get_plugin_info', api.category = "plugin")
// 与最近一次发布版本相比,更新的工具列表
GetUpdatedAPIsResponse GetUpdatedAPIs(1: GetUpdatedAPIsRequest request) (api.post = '/api/plugin_api/get_updated_apis', api.category = "plugin")
GetOAuthStatusResponse GetOAuthStatus(1: GetOAuthStatusRequest request)(api.post='/api/plugin_api/get_oauth_status', api.category="plugin", api.gen_path="plugin")
CheckAndLockPluginEditResponse CheckAndLockPluginEdit(1: CheckAndLockPluginEditRequest request)(api.post='/api/plugin_api/check_and_lock_plugin_edit', api.category="plugin", api.gen_path="plugin", )
UnlockPluginEditResponse UnlockPluginEdit(1: UnlockPluginEditRequest request)(api.post='/api/plugin_api/unlock_plugin_edit', api.category="plugin", api.gen_path="plugin")
// 通过 code 更新插件
UpdatePluginResponse UpdatePlugin(1: UpdatePluginRequest request) (api.post = '/api/plugin_api/update', api.category = "plugin")
// 删除工具
DeleteAPIResponse DeleteAPI(1: DeleteAPIRequest request) (api.post = '/api/plugin_api/delete_api', api.category = "plugin", api.gen_path = 'plugin')
// 删除插件
DelPluginResponse DelPlugin(1: DelPluginRequest request) (api.post = '/api/plugin_api/del_plugin', api.category = "plugin", api.gen_path = 'plugin')
// 发布插件
PublishPluginResponse PublishPlugin(1: PublishPluginRequest request) (api.post = '/api/plugin_api/publish_plugin', api.category = "plugin")
// 通过UI更新插件
UpdatePluginMetaResponse UpdatePluginMeta(1: UpdatePluginMetaRequest request) (api.post = '/api/plugin_api/update_plugin_meta', api.category = "plugin")
GetBotDefaultParamsResponse GetBotDefaultParams(1: GetBotDefaultParamsRequest request) (api.post = '/api/plugin_api/get_bot_default_params', api.category = "plugin")
UpdateBotDefaultParamsResponse UpdateBotDefaultParams(1: UpdateBotDefaultParamsRequest request) (api.post = '/api/plugin_api/update_bot_default_params', api.category = "plugin")
// 创建工具
CreateAPIResponse CreateAPI(1: CreateAPIRequest request) (api.post = '/api/plugin_api/create_api', api.category = "plugin", api.gen_path = 'plugin')
// 更新工具
UpdateAPIResponse UpdateAPI(1: UpdateAPIRequest request) (api.post = '/api/plugin_api/update_api', api.category = "plugin", api.gen_path = 'plugin')
GetUserAuthorityResponse GetUserAuthority(1: GetUserAuthorityRequest request)(api.post='/api/plugin_api/get_user_authority', api.category="plugin", api.gen_path="plugin")
DebugAPIResponse DebugAPI(1: DebugAPIRequest request)(api.post='/api/plugin_api/debug_api', api.category="plugin", api.gen_path='plugin')
GetPluginNextVersionResponse GetPluginNextVersion(1: GetPluginNextVersionRequest request)(api.post='/api/plugin_api/get_plugin_next_version', api.category="plugin", api.gen_path='plugin')
GetDevPluginListResponse GetDevPluginList(1: GetDevPluginListRequest request)(api.post='/api/plugin_api/get_dev_plugin_list', api.category="plugin", api.gen_path='plugin', agw.preserve_base="true")
// 协议转换,如将 curl 、postman collection 协议转换为 openapi3 协议
Convert2OpenAPIResponse Convert2OpenAPI(1: Convert2OpenAPIRequest request)(api.post='/api/plugin_api/convert_to_openapi', api.category="plugin", api.gen_path="plugin", agw.preserve_base="true")
// 批量创建工具,目前是配合 Convert2OpenAPI 接口使用
BatchCreateAPIResponse BatchCreateAPI(1: BatchCreateAPIRequest request)(api.post='/api/plugin_api/batch_create_api', api.category="plugin", api.gen_path="plugin", agw.preserve_base="true")
RevokeAuthTokenResponse RevokeAuthToken(1: RevokeAuthTokenRequest request)(api.post='/api/plugin_api/revoke_auth_token', api.category="plugin", api.gen_path="plugin", agw.preserve_base="true")
GetQueriedOAuthPluginListResponse GetQueriedOAuthPluginList(1: GetQueriedOAuthPluginListRequest request)(api.post='/api/plugin_api/get_queried_oauth_plugins', api.category="plugin", api.gen_path="plugin", agw.preserve_base="true")
}
struct GetPlaygroundPluginListRequest {
1: optional i32 page (api.body = "page") // 页码
2: optional i32 size (api.body = "size") // 每页大小
4: optional string name (api.body = "name") // ignore
5: optional i64 space_id (api.body = "space_id" api.js_conv = "str") // 空间id
6: list<string> plugin_ids (api.body = "plugin_ids") // 如果存在则根据插件id查询无分页逻辑
7: list<i32> plugin_types (api.body = "plugin_types") // 长度为1 且为workflow时返回已发布的workflow列表默认返回已发布的plugin列表
8: optional i32 channel_id (api.body = "channel_id") // ignore
9: optional bool self_created (api.body = "self_created") // ignore
10: optional i32 order_by (api.body = "order_by") // 排序
11: optional bool is_get_offline (api.body = "is_get_offline") // ignore
99: string referer (api.header = "Referer") // ignore
255: optional base.Base Base
}
struct GetPlaygroundPluginListResponse {
1: required i32 code
2: required string msg
3: plugin_develop_common.GetPlaygroundPluginListData data
255: optional base.BaseResp BaseResp
}
struct GetPluginAPIsRequest {
1 : required i64 plugin_id (api.js_conv = "str"), // 插件id
2 : list<string> api_ids , // 如果存在则根据工具id查询无分页逻辑
3 : i32 page , // 页码
4 : i32 size , // 每页大小
5 : plugin_develop_common.APIListOrder order , // ignore
6 : optional string preview_version_ts, // ignore
255: optional base.Base Base ,
}
struct GetPluginAPIsResponse {
1 : i64 code ,
2 : string msg ,
3 : list<plugin_develop_common.PluginAPIInfo> api_info ,
4 : i32 total ,
5 : i32 edit_version,
255: optional base.BaseResp BaseResp ,
}
struct GetUpdatedAPIsRequest {
1 : required i64 plugin_id (api.js_conv = "str"), // 插件id
255: optional base.Base Base ,
}
struct GetUpdatedAPIsResponse {
1 : i64 code ,
2 : string msg ,
3 : list<string> created_api_names, // 新创建的工具名
4 : list<string> deleted_api_names, // 被删除的工具名
5 : list<string> updated_api_names, // 被更新的工具名
255: optional base.BaseResp BaseResp ,
}
struct GetPluginInfoRequest {
1 : required i64 plugin_id (api.js_conv = "str"), // 目前只支持插件openapi插件的信息
2 : optional string preview_version_tsx // ignore
255: optional base.Base Base ,
}
struct GetPluginInfoResponse {
1 : i64 code ,
2 : string msg ,
3 : plugin_develop_common.PluginMetaInfo meta_info ,
4 : plugin_develop_common.CodeInfo code_info ,
5 : bool status , // 0 无更新 1 有更新未发布
6 : bool published , // 是否已发布
7 : plugin_develop_common.Creator creator , // 创建人信息
8 : plugin_develop_common.PluginStatisticData statistic_data , // ignore
9 : plugin_develop_common.ProductStatus plugin_product_status, // ignore
10 : bool privacy_status , // ignore
11 : string privacy_info , // ignore
12 : plugin_develop_common.CreationMethod creation_method , // ignore
13 : string ide_code_runtime , // ignore
14 : i32 edit_version , // ignore
15 : plugin_develop_common.PluginType plugin_type , // ignore
255: optional base.BaseResp BaseResp ,
}
struct UpdatePluginRequest {
1 : i64 plugin_id (api.js_conv = "str") ,
3 : string ai_plugin , // plugin manifest in json string
4 : string openapi , // plugin openapi3 document in yaml string
5 : optional string client_id, // ignore
6 : optional string client_secret, // ignore
7 : optional string service_token, // ignore
8 : optional string source_code , // ignore
9 : optional i32 edit_version , // ignore
255: optional base.Base Base , // ignore
}
struct UpdatePluginResponse {
1 : i64 code ,
2 : string msg ,
3 : required plugin_develop_common.UpdatePluginData data ,
255: optional base.BaseResp BaseResp,
}
struct RegisterPluginMetaRequest {
1 : required string name , // 插件名
2 : required string desc , // 插件描述
3 : optional string url , // 插件服务地址前缀
4 : required plugin_develop_common.PluginIcon icon , // 插件图标
5 : optional plugin_develop_common.AuthorizationType auth_type , // 插件授权类型
6 : optional plugin_develop_common.AuthorizationServiceLocation location , // 子授权类型为api/token时token参数位置
7 : optional string key , // 子授权类型为api/token时token参数key
8 : optional string service_token , // 子授权类型为api/token时token参数value
9 : optional string oauth_info , // 授权类型为oauth是oauth信息见GetOAuthSchema返回值
10 : required i64 space_id (api.js_conv = "str") , // 空间id
11 : optional map<plugin_develop_common.ParameterLocation,list<plugin_develop_common.commonParamSchema>> common_params , // 插件公共参数key为参数位置value为参数列表
12 : optional plugin_develop_common.CreationMethod creation_method , // ignore
13 : optional string ide_code_runtime, // ignore
14 : optional plugin_develop_common.PluginType plugin_type , // ignore
15 : optional i64 project_id (api.js_conv = "str") , // 应用id
16 : optional i32 sub_auth_type , // 二级授权类型0api/token of service10client credentials of oauth
17 : optional string auth_payload , // ignore
18 : optional bool fixed_export_ip , // ignore
255: optional base.Base Base ,
}
struct RegisterPluginMetaResponse {
1 : i64 code ,
2 : string msg ,
3 : i64 plugin_id (api.js_conv = "str"),
255: optional base.BaseResp BaseResp ,
}
struct UpdatePluginMetaRequest {
1 : required i64 plugin_id (api.js_conv = "str") ,
2 : optional string name ,
3 : optional string desc ,
4 : optional string url , // plugin service url
5 : optional plugin_develop_common.PluginIcon icon ,
6 : optional plugin_develop_common.AuthorizationType auth_type ,
7 : optional plugin_develop_common.AuthorizationServiceLocation location , // 子授权类型为api/token时token参数位置
8 : optional string key , // 子授权类型为api/token时token参数key
9 : optional string service_token , // 子授权类型为api/token时token参数value
10 : optional string oauth_info , // 子授权类型为oauth时oauth信息见GetOAuthSchema返回值
11 : optional map<plugin_develop_common.ParameterLocation,list<plugin_develop_common.commonParamSchema>> common_params , // json序列化
12 : optional plugin_develop_common.CreationMethod creation_method, // ignore
13 : optional i32 edit_version , // ignore
14 : optional plugin_develop_common.PluginType plugin_type ,
15 : optional i32 sub_auth_type , // 二级授权类型
16 : optional string auth_payload , // ignore
17 : optional bool fixed_export_ip, // ignore
255: optional base.Base Base ,
}
struct UpdatePluginMetaResponse {
1 : i64 code ,
2 : string msg ,
3 : i32 edit_version,
255: optional base.BaseResp BaseResp ,
}
struct PublishPluginRequest {
1 : required i64 plugin_id (api.js_conv = "str") ,
2 : bool privacy_status, // 隐私声明状态
3 : string privacy_info , // 隐私声明内容
4 : string version_name ,
5 : string version_desc ,
255: optional base.Base Base ,
}
struct PublishPluginResponse {
1 : i64 code ,
2 : string msg ,
3 : string version_ts,
255: optional base.BaseResp BaseResp ,
}
// bot引用plugin
struct GetBotDefaultParamsRequest {
1 : i64 space_id (api.js_conv = "str") ,
2 : i64 bot_id (api.js_conv = "str") ,
3 : string dev_id ,
4 : i64 plugin_id (api.js_conv = "str") ,
5 : string api_name ,
6 : string plugin_referrer_id ,
7 : plugin_develop_common.PluginReferrerScene plugin_referrer_scene ,
8 : bool plugin_is_debug ,
9 : string workflow_id ,
10 : optional string plugin_publish_version_ts,
255: optional base.Base Base ,
}
struct GetBotDefaultParamsResponse {
1 : i64 code ,
2 : string msg ,
3 : list<plugin_develop_common.APIParameter> request_params ,
4 : list<plugin_develop_common.APIParameter> response_params,
5 : plugin_develop_common.ResponseStyle response_style ,
255: optional base.BaseResp BaseResp ,
}
struct UpdateBotDefaultParamsRequest {
1 : i64 space_id (api.js_conv = "str") ,
2 : i64 bot_id (api.js_conv = "str") ,
3 : string dev_id ,
4 : i64 plugin_id (api.js_conv = "str") ,
5 : string api_name ,
6 : list<plugin_develop_common.APIParameter> request_params ,
7 : list<plugin_develop_common.APIParameter> response_params ,
8 : string plugin_referrer_id ,
9 : plugin_develop_common.PluginReferrerScene plugin_referrer_scene,
10 : plugin_develop_common.ResponseStyle response_style ,
11 : string workflow_id ,
255: optional base.Base Base ,
}
struct UpdateBotDefaultParamsResponse {
1 : i64 code ,
2 : string msg ,
255: optional base.BaseResp BaseResp,
}
struct DeleteBotDefaultParamsRequest {
1 : i64 bot_id (api.js_conv = "str") ,
2 : string dev_id ,
3 : i64 plugin_id (api.js_conv = "str") ,
4 : string api_name ,
// bot删除工具时: DeleteBot = false , APIName要设置
// 删除bot时 : DeleteBot = true , APIName为空
5 : bool delete_bot ,
6 : i64 space_id (api.js_conv = "str") ,
7 : string plugin_referrer_id ,
8 : plugin_develop_common.PluginReferrerScene plugin_referrer_scene,
9 : string workflow_id ,
10 : i64 api_id (api.js_conv = "str"),
255: optional base.Base Base ,
}
struct DeleteBotDefaultParamsResponse {
255: base.BaseResp BaseResp,
}
struct UpdateAPIRequest {
1 : required i64 plugin_id (api.js_conv = "str") ,
2 : required i64 api_id (api.js_conv = "str") ,
3 : optional string name ,
4 : optional string desc ,
5 : optional string path , // http subURL of tool
6 : optional plugin_develop_common.APIMethod method , // http method of tool
7 : optional list<plugin_develop_common.APIParameter> request_params , // request parameters of tool
8 : optional list<plugin_develop_common.APIParameter> response_params, // response parameters of tool
9 : optional bool disabled , // whether disable tool
10 : optional plugin_develop_common.APIExtend api_extend , // ignore
11 : optional i32 edit_version , // ignore
12 : optional bool save_example , // whether save example
13 : optional plugin_develop_common.DebugExample debug_example ,
14 : optional string function_name , // ignore
255: optional base.Base Base ,
}
struct UpdateAPIResponse {
1 : i64 code ,
2 : string msg ,
3 : i32 edit_version,
255: optional base.BaseResp BaseResp ,
}
struct DelPluginRequest {
1 : i64 plugin_id (api.js_conv = "str"),
255: optional base.Base Base ,
}
struct DelPluginResponse {
1 : i64 code ,
2 : string msg ,
255: optional base.BaseResp BaseResp ,
}
struct CreateAPIRequest {
1 : required i64 plugin_id (api.js_conv = "str") ,
2 : required string name , // tool name
3 : required string desc , // tool description
4 : optional string path , // http subURL of tool
5 : optional plugin_develop_common.APIMethod method , // http method of tool
6 : optional plugin_develop_common.APIExtend api_extend , // ignore
7 : optional list<plugin_develop_common.APIParameter> request_params , // ignore
8 : optional list<plugin_develop_common.APIParameter> response_params, // ignore
9 : optional bool disabled , // ignore
10 : optional i32 edit_version , // ignore
11 : optional string function_name , // ignore
255: optional base.Base Base ,
}
struct CreateAPIResponse {
1 : i64 code ,
2 : string msg ,
3 : string api_id ,
4 : i32 edit_version,
255: optional base.BaseResp BaseResp ,
}
struct DeleteAPIRequest {
1 : required i64 plugin_id (api.js_conv = "str") ,
2 : required i64 api_id (api.js_conv = "str") ,
3 : optional i32 edit_version, // ignore
255: optional base.Base Base ,
}
struct DeleteAPIResponse {
1 : i64 code ,
2 : string msg ,
3 : i32 edit_version,
255: optional base.BaseResp BaseResp ,
}
struct GetOAuthSchemaRequest {
255: optional base.Base Base,
}
struct GetOAuthSchemaResponse {
1 : i64 code ,
2 : string msg ,
3 : string oauth_schema,
4 : string ide_conf ,
255: optional base.BaseResp BaseResp , // 约定的json
}
struct GetUserAuthorityRequest {
1 : required i64 plugin_id (api.body = "plugin_id" api.js_conv = "str") ,
2 : required plugin_develop_common.CreationMethod creation_method (api.body = "creation_method"),
3 : i64 project_id (api.body = "project_id" api.js_conv = "str") ,
255: optional base.Base Base ,
}
struct GetUserAuthorityResponse {
1 : required i32 code
2 : required string msg
3 : plugin_develop_common.GetUserAuthorityData data (api.body = "data")
255: optional base.BaseResp BaseResp ,
}
// 获取授权状态--plugin debug区
struct GetOAuthStatusRequest {
1 : required i64 plugin_id (api.js_conv = "str"),
255: base.Base Base ,
}
struct GetOAuthStatusResponse {
1 : bool is_oauth, // 是否为授权插件
2 : plugin_develop_common.OAuthStatus status , // 用户授权状态
3 : string content , // 未授权返回授权url
253: i64 code
254: string msg
255: required base.BaseResp BaseResp,
}
struct CheckAndLockPluginEditRequest {
1 : required i64 plugin_id (api.body = "plugin_id", api.js_conv = "str"),
255: optional base.Base Base ,
}
struct CheckAndLockPluginEditResponse {
1 : required i32 code ,
2 : required string msg ,
3 : plugin_develop_common.CheckAndLockPluginEditData data ,
255: optional base.BaseResp BaseResp ,
}
struct GetPluginPublishHistoryRequest {
1 : required i64 plugin_id (api.js_conv = "str"),
2 : required i64 space_id (api.js_conv = "str"),
3 : optional i32 page , // 翻页,第几页
4 : optional i32 size , // 翻页,每页几条
255: optional base.Base Base ,
}
struct GetPluginPublishHistoryResponse {
1 : i64 code ,
2 : string msg ,
3 : list<plugin_develop_common.PluginPublishInfo> plugin_publish_info_list, // 时间倒序
4 : i32 total , // 总共多少条,大于 page x size 说明还有下一页
255: base.BaseResp BaseResp ,
}
struct DebugAPIRequest {
1 : required i64 plugin_id (api.js_conv = "str") ,
2 : required i64 api_id (api.js_conv = "str") ,
3 : required string parameters , // request parameters in json string
4 : required plugin_develop_common.DebugOperation operation , // ignore
5 : optional i32 edit_version, // ignore
255: optional base.Base Base ,
}
struct DebugAPIResponse {
1 : i64 code ,
2 : string msg ,
3 : list<plugin_develop_common.APIParameter> response_params, // response parameters
4 : bool success , // invoke success or not
5 : string resp , // trimmed response in json string
6 : string reason , // invoke failed reason
7 : string raw_resp , // raw response in json string
8 : string raw_req , // raw request in json string
255: optional base.BaseResp BaseResp ,
}
struct UnlockPluginEditRequest {
1 : required i64 plugin_id (api.body = "plugin_id", api.js_conv = "str"),
255: optional base.Base Base ,
}
struct UnlockPluginEditResponse {
1 : required i32 code ,
2 : required string msg ,
3 : required bool released ,
255: optional base.BaseResp BaseResp ,
}
struct GetPluginNextVersionRequest {
1 : required i64 plugin_id (api.js_conv = "str"),
2 : required i64 space_id (api.js_conv = "str"),
255: optional base.Base Base ,
}
struct GetPluginNextVersionResponse {
1 : i64 code ,
2 : string msg ,
3 : string next_version_name,
255: base.BaseResp BaseResp ,
}
struct RegisterPluginRequest {
1 : string ai_plugin , // plugin manifest in json string
2 : string openapi , // plugin openapi3 document in yaml string
4 : optional string client_id , // ignore
5 : optional string client_secret , // ignore
6 : optional string service_token , // ignore
7 : optional plugin_develop_common.PluginType plugin_type , // ignore
8 : i64 space_id (api.js_conv = "str"),
9 : bool import_from_file, // ignore
10 : optional i64 project_id (api.js_conv = "str") ,
255: optional base.Base Base ,
}
struct RegisterPluginResponse {
1 : i64 code ,
2 : string msg ,
3 : plugin_develop_common.RegisterPluginData data ,
255: optional base.BaseResp BaseResp,
}
struct GetDevPluginListRequest {
1 : optional list<plugin_develop_common.PluginStatus> status ,
2 : optional i32 page ,
3 : optional i32 size ,
4 : required i64 dev_id (api.body = "dev_id", api.js_conv="str", agw.js_conv="str", agw.cli_conv="str", agw.key="dev_id") ,
5 : i64 space_id (api.body = "space_id", api.js_conv="str", agw.js_conv="str", agw.cli_conv="str", agw.key="space_id") ,
6 : optional plugin_develop_common.ScopeType scope_type ,
7 : optional plugin_develop_common.OrderBy order_by ,
8 : optional bool publish_status , // 发布状态筛选true:已发布, false:未发布
9 : optional string name , // 插件名或工具名
10 : optional plugin_develop_common.PluginTypeForFilter plugin_type_for_filter , // 插件种类筛选 端/云
11 : i64 project_id (api.body = "project_id", api.js_conv="str", agw.js_conv="str", agw.cli_conv="str", agw.key="project_id"),
12 : list<i64> plugin_ids (api.body = "plugin_ids", agw.js_conv="str", agw.cli_conv="str", agw.key="plugin_ids"), // 插件id列表
255: optional base.Base Base ,
}
struct GetDevPluginListResponse{
1 : i32 code ,
2 : string msg ,
3 : list<plugin_develop_common.PluginInfoForPlayground> plugin_list ,
4 : i64 total (api.body = "total", api.js_conv="str", agw.js_conv="str", agw.cli_conv="str", agw.key="total"),
255: base.BaseResp baseResp ,
}
struct Convert2OpenAPIRequest {
1 : optional string plugin_name (api.body = "plugin_name") ,
2 : optional string plugin_url (api.body = "plugin_url") ,
3 : required string data (api.body = "data") , // import content, e.g. curl, postman, swagger
4 : optional bool merge_same_paths (api.body = "merge_same_paths") , // ignore
5 : i64 space_id (api.js_conv = "str", api.body = "space_id") ,
6 : optional string plugin_description (api.body = "plugin_description"), // ignore
255: optional base.Base Base ,
}
struct Convert2OpenAPIResponse {
1 : i64 code ,
2 : string msg ,
3 : optional string openapi , // openapi3 document in yaml string
4 : optional string ai_plugin , // plugin manifest in json string
5 : optional plugin_develop_common.PluginDataFormat plugin_data_format , // protocol type
6 : list<plugin_develop_common.DuplicateAPIInfo> duplicate_api_infos, // ignore
// BaseResp.StatusCode
// DuplicateAPIPath: 导入的文件中有重复的API Path且 request.MergeSamePaths = false
// InvalidParam: 其他错误
255: optional base.BaseResp BaseResp ,
}
struct BatchCreateAPIRequest {
1 : i64 plugin_id (api.js_conv = "str", api.body = "plugin_id") ,
2 : string ai_plugin (api.body = "ai_plugin"), // plugin manifest in json string
3 : string openapi (api.body = "openapi"), // plugin openapi3 document in yaml string
4 : i64 space_id (api.js_conv = "str", api.body = "space_id") ,
5 : i64 dev_id (api.js_conv = "str", api.body = "dev_id"), // ignore
6 : bool replace_same_paths (api.body = "replace_same_paths"), // whether to replace the same tool, method:subURL is unique
7 : optional list<plugin_develop_common.PluginAPIInfo> paths_to_replace (api.body = "paths_to_replace"), // ignore
8 : optional i32 edit_version (api.body = "edit_version"), // ignore
255: optional base.Base Base ,
}
struct BatchCreateAPIResponse {
1 : i64 code ,
2 : string msg ,
// PathsToReplace表示要覆盖的tools
// 如果BaseResp.StatusCode = DuplicateAPIPath那么PathsToReplace不为空
3 : optional list<plugin_develop_common.PluginAPIInfo> paths_duplicated,
4 : optional list<plugin_develop_common.PluginAPIInfo> paths_created ,
5 : i32 edit_version ,
// BaseResp.StatusCode
// DuplicateAPIPath: 有重复的API Path且 request.ReplaceDupPath = false
// InvalidParam: 其他错误
255: required base.BaseResp BaseResp ,
}
struct RevokeAuthTokenRequest {
1 : required i64 plugin_id (api.js_conv = "str", api.body = "plugin_id"),
2 : optional i64 bot_id (api.js_conv = "str", api.body = "bot_id"), // 如果不传使用uid赋值 bot_id = connector_uid
3 : optional i32 context_type (api.body = "context_type"),
255: base.Base Base ,
}
struct RevokeAuthTokenResponse {
255: required base.BaseResp BaseResp,
}
struct OAuthPluginInfo {
1: i64 plugin_id (api.js_conv = "str") ,
2: plugin_develop_common.OAuthStatus status , // 用户授权状态
3: string name , // 插件name
4: string plugin_icon, // 插件头像
}
struct GetQueriedOAuthPluginListRequest {
1 : required i64 bot_id (api.js_conv = "str"),
255: base.Base Base ,
}
struct GetQueriedOAuthPluginListResponse {
1 : list<OAuthPluginInfo> oauth_plugin_list,
253: i64 code
254: string msg
255: required base.BaseResp BaseResp ,
}

View File

@@ -0,0 +1,426 @@
enum OnlineStatus {
OFFLINE = 0,
ONLINE = 1,
}
enum DebugExampleStatus {
Default = 0,
Enable = 1,
Disable = 2,
}
enum ParameterLocation{
Path = 1
Query = 2
Body = 3
Header = 4
}
//plugin枚举值
enum PluginParamTypeFormat{
FileUrl = 0
ImageUrl = 1
DocUrl = 2
CodeUrl = 3
PptUrl = 4
TxtUrl = 5
ExcelUrl = 6
AudioUrl = 7
ZipUrl = 8
VideoUrl = 9
}
enum APIMethod{
GET = 1,
POST = 2,
PUT = 3,
DELETE = 4,
PATCH = 5,
}
enum APIDebugStatus{
DebugWaiting = 0,
DebugPassed = 1,
}
enum ParameterType{
String = 1,
Integer = 2,
Number = 3,
Object = 4,
Array = 5,
Bool = 6,
}
// 默认入参的设置来源
enum DefaultParamSource {
Input = 0, // 默认用户输入
Variable = 1, // 引用变量
}
// 针对File类型参数的细分类型
enum AssistParameterType {
DEFAULT = 1,
IMAGE = 2,
DOC = 3,
CODE = 4,
PPT = 5,
TXT = 6,
EXCEL = 7,
AUDIO = 8,
ZIP = 9,
VIDEO = 10,
VOICE = 12, // 语音
}
enum PluginToolAuthType {
Required = 0, // 强授权
Supported = 1, // 半匿名授权
Disable = 2, // 不授权
}
enum PluginCardStatus {
Latest = 1,
NeedUpdate = 2, // 主卡片版本有升级
ParamMisMatch = 3, // 插件工具出参不匹配
}
enum PluginType {
PLUGIN = 1,
APP = 2,
FUNC = 3,
WORKFLOW = 4,
IMAGEFLOW = 5,
LOCAL = 6,
}
enum PluginStatus {
SUBMITTED = 1,
REVIEWING = 2,
PREPARED = 3,
PUBLISHED = 4,
OFFLINE = 5,
Draft = 0, // 默认值
BANNED = 6, // 禁用
}
enum ProductStatus {
NeverListed = 0,
Listed = 1,
Unlisted = 2,
Banned = 3,
}
enum ProductUnlistType {
ByAdmin = 1,
ByUser = 2,
}
enum CreationMethod {
COZE = 0,
IDE = 1,
}
enum APIListOrderBy {
CreateTime = 1,
}
enum SpaceRoleType {
Default = 0, // 默认
Owner = 1, // owner
Admin = 2, // 管理员
Member = 3, // 普通成员
}
enum RunMode {
DefaultToSync = 0,
Sync = 1,
Async = 2,
Streaming = 3,
}
enum AuthorizationType {
None = 0,
Service = 1,
OAuth = 3,
Standard = 4, // deprecated, the same as OAuth
}
enum ServiceAuthSubType {
ApiKey = 0,
// for opencoze
OAuthAuthorizationCode = 4,
}
enum AuthorizationServiceLocation {
Header = 1,
Query = 2,
}
enum PluginReferrerScene {
SingleAgent = 0,
WorkflowLlmNode = 1,
}
enum WorkflowResponseMode {
UseLLM = 0, // 模型总结
SkipLLM = 1, // 不使用模型总结
}
struct ResponseStyle {
1: WorkflowResponseMode workflow_response_mode,
}
struct CodeInfo {
1: string plugin_desc , // plugin manifest in json string
2: string openapi_desc , // plugin openapi3 document in yaml string
3: string client_id ,
4: string client_secret,
5: string service_token,
}
struct APIListOrder {
1: APIListOrderBy order_by,
2: bool desc ,
}
struct UserLabel {
1: string label_id ,
2: string label_name,
3: string icon_uri ,
4: string icon_url ,
5: string jump_link ,
}
struct PluginMetaInfo{
1 : string name , // 插件名
2 : string desc , // 插件描述
3 : string url , // 插件服务地址前缀
4 : PluginIcon icon , // 插件图标
5 : list<AuthorizationType> auth_type , // 插件授权类型0无授权1service3oauth
6 : optional AuthorizationServiceLocation location , // 子授权类型为api/token时token参数位置
7 : optional string key , // 子授权类型为api/token时token参数key
8 : optional string service_token, // 子授权类型为api/token时token参数值
9 : optional string oauth_info , // 子授权类型为oauth时oauth信息
10: optional map<ParameterLocation,list<commonParamSchema>> common_params, // 插件公共参数key为参数位置value为参数列表
11: optional i32 sub_auth_type, // 子授权类型0: api/token of service, 10: client credentials of oauth
12: optional string auth_payload , // 可忽略
13: bool fixed_export_ip, // 可忽略
}
struct PluginIcon {
1: string uri,
2: string url,
}
struct GetPlaygroundPluginListData {
1: list<PluginInfoForPlayground> plugin_list (api.body = "plugin_list")
2: i32 total (api.body = "total")
}
struct PluginInfoForPlayground {
1: string id
2: string name // name_for_human
3: string desc_for_human // description_for_human
4: string plugin_icon
5: PluginType plugin_type
6: PluginStatus status
9: i32 auth
10: string client_id
11: string client_secret
15: list<PluginApi> plugin_apis
16: i64 tag // 插件标签
17: string create_time
18: string update_time
22: Creator creator // 创建人信息
23: string space_id // 空间id
24: PluginStatisticData statistic_data // 插件统计数据
25: optional map<ParameterLocation, list<commonParamSchema>> common_params
26: ProductStatus plugin_product_status // plugin的商品状态
27: ProductUnlistType plugin_product_unlist_type // plugin商品下架类型
28: string material_id // 素材id
29: i32 channel_id // 渠道id
30: CreationMethod creation_method // 插件创建方式
31: bool is_official // 是否为官方插件
32: string project_id // 项目id
33: string version_ts // 版本号,毫秒时间戳
34: string version_name // 版本名称
}
struct PluginApi {
1 : string name // operationId
2 : string desc // summary
3 : list<PluginParameter> parameters
4 : string plugin_id
5 : string plugin_name
7 : string api_id // 序号和playground保持一致
8 : string record_id
9 : optional PresetCardBindingInfo card_binding_info // 卡片绑定信息未绑定则为nil
10: optional DebugExample debug_example // 调试api示例
11: optional string function_name
12: RunMode run_mode // 运行模式
}
struct Creator {
1: string id ,
2: string name ,
3: string avatar_url ,
4: bool self , // 是否是自己创建的
5: SpaceRoleType space_roly_type ,
6: string user_unique_name, // 用户名
7: UserLabel user_label , // 用户标签
}
struct commonParamSchema{
1: string name
2: string value
}
struct PluginParameter {
1 : string name
2 : string desc
3 : bool required
4 : string type
5 : list<PluginParameter> sub_parameters
6 : string sub_type // 如果Type是数组则有subtype
7 : optional string from_node_id // 如果入参的值是引用的则有fromNodeId
8 : optional list<string> from_output // 具体引用哪个节点的key
9 : optional string value // 如果入参是用户手输 就放这里
10: optional PluginParamTypeFormat format // 格式化参数
}
struct PluginAPIInfo{
1 : string plugin_id ,
2 : string api_id ,
3 : string name ,
4 : string desc ,
5 : string path ,
6 : APIMethod method ,
7 : list<APIParameter> request_params ,
8 : list<APIParameter> response_params ,
9 : string create_time ,
10: APIDebugStatus debug_status ,
11: bool disabled , // ignore
12: PluginStatisticData statistic_data , // ignore
13: OnlineStatus online_status , // if tool has been published, online_status is Online
14: APIExtend api_extend , // ignore
15: optional PresetCardBindingInfo card_binding_info , // ignore
16: optional DebugExample debug_example , // 调试示例
17: DebugExampleStatus debug_example_status, // 调试示例状态
18: string function_name , // ignore
}
struct APIParameter {
1 : string id , // for前端无实际意义
2 : string name , // parameter name
3 : string desc , // parameter desc
4 : ParameterType type , // parameter type
5 : optional ParameterType sub_type , // 可忽略
6 : ParameterLocation location , // 参数位置
7 : bool is_required , // 是否必填
8 : list<APIParameter> sub_parameters , // 子参数
9 : optional string global_default , // 全局默认值
10: bool global_disable , // 全局是否启用
11: optional string local_default , // 智能体内设置的默认值
12: bool local_disable , // 智能体内是否启用
13: optional DefaultParamSource default_param_source , // 可忽略
14: optional string variable_ref , // 引用variable的key
15: optional AssistParameterType assist_type , // 多模态辅助参数类型
}
struct PluginStatisticData {
1: optional i32 bot_quote, // 为空就不展示
}
struct APIExtend {
1: PluginToolAuthType auth_mode, // tool维度授权类型
}
// 插件预置卡片绑定信息
struct PresetCardBindingInfo{
1: string card_id ,
2: string card_version_num,
3: PluginCardStatus status ,
4: string thumbnail , // 缩略图
}
struct DebugExample {
1: string req_example , // request example in json
2: string resp_example, // response example in json
}
struct UpdatePluginData {
1: bool res ,
2: i32 edit_version,
}
struct GetUserAuthorityData {
1: bool can_edit
2: bool can_read
3: bool can_delete
4: bool can_debug
5: bool can_publish
6: bool can_read_changelog
}
// 授权状态
enum OAuthStatus {
Authorized = 1,
Unauthorized = 2,
}
struct CheckAndLockPluginEditData {
1: bool Occupied, // 是否已被占用
2: Creator user , // 如果已经被占用了返回用户ID
3: bool Seized , // 是否强占成功
}
struct PluginPublishInfo {
1 : i64 publisher_id (api.js_conv = "str"), // 发布人
2 : i64 version_ts , // 版本,毫秒时间戳
3 : string version_name, // 版本名称
4 : string version_desc, // 版本描述
}
enum DebugOperation{
Debug = 1, // 调试,会保存调试状态,会校验返回值
Parse = 2, // 仅解析返回值结构
}
struct RegisterPluginData {
1: i64 plugin_id (api.js_conv = "str"),
2: string openapi, // the same as the request 'openapi'
}
enum ScopeType {
All = 0, // 所有
Self = 1, // 自己
}
enum OrderBy {
CreateTime = 0,
UpdateTime = 1,
PublishTime = 2,
Hot = 3,
}
enum PluginTypeForFilter {
CloudPlugin = 1, // 包含PLUGIN和APP
LocalPlugin = 2, // 包含LOCAL
WorkflowPlugin = 3, // 包含WORKFLOW和IMAGEFLOW
}
enum PluginDataFormat {
OpenAPI = 1,
Curl = 2,
Postman = 3,
Swagger = 4,
}
struct DuplicateAPIInfo{
1: string method,
2: string path ,
3: i64 count ,
}

View File

@@ -0,0 +1,110 @@
namespace go resource
include "../base.thrift"
include "resource_common.thrift"
struct LibraryResourceListRequest {
1 : optional i32 user_filter , // 是否由当前用户创建0-不筛选1-当前用户
2 : optional list<resource_common.ResType> res_type_filter , // [4,1] 0代表不筛选
3 : optional string name , // 名称
4 : optional resource_common.PublishStatus publish_status_filter, // 发布状态0-不筛选1-未发布2-已发布
5 : required i64 space_id (agw.js_conv="str", api.js_conv="true"), // 用户所在空间ID
7 : optional i32 size , // 一次读取的数据条数默认10最大100.
9 : optional string cursor , // 游标用于分页默认0第一次请求可以不传后续请求需要带上上次返回的cursor
10 : optional list<string> search_keys , // 用来指定自定义搜索的字段 不填默认只name匹配eg []string{name,自定} 匹配name和自定义字段full_text
11 : optional bool is_get_imageflow , // 当res_type_filter为[2 workflow]时,是否需要返回图片流
255: base.Base Base ,
}
struct LibraryResourceListResponse {
1 : i64 code ,
2 : string msg ,
3 : list<resource_common.ResourceInfo> resource_list,
5 : optional string cursor , // 游标用于下次请求的cursor
6 : bool has_more , // 是否还有数据待拉取
255: required base.BaseResp BaseResp ,
}
struct ProjectResourceListRequest {
1 : required i64 project_id (agw.js_conv="str", api.js_conv="true"), // 项目ID
2 : i64 space_id (agw.js_conv="str", api.js_conv="true"), // 用户所在space id
3 : optional string project_version, // 指定获取某个版本的project的资源
255: base.Base Base ,
}
struct ProjectResourceListResponse {
1 : i64 code,
2 : string msg,
3 : list<resource_common.ProjectResourceGroup> resource_groups,
255: required base.BaseResp BaseResp,
}
struct ResourceCopyDispatchRequest {
// 场景,只支持单资源的操作
1 : resource_common.ResourceCopyScene scene,
// 被用户选择复制/移动的资源ID
2 : i64 res_id (api.js_conv="true", api.body="res_id")
3 : resource_common.ResType res_type
// 所在项目ID
4 : optional i64 project_id (api.js_conv="true", api.body="project_id")
5 : optional string res_name
6 : optional i64 target_space_id (api.js_conv="true", api.body="target_space_id") // 跨空间复制的目标space id
255: base.Base Base,
}
struct ResourceCopyDispatchResponse {
1 : i64 code,
2 : string msg,
3 : optional string task_id, // 复制任务id, 用于查询任务状态或取消、重试任务
// 不可以进行操作的原因,返回多语言文本
4 : optional list<resource_common.ResourceCopyFailedReason> failed_reasons,
255: required base.BaseResp BaseResp,
}
struct ResourceCopyDetailRequest {
1 : string task_id, // 复制任务id, 用于查询任务状态或取消、重试任务
255: base.Base Base,
}
struct ResourceCopyDetailResponse {
1 : i64 code,
2 : string msg,
3 : optional resource_common.ResourceCopyTaskDetail task_detail,
255: required base.BaseResp BaseResp,
}
struct ResourceCopyRetryRequest {
1 : string task_id, // 复制任务id, 用于查询任务状态或取消、重试任务
255: base.Base Base,
}
struct ResourceCopyRetryResponse {
1 : i64 code,
2 : string msg,
// 不可以进行操作的原因,返回多语言文本
4 : optional list<resource_common.ResourceCopyFailedReason> failed_reasons,
255: required base.BaseResp BaseResp,
}
struct ResourceCopyCancelRequest {
1 : string task_id, // 复制任务id, 用于查询任务状态或取消、重试任务
255: base.Base Base,
}
struct ResourceCopyCancelResponse {
1 : i64 code,
2 : string msg,
255: required base.BaseResp BaseResp,
}
service ResourceService {
LibraryResourceListResponse LibraryResourceList(1: LibraryResourceListRequest request)(api.post='/api/plugin_api/library_resource_list', api.category="resource", api.gen_path="resource", agw.preserve_base="true")
ProjectResourceListResponse ProjectResourceList(1: ProjectResourceListRequest request)(api.post='/api/plugin_api/project_resource_list', api.category="resource", api.gen_path="resource", agw.preserve_base="true")
// 复制Library资源到项目、复制项目资源到Library、移动项目资源到Library、项目内单复制资源
ResourceCopyDispatchResponse ResourceCopyDispatch (1: ResourceCopyDispatchRequest req) (api.post='/api/plugin_api/resource_copy_dispatch', api.category="resource", api.gen_path="resource", agw.preserve_base="true")
ResourceCopyDetailResponse ResourceCopyDetail (1: ResourceCopyDetailRequest req) (api.post='/api/plugin_api/resource_copy_detail', api.category="resource", api.gen_path="resource", agw.preserve_base="true")
ResourceCopyRetryResponse ResourceCopyRetry (1: ResourceCopyRetryRequest req) (api.post='/api/plugin_api/resource_copy_retry', api.category="resource", api.gen_path="resource", agw.preserve_base="true")
ResourceCopyCancelResponse ResourceCopyCancel (1: ResourceCopyCancelRequest req) (api.post='/api/plugin_api/resource_copy_cancel', api.category="resource", api.gen_path="resource", agw.preserve_base="true")
}

View File

@@ -0,0 +1,159 @@
namespace go resource.common
enum ResType{
Plugin = 1,
Workflow = 2,
Imageflow = 3,
Knowledge = 4,
UI = 5,
Prompt = 6,
Database = 7,
Variable = 8,
Voice = 9,
}
enum PublishStatus {
UnPublished = 1, // 未发布
Published = 2, // 已发布
}
enum ActionKey{
Copy = 1, // 复制
Delete = 2, // 删除
EnableSwitch = 3, // 启用/禁用
Edit = 4, // 编辑
SwitchToFuncflow = 8, // 切换成funcflow
SwitchToChatflow = 9, // 切换成chatflow
CrossSpaceCopy = 10, // 跨空间复制
}
enum ProjectResourceActionKey{
Rename = 1, //重命名
Copy = 2, //创建副本/复制到当前项目
CopyToLibrary = 3, //复制到资源库
MoveToLibrary = 4, //移动到资源库
Delete = 5, //删除
Enable = 6, //启用
Disable = 7, //禁用
SwitchToFuncflow = 8, // 切换成funcflow
SwitchToChatflow = 9, // 切换成chatflow
UpdateDesc = 10, // 修改描述
}
enum ProjectResourceGroupType{
Workflow = 1,
Plugin = 2,
Data = 3,
}
enum ResourceCopyScene {
CopyProjectResource = 1, //复制项目内的资源,浅拷贝
CopyResourceToLibrary = 2, //复制项目资源到Library复制后要发布
MoveResourceToLibrary = 3, //移动项目资源到Library复制后要发布后置要删除项目资源
CopyResourceFromLibrary = 4, //复制Library资源到项目
CopyProject = 5, //复制项目,连带资源要复制。复制当前草稿。
PublishProject = 6, //项目发布到渠道,连带资源需要发布(含商店)。以当前草稿发布。
CopyProjectTemplate = 7, // 复制项目模板。
PublishProjectTemplate = 8, // 项目发布到模板,以项目的指定版本发布成临时模板。
LaunchTemplate = 9, // 模板审核通过,上架,根据临时模板复制正式模板。
ArchiveProject = 10, // 草稿版本存档
RollbackProject = 11, // 线上版本加载到草稿,草稿版本加载到草稿
CrossSpaceCopy = 12, // 单个资源跨空间复制
CrossSpaceCopyProject = 13, // 项目跨空间复制
}
// Library资源操作
struct ResourceAction{
// 一个操作对应一个唯一的keykey由资源侧约束
1: required ActionKey Key (go.tag = "json:\"key\"", agw.key = "key") ,
//ture=可以操作该Actionfalse=置灰
2: required bool Enable (go.tag = "json:\"enable\"", agw.key = "enable"),
}
// 前端用
struct ResourceInfo{
1 : optional i64 ResID (agw.js_conv="str", agw.key = "res_id", api.js_conv="true", api.body="res_id") , // 资源id
2 : optional ResType ResType (go.tag = "json:\"res_type\"", agw.key = "res_type") , // 资源类型
// 资源子类型,由资源实现方定义。
// Plugin1-Http; 2-App; 6-LocalKnowledge0-text; 1-table; 2-imageUI1-Card
3 : optional i32 ResSubType (go.tag = "json:\"res_sub_type\"", agw.key = "res_sub_type") ,
4 : optional string Name (go.tag = "json:\"name\"", agw.key = "name") , // 资源名称
5 : optional string Desc (go.tag = "json:\"desc\"", agw.key = "desc") , // 资源描述
6 : optional string Icon (go.tag = "json:\"icon\"", agw.key = "icon") , // 资源Icon完整url
7 : optional i64 CreatorID (agw.js_conv="str", agw.key = "creator_id", api.js_conv="true", api.body="creator_id") , // 资源创建者
8 : optional string CreatorAvatar (go.tag = "json:\"creator_avatar\"", agw.key = "creator_avatar") , // 资源创建者
9 : optional string CreatorName (go.tag = "json:\"creator_name\"", agw.key = "creator_name") , // 资源创建者
10: optional string UserName (go.tag = "json:\"user_name\"", agw.key = "user_name") , // 资源创建者
11: optional PublishStatus PublishStatus (go.tag = "json:\"publish_status\"", agw.key = "publish_status") , // 资源发布状态1-未发布2-已发布
12: optional i32 BizResStatus (go.tag = "json:\"biz_res_status\"", agw.key = "biz_res_status") , // 资源状态,各类型资源自身定义
13: optional bool CollaborationEnable (go.tag = "json:\"collaboration_enable\"", agw.key = "collaboration_enable"), // 是否开启多人编辑
14: optional i64 EditTime (agw.key = "edit_time", api.js_conv="true", api.body="edit_time") , // 最近编辑时间, unix秒级时间戳
15: optional i64 SpaceID (agw.js_conv="str", agw.key = "space_id", api.js_conv="true", api.body="space_id") , // 资源所属空间ID
16: optional map<string,string> BizExtend (go.tag = "json:\"biz_extend\"", agw.key = "biz_extend") , // 业务携带的扩展信息以res_type区分每个res_type定义的schema和含义不一样使用前需要判断res_type
17: optional list<ResourceAction> Actions (go.tag = "json:\"actions\"", agw.key = "actions") , // 不同类型的不同操作按钮,由资源实现方和前端约定。返回则展示,要隐藏某个按钮,则不要返回;
18: optional bool DetailDisable (go.tag = "json:\"detail_disable\"", agw.key = "detail_disable") , // 是否禁止进详情页
19: optional bool DelFlag (go.tag = "json:\"del_flag\"", agw.key = "del_flag") , // [数据延迟优化]删除标识符true-已删除-前端隐藏该itemfalse-正常
}
struct ProjectResourceAction{
// 一个操作对应一个唯一的keykey由资源侧约束
1 : required ProjectResourceActionKey Key (go.tag = "json:\"key\"", agw.key = "key"),
//ture=可以操作该Actionfalse=置灰
2 : required bool Enable (go.tag = "json:\"enable\"", agw.key = "enable"),
// enable=false时提示文案。后端返回Starling Key注意放在同一个space下。
3: optional string Hint (go.tag = "json:\"hint\"", agw.key = "hint"),
}
// 实现方提供展示信息
struct ProjectResourceInfo{
// 资源id
1 : i64 ResID (api.js_conv="true", api.body="res_id", agw.js_conv="str", agw.key = "res_id")
// 资源名称
2 : string Name (go.tag = "json:\"name\"", agw.key = "name")
// 不同类型的不同操作按钮,由资源实现方和前端约定。返回则展示,要隐藏某个按钮,则不要返回;
3 : list<ProjectResourceAction> Actions (go.tag = "json:\"actions\"", agw.key = "actions"),
// 该用户是否对资源只读
// 4: bool ReadOnly (go.tag = "json:\"read_only\"", agw.key = "read_only")
// 资源类型
5 : ResType ResType (go.tag = "json:\"res_type\"", agw.key = "res_type") ,
// 资源子类型由资源实现方定义。Plugin1-Http; 2-App; 6-LocalKnowledge0-text; 1-table; 2-imageUI1-Card
6 : optional i32 ResSubType (go.tag = "json:\"res_sub_type\"", agw.key = "res_sub_type") ,
// 业务携带的扩展信息以res_type区分每个res_type定义的schema和含义不一样使用前需要判断res_type
7 : optional map<string, string> BizExtend (go.tag = "json:\"biz_extend\"", agw.key = "biz_extend"),
// 资源状态,各类型资源自身定义。前端与各资源方约定。
8 : optional i32 BizResStatus (go.tag = "json:\"biz_res_status\"", agw.key = "biz_res_status") ,
// 当前资源的编辑态版本
9 : optional string VersionStr(go.tag = "json:\"version_str\"", agw.key = "version_str")
}
struct ProjectResourceGroup{
1 : ProjectResourceGroupType GroupType (go.tag = "json:\"group_type\"", agw.key = "group_type") , // 资源分组
2 : optional list<ProjectResourceInfo> ResourceList (go.tag = "json:\"resource_list\"", agw.key = "resource_list"),
}
struct ResourceCopyFailedReason {
1 : i64 ResID (agw.js_conv="str", agw.key = "res_id", api.js_conv="true", api.body="res_id")
2 : ResType ResType (go.tag = "json:\"res_type\"", agw.key = "res_type")
3 : string ResName (go.tag = "json:\"res_name\"", agw.key = "res_name")
4 : string Reason (go.tag = "json:\"reason\"", agw.key = "reason")
// 废弃
5 : optional i64 PublishVersion(go.tag = "json:\"publish_version\"", agw.key = "publish_version")
// 资源的当前版本为nil或空字符串都看作是最新版本。项目发布版本或Library发布版本。
6 : optional string PublishVersionStr(go.tag = "json:\"publish_version_str\"", agw.key = "publish_version_str")
}
enum TaskStatus{
Successed = 1
Processing = 2
Failed = 3
Canceled = 4
}
struct ResourceCopyTaskDetail{
1: string task_id
2: TaskStatus status // 任务状态
3 : i64 res_id (agw.js_conv="str", api.js_conv="true") // 复制后的资源id
4 : ResType res_type
5 : ResourceCopyScene scene,
6: optional string res_name, // 复制前的资源名称
}