refactor: IDL structure modification (#475)
This commit is contained in:
26
idl/data/database/database_svc.thrift
Normal file
26
idl/data/database/database_svc.thrift
Normal file
@@ -0,0 +1,26 @@
|
||||
include "table.thrift"
|
||||
include "../knowledge/document.thrift"
|
||||
|
||||
namespace go data.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")
|
||||
document.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")
|
||||
}
|
||||
859
idl/data/database/table.thrift
Normal file
859
idl/data/database/table.thrift
Normal file
@@ -0,0 +1,859 @@
|
||||
include "../../base.thrift"
|
||||
namespace go data.database.table
|
||||
enum RefType {
|
||||
NoRef = 0
|
||||
Bot = 1
|
||||
ChatGroup = 2
|
||||
}
|
||||
|
||||
struct RefInfo {
|
||||
1: RefType ref_type // reference type
|
||||
2: string ref_id // reference id
|
||||
}
|
||||
|
||||
enum BotTableStatus {
|
||||
Online = 1 // online
|
||||
Delete = 2 // delete
|
||||
}
|
||||
|
||||
enum FieldItemType {
|
||||
Text = 1 // Text
|
||||
Number = 2 // number
|
||||
Date = 3 // time
|
||||
Float = 4 // float
|
||||
Boolean = 5 // bool
|
||||
}
|
||||
|
||||
struct FieldItem {
|
||||
1: string name
|
||||
2: string desc
|
||||
3: FieldItemType type
|
||||
4: bool must_required
|
||||
5: i64 id // This field is only used to determine whether it is published. If it is not 0, it is published. The front end cannot modify the field type for the published field.
|
||||
6: i64 alterId // When modifying a field (alter, publish), it is used to judge additions and deletions. 0 means new additions, and non-0 means modification or deletion.
|
||||
7: bool is_system_field // Is it a system field?
|
||||
}
|
||||
|
||||
enum BotTableRWMode {
|
||||
LimitedReadWrite = 1 // single user mode
|
||||
ReadOnly = 2 // read-only mode
|
||||
UnlimitedReadWrite = 3 // multi-user mode
|
||||
RWModeMax = 4 // Max boundary value
|
||||
}
|
||||
|
||||
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") // Get a database created by a user
|
||||
2: optional i64 project_id (api.js_conv="str") // Get the database under the project
|
||||
3: optional i64 space_id (api.js_conv="str") //Get the visible database under space
|
||||
4: optional i64 bot_id (api.js_conv="str") //Filter bot_id to filter out databases that have been added to the bot
|
||||
5: optional string table_name // Table name, fuzzy search
|
||||
6: required TableType table_type // Draft database
|
||||
7: optional list<OrderBy> order_by // sort
|
||||
8: optional i32 offset
|
||||
9: optional i32 limit
|
||||
10: optional Criterion filter_criterion //filter criteria
|
||||
11: optional list<OrderBy> order_by_list //sort condition
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct DatabaseInfo {
|
||||
1: i64 id (api.js_conv="str", api.key="id") // online_database_info primary key id
|
||||
2: i64 space_id (api.js_conv="str") // ID of space
|
||||
3: i64 project_id (api.js_conv="str") // project id
|
||||
4: string datamodel_table_id // Table ID on the datamodel side
|
||||
5: string icon_url // avatar url
|
||||
6: string icon_uri // avatar url
|
||||
7: string table_name // table name
|
||||
8: string table_desc // table description
|
||||
9: BotTableStatus status // status
|
||||
10: i64 creator_id (api.js_conv="str") // creator id
|
||||
11: i64 create_time // create_time
|
||||
12: i64 update_time // update time
|
||||
13: list<FieldItem> field_list // Field information
|
||||
14: string actual_table_name // Data table actual name
|
||||
15: BotTableRWMode rw_mode // read and write mode
|
||||
16: bool prompt_disabled // Whether to support prompt calls
|
||||
17: bool is_visible // Is it visible?
|
||||
18: optional i64 draft_id (api.js_conv="str") // ID corresponding to draft state
|
||||
19: optional i64 bot_id (api.js_conv="str", api.key="bot_id") // Related id. bot_id, the old one is available, the new one is not.
|
||||
20: optional map<string,string> extra_info // extended information
|
||||
21: optional bool is_added_to_bot // Has it been added to the 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 primary key id
|
||||
2: bool is_draft (api.key="is_draft") //Whether the incoming data is in draft form, the default is false.
|
||||
3: bool need_sys_fields (api.key="need_sys_fields") //Do you need system fields?
|
||||
4: i64 version (api.js_conv="str") // The version number is not passed on, and the default is the latest.
|
||||
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") // creator id
|
||||
2: i64 space_id (api.js_conv="str") // ID of space
|
||||
3: i64 project_id (api.js_conv="str") // project id
|
||||
4: string icon_uri // avatar url
|
||||
5: string table_name // table name
|
||||
6: string table_desc // table description
|
||||
7: list<FieldItem> field_list // Field information
|
||||
8: BotTableRWMode rw_mode // Read and write mode, single user mode/multi-user mode
|
||||
9: bool prompt_disabled // Whether to support prompt calls
|
||||
10: optional map<string,string> extra_info // extended information
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct UpdateDatabaseRequest{
|
||||
1: i64 id (api.js_conv="str", api.key="id") // database_info primary key id
|
||||
2: string icon_uri // avatar url
|
||||
3: string table_name // table name
|
||||
5: string table_desc // table description
|
||||
6: list<FieldItem> field_list // Field information
|
||||
7: BotTableRWMode rw_mode // Read and write mode, single user mode/multi-user mode
|
||||
8: bool prompt_disabled // Whether to support prompt calls
|
||||
9: optional map<string,string> extra_info // extended information
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct DeleteDatabaseRequest{
|
||||
1: i64 id (api.js_conv="str", api.key="id") // database_info primary key 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") // Draft data database table primary key id, note that it is draft state
|
||||
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, here is to fill in this when looking for the draft state data associated with the bot
|
||||
3: optional i64 workflow_id (api.js_conv="str", api.key="workflow_id") // workflow_id,, here is to fill in this when looking up wk_flow associated draft status sheet
|
||||
4: optional bool not_filter_by_user_id // Is true does not filter by user_id Records
|
||||
5: optional bool not_filter_by_connector_id // Records not filtered by ConnectorID
|
||||
6: TableType table_type // Do you want to check the draft state or the online state?
|
||||
7: i64 limit // Do not exceed 100, 50 is recommended.
|
||||
8: i64 offset // Offset
|
||||
9: optional i64 project_id (api.js_conv="str") // Data is not isolated under the same project
|
||||
10: optional ComplexCondition filter_criterion //filter criteria
|
||||
11: optional list<OrderBy> order_by_list //sort condition
|
||||
255: optional base.Base Base
|
||||
}
|
||||
struct ListDatabaseRecordsRequestRPC{
|
||||
1: required i64 database_id (api.js_conv="str") // database_id
|
||||
2: TableType table_type // Do you want to check the draft state or the online state?
|
||||
3: i64 limit // Do not exceed 100, 50 is recommended.
|
||||
4: i64 offset // Offset
|
||||
5: string user_id // user 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 // Field information
|
||||
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 // Field information
|
||||
|
||||
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 // new
|
||||
3: optional list<map<string,string>> record_data_alter // modified
|
||||
4: optional list<map<string,string>> record_data_delete // deleted
|
||||
5: optional TableType table_type // Is the draft state or online state to be updated?
|
||||
6: optional string ori_connector_id // The connector id needs to be inserted when updating.
|
||||
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") // The draft database_id
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct GetOnlineDatabaseIdResponse{
|
||||
1: optional i64 id (api.js_conv="str") // Check the online id according to the id of the draft.
|
||||
|
||||
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") // Autoincrement id, table id
|
||||
2: i64 bot_id (api.js_conv="str", api.key="bot_id") // Related id bot_id
|
||||
3: string table_id // table_id
|
||||
4: string table_name // table name
|
||||
5: string table_desc // table description
|
||||
6: BotTableStatus status // status
|
||||
7: i64 creator_id // Creating the ID.
|
||||
8: i64 create_time // create_time
|
||||
9: i64 update_time // update time
|
||||
10: list<FieldItem> field_list // Field information
|
||||
11: string actual_table_name // Data table actual name
|
||||
12: BotTableRWMode rw_mode // read and write mode
|
||||
13: optional map<string,string> extra_info // extended information
|
||||
}
|
||||
|
||||
struct InsertBotTableRequest {
|
||||
1: BotTable bot_table // Save table information
|
||||
|
||||
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 // Modify table information
|
||||
|
||||
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 generator generation
|
||||
2: required list<i64> TableIds //Original 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 generator generation
|
||||
2: required map<i64, i64> TableIdsMapping // Parameters returned CopyDatabaseResponse
|
||||
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct CopyDatabaseRollbackResponce {
|
||||
1: required bool Result
|
||||
|
||||
255: required base.BaseResp BaseResp
|
||||
}
|
||||
|
||||
struct GetNL2SQLRequest {
|
||||
1: required string text // Natural language description of database requests
|
||||
2: required i64 bot_id // bot id
|
||||
3: optional i64 connector_id // line of business id
|
||||
4: optional string connector_uid // line of business user id
|
||||
5: required TableType table_type // Table types, draft and online
|
||||
6: optional i64 database_id (api.js_conv="str") // Database 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 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 // line of business id
|
||||
6: optional string connector_uid // line of business user id
|
||||
7: optional i64 workflow_id (api.js_conv="str") // Workflow ID
|
||||
8: optional i64 database_info_id (api.js_conv="str") // user id
|
||||
9: optional i64 project_id (api.js_conv="str") // Project 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 // database name
|
||||
2: string collection_name // collection name
|
||||
3: list<map<string,string>> data // save data
|
||||
4: i64 user_id // user 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 // database name
|
||||
2: string collection_name // collection name
|
||||
3: list<map<string,string>> data_list // update data
|
||||
4: i64 user_id // user 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 // database name
|
||||
2: string collection_name // collection name
|
||||
3: list<string> ids // Delete id list
|
||||
4: i64 user_id // user 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 // Search term, currently ignored
|
||||
2: i64 limit
|
||||
3: i64 offset
|
||||
4: string connector_uid // user id
|
||||
5: i64 connector_id
|
||||
6: i64 bot_id(api.js_conv="str", api.key="bot_id") // bot id
|
||||
7: string table_name // Currently ignored
|
||||
8: i64 table_id(api.js_conv="str", api.key="table_id")
|
||||
9: optional RefInfo ref_info // citation information
|
||||
|
||||
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 // draft
|
||||
OnlineTable = 2 // online
|
||||
}
|
||||
|
||||
struct ExecuteSqlRequest {
|
||||
1: string sql // SQL that RunCommand can execute
|
||||
2: i64 bot_id // bot id
|
||||
3: i64 connector_id // line of business id
|
||||
4: string connector_uid // line of business user id
|
||||
5: TableType table_type // Table type
|
||||
6: string wftest_id // Workflow test run identification
|
||||
7: optional RefInfo ref_info // citation information
|
||||
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 // Project 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 // line of business id
|
||||
3: optional string connector_uid // line of business user id
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct BotTablePublishResp {
|
||||
1: i64 status // Execution status: 0-successful execution 1-failed execution all 2-failed execution part
|
||||
2: string msg // error message
|
||||
255: optional base.BaseResp BaseResp
|
||||
}
|
||||
|
||||
struct NL2SQLRequest {
|
||||
1: required string text // Natural language description of database requests
|
||||
2: required i64 bot_id // bot id
|
||||
3: optional i64 connector_id // line of business id
|
||||
4: optional string connector_uid // line of business user id
|
||||
5: required TableType table_type // Table types, draft and 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 // Natural language description of database requests
|
||||
2: required i64 bot_id // bot id
|
||||
3: required i64 connector_id // line of business id
|
||||
4: required string connector_uid // line of business user id
|
||||
5: required TableType table_type // Table types, draft and online
|
||||
6: optional string x_aiplugin_tako_bot_history // The chat history is passed to the nl2query service, which is parsed by nl2query
|
||||
7: optional string x_aiplugin_bot_system_message // bot_system_message passed to the nl2query service, which is parsed by 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 personality description
|
||||
ModelDesc = 2 // Text description of the model given by the developer
|
||||
}
|
||||
|
||||
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 // Which table to migrate
|
||||
2: i64 bot_id (api.js_conv="str") // Which bot to migrate?
|
||||
3: list<i64> table_ids (api.js_conv="str") // Failed retry
|
||||
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, // The maximum number of one page can be transferred, and the implementer can limit the maximum to 100.
|
||||
2 : i64 CurrentUserID, // The current user, the implementation is used to determine the authority
|
||||
255: base.Base Base ,
|
||||
}
|
||||
|
||||
struct MGetDisplayResourceInfoResponse {
|
||||
1 : list<DisplayResourceInfo> ResourceList,
|
||||
255: required base.BaseResp BaseResp,
|
||||
}
|
||||
|
||||
enum ActionKey{
|
||||
Copy = 1, //copy
|
||||
Delete = 2, //delete
|
||||
EnableSwitch = 3, //enable/disable
|
||||
Edit = 4, //edit
|
||||
CrossSpaceCopy = 10, // Cross-space copy
|
||||
}
|
||||
|
||||
enum PublishStatus{
|
||||
UnPublished = 1, //unpublished
|
||||
Published = 2, //Published
|
||||
}
|
||||
|
||||
|
||||
// Library Resource Operations
|
||||
struct ResourceAction{
|
||||
// An operation corresponds to a unique key, and the key is constrained by the resource side
|
||||
1 : required ActionKey Key (go.tag = "json:\"key\"", api.key = "key"),
|
||||
//ture = can operate this Action, false = grey out
|
||||
2 : required bool Enable (go.tag = "json:\"enable\"", api.key = "enable"),
|
||||
}
|
||||
|
||||
|
||||
// For display, the implementer provides display information
|
||||
struct DisplayResourceInfo{
|
||||
1 : optional i64 ResID, // Resource ID
|
||||
5 : optional string Desc,// resource description
|
||||
6 : optional string Icon,// Resource Icon, full url
|
||||
12 : optional i32 BizResStatus, // Resource status, each type of resource defines itself
|
||||
13 : optional bool CollaborationEnable, // Whether to enable multi-person editing
|
||||
16 : optional map<string, string> BizExtend, // Business carry extended information to res_type distinguish, each res_type defined schema and meaning is not the same, need to judge before use res_type
|
||||
17 : optional list<ResourceAction> Actions, // Different types of different operation buttons are agreed upon by the resource implementer and the front end. Return is displayed, if you want to hide a button, do not return;
|
||||
18 : optional bool DetailDisable, // Whether to ban entering the details page
|
||||
19 : optional string Name // resource name
|
||||
20 : optional PublishStatus PublishStatus, // Resource release status, 1 - unpublished, 2 - published
|
||||
21 : optional i64 EditTime, // Last edited, unix timestamp
|
||||
}
|
||||
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, // "< >" or "! ="
|
||||
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" fuzzy match string
|
||||
NOT_LIKE = 12, // "NOT LIKE" inverse fuzzy match
|
||||
}
|
||||
|
||||
struct Condition {
|
||||
1: required string left; // Lvalue field name
|
||||
2: required Operation operation;
|
||||
3: required string right; // rvalue
|
||||
}
|
||||
|
||||
struct ComplexCondition {
|
||||
1: optional list<Condition> conditions;
|
||||
2: optional ComplexCondition nestedConditions; // In order to expand, we don't need to
|
||||
3: required string logic; // "AND" or "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 id, wk flow latitude data isolation
|
||||
3: i64 project_id // Project id, not isolated under the same project
|
||||
4: i64 bot_id // bot id
|
||||
5: i64 connector_id // line of business id
|
||||
6: string connector_uid // line of business user id
|
||||
7: required TableType table_type // Table type
|
||||
8: string wftest_id // Workflow test run identification
|
||||
9: optional RefInfo ref_info // citation information
|
||||
10: optional list<SqlParamVal> sql_params (api.key="sql_params") // SQL params
|
||||
11: required OperateType operate_type // operation type
|
||||
12: optional SelectFieldList field_list // List of fields to query when selected
|
||||
13: optional list<OrderBy> order_by_list // Order by field list
|
||||
14: optional i64 limit // limit
|
||||
15: optional i64 offset // offset
|
||||
16: optional ComplexCondition condition // query condition
|
||||
17: optional list<Row> rows // Data to upsert
|
||||
}
|
||||
|
||||
struct SourceInfo {
|
||||
|
||||
// TOS address for local file upload
|
||||
1: optional string tos_uri (api.key="tos_uri");
|
||||
// imagex_uri, and tos_uri choose one, imagex_uri priority, need to get data and sign url through imagex method
|
||||
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") // Information from the 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") , // User selected sheet id
|
||||
2: i64 header_line_idx (api.js_conv="str", api.key="header_line_idx"), // The number of header rows selected by the user, numbered from 0
|
||||
3: i64 start_line_idx (api.js_conv="str", api.key="start_line_idx") , // User-selected starting line number, numbered from 0
|
||||
}
|
||||
|
||||
struct ValidateTableSchemaResponse {
|
||||
1: optional map<string,string> SchemaValidResult (api.key="schema_valid_result");
|
||||
// If it fails, an error code will be returned.
|
||||
253: required i64 code
|
||||
254: required string msg
|
||||
255: optional base.BaseResp BaseResp(api.none="true")
|
||||
}
|
||||
|
||||
struct GetTableSchemaRequest {
|
||||
1: optional TableSheet table_sheet; // Table parsing information, default initial value 0, 0, 1
|
||||
2: optional TableDataType table_data_type; // All data is returned by default without passing it on.
|
||||
3: optional i64 database_id(api.js_conv="str", api.key="database_id"); // Compatible with pre-refactoring versions: pass this value if you need to pull the schema of the current document
|
||||
4: optional SourceInfo source_file; // Source file information, add segment/before logic migrate here
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
enum TableDataType {
|
||||
AllData = 0 // Schema sheets and preview data
|
||||
OnlySchema = 1 // Only need schema structure & Sheets
|
||||
OnlyPreview = 2 // Just preview the data
|
||||
}
|
||||
|
||||
struct TableColumn {
|
||||
1: i64 id(api.js_conv="str", api.key="id") // Column ID
|
||||
2: string column_name // column_name
|
||||
3: i64 sequence(api.js_conv="str", api.key="sequence")// List the serial number originally in excel
|
||||
4: optional ColumnType column_type // column type
|
||||
5: optional bool contains_empty_value
|
||||
6: optional string desc // describe
|
||||
}
|
||||
|
||||
enum ColumnType {
|
||||
Unknown = 0
|
||||
Text = 1 // Text
|
||||
Number = 2 // number
|
||||
Date = 3 // time
|
||||
Float = 4 // float
|
||||
Boolean = 5 // bool
|
||||
Image = 6 // picture
|
||||
}
|
||||
|
||||
struct GetDatabaseFileProgressRequest {
|
||||
1: i64 database_id (api.js_conv="str")
|
||||
2: required TableType table_type // Table type
|
||||
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 //Describe the information if there is a representative file processing failure
|
||||
}
|
||||
|
||||
struct SubmitDatabaseInsertRequest {
|
||||
1: i64 database_id (api.js_conv="str")
|
||||
2: string file_uri
|
||||
3: TableType table_type // Table type, do you want to insert into the draft table or the online table?
|
||||
4: optional TableSheet table_sheet
|
||||
5: optional i64 connector_id (api.js_conv="str") // Channel ID to write to
|
||||
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 // Download address
|
||||
|
||||
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 // Whether to disable prompt
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct UpdateDatabaseBotSwitchResponse{
|
||||
253: required i64 code
|
||||
254: required string msg
|
||||
255: optional base.BaseResp BaseResp
|
||||
}
|
||||
119
idl/data/knowledge/common.thrift
Normal file
119
idl/data/knowledge/common.thrift
Normal file
@@ -0,0 +1,119 @@
|
||||
namespace go data.knowledge
|
||||
|
||||
// type
|
||||
enum FormatType {
|
||||
Text = 0 // Text
|
||||
Table = 1 // table
|
||||
Image = 2 // image
|
||||
Database = 3 // database
|
||||
}
|
||||
|
||||
struct ChunkStrategy {
|
||||
1: string separator // A separator, such as a period
|
||||
2: i64 max_tokens // Maximum number of tokens for sharding
|
||||
3: bool remove_extra_spaces // Replace consecutive spaces, newlines, and tabs
|
||||
4: bool remove_urls_emails // Remove URL and email
|
||||
5: ChunkType chunk_type // If 0, the configuration of the above fields is not used
|
||||
7: optional CaptionType caption_type // Image type, image description text annotation method
|
||||
8: optional i64 overlap; //segmented overlap
|
||||
9: optional i64 max_level; //Maximum number of levels (effective when segmented by level)
|
||||
10: optional bool save_title; //Slice preserves level headers (effective when segmented by level)
|
||||
}
|
||||
|
||||
enum ChunkType{
|
||||
DefaultChunk = 0
|
||||
CustomChunk = 1
|
||||
LevelChunk = 2
|
||||
}
|
||||
|
||||
enum ContentSchema{
|
||||
DefaultSchema = 0
|
||||
LinkReaderSchema = 1
|
||||
}
|
||||
|
||||
enum CaptionType {
|
||||
Auto = 0 // intelligent annotation
|
||||
Manual = 1 // manual annotation
|
||||
}
|
||||
|
||||
enum DocumentStatus {
|
||||
Processing = 0 // Uploading
|
||||
Enable = 1 // take effect
|
||||
Disable = 2 // failure
|
||||
Deleted = 3 // delete
|
||||
Resegment = 4 // In rescaling, the caller is not aware of the state
|
||||
Refreshing = 5 // Refreshing (will be deleted after successful refresh)
|
||||
Failed = 9 // fail
|
||||
}
|
||||
|
||||
enum DocumentSource {
|
||||
Document = 0 // local file upload
|
||||
Custom = 2 // custom type
|
||||
}
|
||||
|
||||
|
||||
struct ParsingStrategy{
|
||||
1: optional ParsingType parsing_type; //parse type
|
||||
2: optional bool image_extraction; //Whether to enable image element extraction (effective when accurately parsing)
|
||||
3: optional bool table_extraction; //Whether to enable table element extraction (effective when accurately parsing)
|
||||
4: optional bool image_ocr; //Whether to turn on picture OCR (effective when accurate analysis)
|
||||
}
|
||||
|
||||
enum ParsingType{
|
||||
FastParsing = 0 //fast parse
|
||||
AccurateParsing = 1 //accurate analysis
|
||||
}
|
||||
|
||||
struct IndexStrategy{
|
||||
1: optional bool vector_indexing; //Whether to enable vector indexing (default is true)
|
||||
2: optional bool keyword_indexing; //Whether to enable keyword indexing (default is true)
|
||||
3: optional bool hierarchical_indexing; //Whether to enable hierarchical indexing
|
||||
4: optional string model; //vector model
|
||||
}
|
||||
|
||||
struct FilterStrategy{
|
||||
1: optional list<i32> filter_page; //filter pages
|
||||
}
|
||||
|
||||
// sort field
|
||||
enum OrderField {
|
||||
CreateTime = 1
|
||||
UpdateTime = 2
|
||||
}
|
||||
|
||||
// OrderType
|
||||
enum OrderType {
|
||||
Desc = 1
|
||||
Asc = 2
|
||||
}
|
||||
|
||||
struct SinkStrategy {
|
||||
1: bool check_index // Check whether the index was successful
|
||||
}
|
||||
enum ReviewStatus {
|
||||
Processing = 0 // Processing
|
||||
Enable = 1 // Completed.
|
||||
Failed = 2 // fail
|
||||
ForceStop = 3 // fail
|
||||
}
|
||||
|
||||
// Table column information
|
||||
struct DocTableColumn {
|
||||
1: i64 id(agw.js_conv="str", api.js_conv="true", api.body="id"); // Column ID
|
||||
2: string column_name; // column_name
|
||||
3: bool is_semantic; // Is it a semantically matched column?
|
||||
4: i64 sequence(agw.js_conv="str", api.js_conv="true", api.body="sequence"); // List the serial number originally in excel
|
||||
5: optional ColumnType column_type; // column type
|
||||
6: optional bool contains_empty_value
|
||||
7: optional string desc; // describe
|
||||
}
|
||||
|
||||
enum ColumnType {
|
||||
Unknown = 0
|
||||
Text = 1 // Text
|
||||
Number = 2 // number
|
||||
Date = 3 // time
|
||||
Float = 4 // float
|
||||
Boolean = 5 // bool
|
||||
Image = 6 // picture
|
||||
}
|
||||
353
idl/data/knowledge/document.thrift
Normal file
353
idl/data/knowledge/document.thrift
Normal file
@@ -0,0 +1,353 @@
|
||||
include "../../base.thrift"
|
||||
include "common.thrift"
|
||||
|
||||
namespace go data.knowledge
|
||||
|
||||
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 // Search by name
|
||||
|
||||
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 // file link
|
||||
5: i32 create_time // create_time
|
||||
6: i32 update_time // update time
|
||||
7: optional i64 creator_id (agw.js_conv="str", api.js_conv='true', api.body="creator_id") // creator_id
|
||||
8: i32 slice_count // number of segments included
|
||||
9: string type // File suffix csv, pdf, etc
|
||||
10: i32 size // File size, number of bytes
|
||||
11: i32 char_count // character count
|
||||
12: common.DocumentStatus status // status
|
||||
13: i32 hit_count // hit count
|
||||
14: common.DocumentSource source_type // source
|
||||
18: common.FormatType format_type // file type
|
||||
19: optional list<TableColumn> table_meta // Table type metadata
|
||||
20: optional string web_url // URL address
|
||||
21: optional string status_descript // Details of the status; if the slice fails, return the failure information
|
||||
24: optional i64 space_id(agw.js_conv="str", api.js_conv="true") // Space ID
|
||||
|
||||
// The following fields are only useful for the reconstructed table type and are used for front-end judgment
|
||||
26: optional bool editable_append_content // Only for table types, are you allowed to add content and modify the table structure?
|
||||
27: common.ChunkStrategy chunk_strategy // slicing rule
|
||||
|
||||
28: optional string imagex_uri // File links stored by ImageX
|
||||
29: optional string doc_outline // Hierarchical Segmentation Document Tree Json (unused)
|
||||
30: optional common.ParsingStrategy parsing_strategy // parsing strategy
|
||||
32: optional common.FilterStrategy filter_strategy // filtering strategy
|
||||
33: optional string doc_tree_tos_url // Hierarchical segmented document tree tos_url
|
||||
34: optional string preview_tos_url // Preview the original document tos_url
|
||||
35: optional i64 review_id // Preview the original document tos_url
|
||||
}
|
||||
|
||||
struct TableColumn {
|
||||
1: i64 id(agw.js_conv="str", api.js_conv="true", api.body="id") // Column ID
|
||||
2: string column_name // column_name
|
||||
3: bool is_semantic // Is it a semantically matched column?
|
||||
4: i64 sequence(agw.js_conv="str", api.js_conv="true", api.body="sequence")// List the serial number originally in excel
|
||||
5: optional common.ColumnType column_type // column type
|
||||
6: optional bool contains_empty_value
|
||||
7: optional string desc // describe
|
||||
}
|
||||
|
||||
struct DeleteDocumentRequest {
|
||||
2: list<string> document_ids // List of document IDs to delete
|
||||
|
||||
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")
|
||||
|
||||
// If you need to update, please upload it and update the name.
|
||||
3: optional string document_name
|
||||
|
||||
|
||||
// Update table structure
|
||||
5: optional list<TableColumn> table_meta // Table metadata
|
||||
|
||||
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') // Document ID
|
||||
2: required string caption // Picture description information to be updated
|
||||
|
||||
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') // Knowledge ID
|
||||
2: optional i32 page // Number of pages, starting from 1
|
||||
3: optional i32 size // page size
|
||||
4: optional PhotoFilter filter
|
||||
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct PhotoFilter {
|
||||
1: optional bool has_caption // True to filter "marked" images, false to filter "unmarked" images
|
||||
2: optional string keyword // Search keywords, search for image names and picture descriptions
|
||||
3: optional common.DocumentStatus status // 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 { // Picture Knowledge Base One picture corresponds to one document
|
||||
1: string name // image name
|
||||
2: i64 document_id(agw.js_conv='str', api.js_conv='true') // Document ID
|
||||
3: string url // image link
|
||||
4: string caption // picture description information
|
||||
5: i32 create_time // create_time
|
||||
6: i32 update_time // update time
|
||||
7: i64 creator_id (agw.js_conv="str", api.js_conv='true', agw.key="creator_id", api.body="creator_id") // creator_id
|
||||
8: string type // Image suffix jpg, png, etc
|
||||
9: i32 size // image size
|
||||
10: common.DocumentStatus status // status
|
||||
11: common.DocumentSource source_type // source
|
||||
}
|
||||
|
||||
struct PhotoDetailRequest {
|
||||
1: required list<string> document_ids (agw.js_conv='str') // Document ID List
|
||||
2: required i64 dataset_id(agw.js_conv='str', api.js_conv='true') // Knowledge ID
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct PhotoDetailResponse {
|
||||
1: map<string, PhotoInfo> photo_infos // Mapping document ID to image information
|
||||
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") // Knowledge ID
|
||||
2: list<string> document_ids // Document to be re-segmented
|
||||
3: common.ChunkStrategy chunk_strategy // segmentation strategy
|
||||
5: optional common.ParsingStrategy parsing_strategy // parsing strategy
|
||||
7: optional common.FilterStrategy filter_strategy; // filtering strategy
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct ResegmentResponse {
|
||||
1: list<DocumentInfo> document_infos // The old version requires. Just return the id and name.
|
||||
|
||||
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') // The knowledge base id of the document to insert.
|
||||
|
||||
4: common.FormatType format_type // Types of knowledge bases, currently supporting text, tables, and images
|
||||
|
||||
// Only one table type can be created at a time
|
||||
6: list<DocumentBase> document_bases // Document information to be created
|
||||
|
||||
17: optional common.ChunkStrategy chunk_strategy // Only when there is no document in the knowledge base, it needs to be passed, and if there is one, it will be obtained from the knowledge base. Slicing rules, if it is empty, it will be automatically sliced by paragraph
|
||||
31: optional bool is_append // Appends content to an existing document when true. The text type cannot be used
|
||||
32: optional common.ParsingStrategy parsing_strategy // 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
|
||||
}
|
||||
|
||||
// Basic information for creating a document
|
||||
struct DocumentBase{
|
||||
1: string name // Document name
|
||||
2: SourceInfo source_info
|
||||
// The following parameter table types need to be passed
|
||||
4: optional list<TableColumn> table_meta // Table metadata
|
||||
5: optional TableSheet table_sheet // Table parsing information
|
||||
6: optional common.FilterStrategy filter_strategy // filtering strategy
|
||||
7: optional string caption // Image type knowledge base, picture description when manually annotated
|
||||
}
|
||||
|
||||
// Supports multiple data sources
|
||||
struct SourceInfo {
|
||||
1: optional string tos_uri (api.body="tos_uri"); // Upload the returned URI locally.
|
||||
|
||||
4: optional common.DocumentSource document_source (api.body="document_source");
|
||||
|
||||
// document_source custom raw content: Format required for a tabular knowledge base: json list < map < string, string > >
|
||||
5: optional string custom_content (api.body="custom_content")
|
||||
|
||||
// document_source local: If you don't send the tos address, you need to send the file base64, type
|
||||
7: optional string file_base64 // File string after base64
|
||||
8: optional string file_type // File type, such as PDF
|
||||
|
||||
// imagex_uri, and tos_uri choose one, imagex_uri priority, need to get data and sign url through imagex method
|
||||
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") , // User selected 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"), // The number of header rows selected by the user, numbered from 0
|
||||
3: i64 start_line_idx (agw.js_conv="str", agw.key="start_line_idx", api.js_conv="true", api.body="start_line_idx") , // User-selected starting line number, numbered from 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 // Knowledge Base Progress Percentage
|
||||
3: common.DocumentStatus status
|
||||
4: optional string status_descript // A detailed description of the status; if the slice fails, a failure message is returned
|
||||
5: string document_name
|
||||
6: optional i64 remaining_time // Remaining time in seconds
|
||||
7: optional i64 size
|
||||
8: optional string type
|
||||
9: optional string url
|
||||
}
|
||||
|
||||
// Get the table file meta information uploaded by the database
|
||||
struct GetTableSchemaRequest {
|
||||
1: optional TableSheet table_sheet; // Table parsing information, the default initial value is 0, 0, 1, which represents the first table, the first row of the table header, and the data row starts from the second row
|
||||
2: optional TableDataType table_data_type; // All data is returned by default without passing it on.
|
||||
3: optional i64 document_id(agw.js_conv="str", agw.key="document_id", api.js_conv="true", api.body="document_id"); // Compatible with pre-refactoring versions: pass this value if you need to pull the schema of the current document
|
||||
4: optional SourceInfo source_file; // Source file information, add segment/before logic migrate here
|
||||
5: optional list<TableColumn> origin_table_meta; // The table preview front end needs to pass the original data table structure
|
||||
6: optional list<TableColumn> preview_table_meta; // The table preview front end needs to pass the data table structure edited by the user
|
||||
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
enum TableDataType {
|
||||
AllData = 0 // Schema sheets and preview data
|
||||
OnlySchema = 1 // Only need schema structure & Sheets
|
||||
OnlyPreview = 2 // Just preview the data
|
||||
}
|
||||
|
||||
struct DocTableSheet {
|
||||
1: i64 id; // Number of sheet
|
||||
2: string sheet_name; // Sheet name
|
||||
3: i64 total_row; // total number of rows
|
||||
}
|
||||
|
||||
struct GetTableSchemaResponse {
|
||||
1: required i32 code
|
||||
2: required string msg
|
||||
3: list<DocTableSheet> sheet_list
|
||||
4: list<TableColumn> table_meta // The schema of the selected sheet, not selected to return the first sheet by default
|
||||
5: list<map<string,string>> preview_data(api.body="preview_data") // The knowledge table will return
|
||||
|
||||
255: optional base.BaseResp BaseResp(api.none="true")
|
||||
}
|
||||
|
||||
// Determine whether the schema configured by the user is consistent with the corresponding document id
|
||||
struct ValidateTableSchemaRequest {
|
||||
1: i64 space_id (agw.js_conv="str", agw.key="space_id", api.js_conv="true", api.body="space_id") // Space ID
|
||||
2: i64 document_id (agw.js_conv="str", agw.key="document_id", api.js_conv="true", api.body="document_id") // Document ID to verify
|
||||
3: SourceInfo source_info (api.body="source_file") // Information from the source file
|
||||
4: TableSheet table_sheet (api.body="table_sheet") // Table parsing information, the default initial value is 0, 0, 1, which represents the first table, the first row of the table header, and the data row starts from the second row
|
||||
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct ValidateTableSchemaResponse {
|
||||
1: optional map<string,string> ColumnValidResult (api.body="column_valid_result");
|
||||
// If it fails, an error code will be returned.
|
||||
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 // picture description
|
||||
253: required i64 code
|
||||
254: required string msg
|
||||
255: required base.BaseResp BaseResp(api.none="true")
|
||||
}
|
||||
|
||||
struct GetDocumentTableInfoRequest {
|
||||
2: optional string tos_uri; // If the table is uploaded for the first local file, pass the value
|
||||
3: optional i64 document_id(agw.js_conv="str", api.js_conv="true", api.body="document_id"); // If it is a document with an existing table, pass the value
|
||||
4: i64 creator_id; // Creator [http interface does not need to be passed]
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct GetDocumentTableInfoResponse {
|
||||
1: i32 code
|
||||
2: string msg
|
||||
3: list<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<DocTableSheet> sheet_list
|
||||
4: list<common.DocTableColumn> table_meta // The schema of the selected sheet, not selected to return the first sheet by default
|
||||
5: list<map<i64,string>> preview_data(agw.js_conv="str", agw.key="preview_data") // The knowledge table will return
|
||||
|
||||
255: optional base.BaseResp BaseResp(api.none="true")
|
||||
}
|
||||
185
idl/data/knowledge/knowledge.thrift
Normal file
185
idl/data/knowledge/knowledge.thrift
Normal file
@@ -0,0 +1,185 @@
|
||||
include "../../base.thrift"
|
||||
include "common.thrift"
|
||||
|
||||
|
||||
namespace go data.knowledge
|
||||
|
||||
struct CreateDatasetRequest {
|
||||
1: string name // Knowledge base name, no more than 100 characters in length
|
||||
2: string description // Knowledge Base Description
|
||||
3: i64 space_id (agw.js_conv="str", api.js_conv="true") // Space ID
|
||||
4: string icon_uri // Knowledge Base Avatar URI
|
||||
5: common.FormatType format_type
|
||||
6: i64 biz_id (agw.js_conv="str", api.js_conv="true") // Open to third-party business identity, coze pass 0 or no pass
|
||||
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 // soft delete
|
||||
DatasetForbid = 3 // Do not enable
|
||||
DatasetFailed = 9
|
||||
}
|
||||
|
||||
|
||||
struct Dataset {
|
||||
1: i64 dataset_id(agw.js_conv="str", api.js_conv="true")
|
||||
2: string name // Dataset name
|
||||
3: list<string> file_list // file list
|
||||
4: i64 all_file_size (agw.js_conv="str", api.js_conv="true") // All file sizes
|
||||
5: i32 bot_used_count // Bot count
|
||||
6: DatasetStatus status
|
||||
7: list<string> processing_file_list // List of file names in process, compatible with old logic
|
||||
8: i32 update_time // Update time, second timestamp
|
||||
9: string icon_url
|
||||
10: string description
|
||||
11: string icon_uri
|
||||
12: bool can_edit // Can it be edited?
|
||||
13: i32 create_time // create_time, second timestamp
|
||||
14: i64 creator_id (agw.js_conv="str", api.js_conv="true") // creator ID
|
||||
15: i64 space_id (agw.js_conv="str", api.js_conv="true") // Space ID
|
||||
18: list<string> failed_file_list (agw.js_conv="str") // Processing failed files
|
||||
|
||||
19: common.FormatType format_type
|
||||
20: i32 slice_count // number of segments
|
||||
21: i32 hit_count // hit count
|
||||
22: i32 doc_count // number of documents
|
||||
23: common.ChunkStrategy chunk_strategy // slicing rule
|
||||
|
||||
24: list<string> processing_file_id_list // List of file IDs in process
|
||||
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 // sort field
|
||||
7: optional common.OrderType order_type // order_type
|
||||
8: optional string space_auth // If the specified value is passed, the verification is released
|
||||
9: optional i64 biz_id (agw.js_conv="str", api.js_conv="true") // Business identity open to third parties
|
||||
10: optional bool need_ref_bots // Whether the number of reference bots needs to be pulled will increase the response delay
|
||||
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 {
|
||||
// The following conditions are related to and
|
||||
1: optional string name // Keyword search, fuzzy match by name
|
||||
2: optional list<string> dataset_ids (agw.js_conv="str") // Knowledge id list
|
||||
3: optional DatasetSource source_type // source
|
||||
4: optional DatasetScopeType scope_type // search type
|
||||
5: optional common.FormatType format_type // 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") // Knowledge ID
|
||||
2: string name // Knowledge base name, cannot be empty
|
||||
3: string icon_uri // Knowledge base icon
|
||||
4: string description // Knowledge Base 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
|
||||
}
|
||||
|
||||
struct GetModeConfigRequest {
|
||||
1: required i64 bot_id // bot id
|
||||
2: optional i64 connector_id // line of business id
|
||||
3: optional string connector_uid // line of business user 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
|
||||
}
|
||||
41
idl/data/knowledge/knowledge_svc.thrift
Normal file
41
idl/data/knowledge/knowledge_svc.thrift
Normal file
@@ -0,0 +1,41 @@
|
||||
include "slice.thrift"
|
||||
include "knowledge.thrift"
|
||||
include "document.thrift"
|
||||
include "common.thrift"
|
||||
include "review.thrift"
|
||||
|
||||
namespace go data.knowledge
|
||||
|
||||
service DatasetService {
|
||||
// Knowledge base related
|
||||
knowledge.GetIconResponse GetIconForDataset(1:knowledge.GetIconRequest req) (api.post='/api/knowledge/icon/get', api.category="knowledge",agw.preserve_base="true")
|
||||
knowledge.CreateDatasetResponse CreateDataset(1:knowledge.CreateDatasetRequest req) (api.post='/api/knowledge/create', api.category="knowledge",agw.preserve_base="true")
|
||||
knowledge.DatasetDetailResponse DatasetDetail(1:knowledge.DatasetDetailRequest req) (api.post='/api/knowledge/detail', api.category="knowledge",agw.preserve_base="true")
|
||||
knowledge.ListDatasetResponse ListDataset(1:knowledge.ListDatasetRequest req) (api.post='/api/knowledge/list', api.category="knowledge",agw.preserve_base="true")
|
||||
knowledge.DeleteDatasetResponse DeleteDataset(1:knowledge.DeleteDatasetRequest req) (api.post='/api/knowledge/delete', api.category="knowledge",agw.preserve_base="true")
|
||||
knowledge.UpdateDatasetResponse UpdateDataset(1:knowledge.UpdateDatasetRequest req) (api.post='/api/knowledge/update', api.category="knowledge",agw.preserve_base="true")
|
||||
knowledge.GetModeConfigResponse GetModeConfig(1:knowledge.GetModeConfigRequest req)(api.get='/api/memory/table_mode_config', api.category="memory", agw.preserve_base="true")
|
||||
// Document related
|
||||
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")
|
||||
document.GetDocumentTableInfoResponse GetDocumentTableInfo(1:document.GetDocumentTableInfoRequest req) (api.get='/api/memory/doc_table_info', api.category="memory", agw.preserve_base="true")
|
||||
// Slice related
|
||||
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")
|
||||
/** Pre-sharding related **/
|
||||
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")
|
||||
}
|
||||
69
idl/data/knowledge/review.thrift
Normal file
69
idl/data/knowledge/review.thrift
Normal file
@@ -0,0 +1,69 @@
|
||||
include "../../base.thrift"
|
||||
include "common.thrift"
|
||||
|
||||
namespace go data.knowledge
|
||||
|
||||
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 // 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
|
||||
}
|
||||
|
||||
|
||||
78
idl/data/knowledge/slice.thrift
Normal file
78
idl/data/knowledge/slice.thrift
Normal file
@@ -0,0 +1,78 @@
|
||||
include "../../base.thrift"
|
||||
include "common.thrift"
|
||||
|
||||
namespace go data.knowledge
|
||||
|
||||
struct DeleteSliceRequest {
|
||||
4: optional list<string> slice_ids (api.body="slice_ids") // List of sharding IDs to delete
|
||||
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") // Add sharding inserted document ID
|
||||
5: optional string raw_text // Add sharding content
|
||||
6: optional i64 sequence(agw.js_conv="str", api.js_conv="true") // Sharding insertion position, 1 indicates the beginning of the document, and the maximum value is the last sharding position + 1
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct CreateSliceResponse {
|
||||
1: i64 slice_id (agw.js_conv="str", api.js_conv="true") // Add sharding 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") // The sharding ID to update
|
||||
7: optional string raw_text // Content to be updated
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
enum SliceStatus {
|
||||
PendingVectoring = 0 // unvectorized
|
||||
FinishVectoring = 1 // vectorized
|
||||
Deactive = 9 // disable
|
||||
}
|
||||
|
||||
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") // The document ID of the sharding to list
|
||||
3: optional i64 sequence(agw.js_conv="str", api.js_conv="true") // Sharding serial number, indicating that the list starts from the sharding of this serial number
|
||||
4: optional string keyword // query keyword
|
||||
5: optional i64 dataset_id (agw.js_conv="str", api.js_conv="true") // If only dataset_id, return sharding under that knowledge base
|
||||
21: i64 page_size(agw.js_conv="str", api.js_conv="true") // page size
|
||||
255: optional base.Base Base
|
||||
}
|
||||
|
||||
struct ListSliceResponse {
|
||||
1: list<SliceInfo> slices // Returned list of shardings
|
||||
2: i64 total(agw.js_conv="str", api.js_conv="true") // Total shardings
|
||||
3: bool hasmore // Is there more sharding?
|
||||
|
||||
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") // Sharding ID
|
||||
2: string content // Sharding content
|
||||
3: SliceStatus status // Sharding state
|
||||
4: i64 hit_count(agw.js_conv="str", api.js_conv="true") // hit count
|
||||
5: i64 char_count(agw.js_conv="str", api.js_conv="true") // character count
|
||||
7: i64 sequence(agw.js_conv="str", api.js_conv="true") // serial number
|
||||
8: i64 document_id(agw.js_conv="str", api.js_conv="true") // The document ID to which sharding belongs
|
||||
9: string chunk_info // Meta information related to sharding, extra- > chunk_info field in the transparent slice table (json)
|
||||
}
|
||||
112
idl/data/variable/kvmemory.thrift
Normal file
112
idl/data/variable/kvmemory.thrift
Normal file
@@ -0,0 +1,112 @@
|
||||
include "../../base.thrift"
|
||||
include "../database/table.thrift"
|
||||
include "./project_memory.thrift"
|
||||
|
||||
namespace go data.variable.kvmemory
|
||||
|
||||
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 // citation information
|
||||
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 // citation information
|
||||
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 // citation information
|
||||
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
|
||||
}
|
||||
95
idl/data/variable/project_memory.thrift
Normal file
95
idl/data/variable/project_memory.thrift
Normal file
@@ -0,0 +1,95 @@
|
||||
include "../../base.thrift"
|
||||
|
||||
namespace go data.variable.project_memory
|
||||
|
||||
enum VariableType{
|
||||
KVVariable = 1
|
||||
ListVariable = 2
|
||||
}
|
||||
|
||||
enum VariableChannel{
|
||||
Custom = 1
|
||||
System = 2
|
||||
Location = 3
|
||||
Feishu = 4
|
||||
APP = 5 // project variable
|
||||
}
|
||||
|
||||
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 //effective channel
|
||||
8: string Schema //New and old data will have schemas, except for project variables, the default is 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
|
||||
}
|
||||
|
||||
//It should be the rpc interface for workflow, no authentication is required, VariableChannel
|
||||
struct GetMemoryVariableMetaResp {
|
||||
1: map<VariableChannel, list<Variable>> VariableMap
|
||||
|
||||
253: required i64 code
|
||||
254: required string msg
|
||||
255: required base.BaseResp BaseResp
|
||||
}
|
||||
|
||||
|
||||
16
idl/data/variable/variable_svc.thrift
Normal file
16
idl/data/variable/variable_svc.thrift
Normal file
@@ -0,0 +1,16 @@
|
||||
include "kvmemory.thrift"
|
||||
include "project_memory.thrift"
|
||||
|
||||
namespace go data.variable
|
||||
|
||||
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")
|
||||
// ---
|
||||
}
|
||||
Reference in New Issue
Block a user