@tbox-dev-js/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,185 @@
1
+ /**
2
+ * 知识库 SDK - KnowledgeClient 核心类
3
+ *
4
+ * 封装知识库管理功能,通过百宝箱服务接口实现知识库的创建和管理。
5
+ */
6
+ import type { KnowledgeClientConfig, KnowledgeCreateRequest, KnowledgeCreateResponse, KnowledgeUpdateRequest, KnowledgeUpdateResponse, KnowledgeQueryListRequest, KnowledgeQueryListResponse, KnowledgeRetrieveRequest, KnowledgeRetrieveResponse, SdkResponse } from './types';
7
+ /**
8
+ * 知识库客户端
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { KnowledgeClient } from '@tbox/plugin-sdk';
13
+ *
14
+ * const client = new KnowledgeClient({ apiKey: 'your-api-key' });
15
+ *
16
+ * // 创建结构化知识库
17
+ * const res = await client.createKnowledgeBase({
18
+ * file: fileBlob,
19
+ * type: 'STRUCTURED',
20
+ * tableSchema: {
21
+ * columns: [
22
+ * { name: 'id', dataType: 'STRING', required: true, order: 1 },
23
+ * { name: 'name', dataType: 'STRING', required: false, order: 2 }
24
+ * ],
25
+ * name: '示例表'
26
+ * },
27
+ * indexColumns: ['id']
28
+ * });
29
+ * if (res.success) {
30
+ * console.log(`文档 ID: ${res.data?.documentId}`);
31
+ * }
32
+ * ```
33
+ */
34
+ export declare class KnowledgeClient {
35
+ private readonly http;
36
+ constructor(config: KnowledgeClientConfig);
37
+ /**
38
+ * 创建知识库
39
+ *
40
+ * 通过上传文件创建知识库,支持结构化和非结构化数据。
41
+ *
42
+ * @param request - 创建知识库请求
43
+ * - `file`(必填):上传的文件(如 .xlsx、.pdf 等)
44
+ * - `type`(必填):数据类型,`STRUCTURED`(结构化)或其他类型
45
+ * - `tableSchema`(条件必填):表格 Schema 定义,当 type = STRUCTURED 时必填
46
+ * - `indexColumns`(条件必填):索引列名列表,当 type = STRUCTURED 时必填
47
+ * @returns 创建知识库结果
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * // 从本地文件创建结构化知识库
52
+ * const fileInput = document.querySelector('input[type="file"]');
53
+ * const file = fileInput.files[0];
54
+ *
55
+ * const res = await client.createKnowledgeBase({
56
+ * file: file,
57
+ * type: 'STRUCTURED',
58
+ * tableSchema: {
59
+ * columns: [
60
+ * { name: 'id', dataType: 'STRING', required: true, order: 1 },
61
+ * { name: 'message_id', dataType: 'STRING', required: false, order: 2 },
62
+ * { name: 'content', dataType: 'STRING', required: false, order: 3 }
63
+ * ],
64
+ * name: '消息记录',
65
+ * description: '用于存储消息数据'
66
+ * },
67
+ * indexColumns: ['id', 'message_id']
68
+ * });
69
+ *
70
+ * if (res.success) {
71
+ * console.log(`创建成功,文档 ID: ${res.data?.documentId}`);
72
+ * } else {
73
+ * console.error(`创建失败: ${res.errorMsg}`);
74
+ * }
75
+ * ```
76
+ */
77
+ createKnowledgeBase(request: KnowledgeCreateRequest): Promise<SdkResponse<KnowledgeCreateResponse>>;
78
+ /**
79
+ * 更新知识库
80
+ *
81
+ * 通过上传文件更新已有的知识库文档,支持覆盖更新和增量更新。
82
+ *
83
+ * @param request - 更新知识库请求
84
+ * - `file`(必填):上传的文件(如 .xlsx、.pdf 等)
85
+ * - `type`(必填):数据类型,`STRUCTURED`(结构化)或其他类型
86
+ * - `documentId`(必填):要更新的文档 ID(从创建响应中获取)
87
+ * - `tableSchema`(可选):表格 Schema 定义,结构化数据需要
88
+ * - `updateMode`(可选):更新模式,`OVERWRITE`(覆盖更新)或 `UPSERT`(增量更新,默认)
89
+ * @returns 更新知识库结果
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * // 覆盖更新知识库
94
+ * const res = await client.updateKnowledgeBase({
95
+ * file: newFile,
96
+ * type: 'STRUCTURED',
97
+ * documentId: '20251128999def29600J6WS04301922',
98
+ * tableSchema: {
99
+ * columns: [
100
+ * { name: 'id', dataType: 'STRING', required: true, order: 1 },
101
+ * { name: 'message_id', dataType: 'STRING', required: false, order: 2 },
102
+ * { name: 'content', dataType: 'STRING', required: false, order: 3 }
103
+ * ],
104
+ * name: '消息记录'
105
+ * },
106
+ * updateMode: 'OVERWRITE'
107
+ * });
108
+ *
109
+ * if (res.success) {
110
+ * console.log(`更新成功,文档 ID: ${res.data?.documentId}`);
111
+ * } else {
112
+ * console.error(`更新失败: ${res.errorMsg}`);
113
+ * }
114
+ * ```
115
+ */
116
+ updateKnowledgeBase(request: KnowledgeUpdateRequest): Promise<SdkResponse<KnowledgeUpdateResponse>>;
117
+ /**
118
+ * 查询知识库列表
119
+ *
120
+ * 通过名称模糊查询知识库,返回知识库 ID 和基本信息。
121
+ *
122
+ * @param request - 查询请求
123
+ * - `name`(可选):知识库名称(支持模糊查询)
124
+ * - `pageNo`(可选):页码,从 1 开始,默认 1
125
+ * - `pageSize`(可选):每页条数,默认 10
126
+ * @returns 知识库列表
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * // 查询知识库列表
131
+ * const res = await client.queryDatasetsList({
132
+ * name: '用户知识库'
133
+ * });
134
+ *
135
+ * if (res.success) {
136
+ * for (const item of res.data?.datasets ?? []) {
137
+ * console.log(`ID: ${item.datasetId}, 名称: ${item.name}`);
138
+ * }
139
+ * } else {
140
+ * console.error(`查询失败: ${res.errorMsg}`);
141
+ * }
142
+ * ```
143
+ */
144
+ queryDatasetsList(request?: KnowledgeQueryListRequest): Promise<SdkResponse<KnowledgeQueryListResponse>>;
145
+ /**
146
+ * 检索知识库
147
+ *
148
+ * 通过自然语言查询知识库内容,返回相关度最高的内容片段。
149
+ * 支持两种方式获取知识库:
150
+ * 1. 直接传入 datasetId
151
+ * 2. 传入 name,SDK 会自动查询获取 datasetId
152
+ *
153
+ * @param request - 检索知识库请求
154
+ * - `name`(可选):知识库名称,SDK 会自动查询获取 datasetId
155
+ * - `datasetId`(可选):知识库 ID(优先使用)
156
+ * - `query`(必填):查询内容(自然语言描述)
157
+ * @returns 检索结果
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * // 方式 1: 通过名称自动查询
162
+ * const res = await client.retrieve({
163
+ * name: '用户知识库',
164
+ * query: '消防安全管理制度'
165
+ * });
166
+ *
167
+ * // 方式 2: 直接传入 datasetId
168
+ * const res = await client.retrieve({
169
+ * datasetId: '20251024999def29600U6J302721040',
170
+ * query: '消防安全管理制度'
171
+ * });
172
+ *
173
+ * if (res.success) {
174
+ * for (const item of res.data?.data ?? []) {
175
+ * console.log(`文件: ${item.originFileName}`);
176
+ * console.log(`内容: ${item.content}`);
177
+ * console.log(`相关度: ${item.score}`);
178
+ * }
179
+ * } else {
180
+ * console.error(`检索失败: ${res.errorMsg}`);
181
+ * }
182
+ * ```
183
+ */
184
+ retrieve(request: KnowledgeRetrieveRequest): Promise<SdkResponse<KnowledgeRetrieveResponse>>;
185
+ }
package/dist/llm.d.ts ADDED
@@ -0,0 +1,121 @@
1
+ /**
2
+ * LLM SDK - LlmClient 核心类
3
+ *
4
+ * 封装大语言模型调用功能,提供 OpenAI 兼容的 Chat Completions 接口。
5
+ */
6
+ import type { LlmClientConfig, ChatCompletionRequest, ChatCompletionResponse, ChatCompletionChunk, ChatMessage } from './types';
7
+ /**
8
+ * LLM 客户端
9
+ *
10
+ * 提供大语言模型调用能力,支持流式和非流式输出。
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { LlmClient } from '@tbox/plugin-sdk';
15
+ *
16
+ * const client = new LlmClient({ apiKey: 'your-api-key' });
17
+ *
18
+ * // 流式调用
19
+ * const stream = await client.chatCompletions({
20
+ * model: 'kimi-k2.5',
21
+ * messages: [{ role: 'user', content: '你好' }],
22
+ * stream: true
23
+ * });
24
+ *
25
+ * for await (const chunk of stream) {
26
+ * process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
27
+ * }
28
+ * ```
29
+ */
30
+ export declare class LlmClient {
31
+ private readonly http;
32
+ constructor(config: LlmClientConfig);
33
+ /**
34
+ * Chat Completions 对话补全
35
+ *
36
+ * 支持流式和非流式两种模式:
37
+ * - 流式(stream=true):返回 AsyncIterable<ChatCompletionChunk>
38
+ * - 非流式(stream=false):返回 ChatCompletionResponse
39
+ *
40
+ * @param request - 对话补全请求
41
+ * - `model`(必填):模型名称
42
+ * - `messages`(必填):对话消息列表
43
+ * - `stream`(可选):是否流式输出,默认 false
44
+ * - `temperature`(可选):温度参数,范围 0~2
45
+ * - `top_p`(可选):核采样参数,范围 0~1,推荐 0.95
46
+ * - `max_tokens`(可选):最大输出 token 数,推荐 8000
47
+ * - `stream_options`(可选):流式选项,`{ include_usage: true }` 可在末尾返回 token 用量
48
+ * @returns 流式返回 AsyncIterable,非流式返回完整响应
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * // 流式调用
53
+ * const stream = await client.chatCompletions({
54
+ * model: 'kimi-k2.5',
55
+ * messages: [
56
+ * { role: 'system', content: '你是一个有帮助的助手' },
57
+ * { role: 'user', content: '你好,请介绍一下你自己' }
58
+ * ],
59
+ * stream: true,
60
+ * stream_options: { include_usage: true }
61
+ * });
62
+ *
63
+ * for await (const chunk of stream) {
64
+ * const content = chunk.choices[0]?.delta?.content;
65
+ * if (content) {
66
+ * process.stdout.write(content);
67
+ * }
68
+ * // 检查是否结束
69
+ * if (chunk.choices[0]?.finish_reason === 'stop') {
70
+ * console.log('\n对话结束');
71
+ * }
72
+ * // 获取 token 用量(需要 stream_options.include_usage=true)
73
+ * if (chunk.usage) {
74
+ * console.log(`Token 用量: ${chunk.usage.total_tokens}`);
75
+ * }
76
+ * }
77
+ * ```
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * // 非流式调用
82
+ * const response = await client.chatCompletions({
83
+ * model: 'kimi-k2.5',
84
+ * messages: [
85
+ * { role: 'user', content: '你好' }
86
+ * ],
87
+ * stream: false
88
+ * });
89
+ *
90
+ * console.log(response.choices[0]?.message?.content);
91
+ * ```
92
+ */
93
+ chatCompletions(request: ChatCompletionRequest): Promise<ChatCompletionResponse | AsyncIterable<ChatCompletionChunk>>;
94
+ /**
95
+ * 流式调用 Chat Completions
96
+ */
97
+ private streamChatCompletions;
98
+ /**
99
+ * 简化的对话方法
100
+ *
101
+ * 快速发起一次对话,自动处理流式输出。
102
+ *
103
+ * @param model - 模型名称
104
+ * @param messages - 对话消息列表
105
+ * @param options - 可选参数
106
+ * @returns 完整的对话内容(对于推理模型,返回推理内容 + 正式内容)
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * const answer = await client.chat('kimi-k2.5', [
111
+ * { role: 'user', content: '你好' }
112
+ * ]);
113
+ * console.log(answer);
114
+ * ```
115
+ */
116
+ chat(model: string, messages: ChatMessage[], options?: {
117
+ temperature?: number;
118
+ top_p?: number;
119
+ max_tokens?: number;
120
+ }): Promise<string>;
121
+ }
@@ -0,0 +1,118 @@
1
+ /**
2
+ * 百宝箱插件服务 SDK - PluginClient 核心类
3
+ *
4
+ * 封装 /openapi/v1/plugin 下的全部接口
5
+ */
6
+ import type { TboxPluginClientConfig, TtsRequest, TtsResponse, AsrRequest, AsrResponse, PluginToolExecRequest, PluginExecResult, PluginInfo, WebSearchRequest, WebSearchResponse, SdkResponse } from './types';
7
+ /**
8
+ * 百宝箱插件服务客户端
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { TboxPluginClient } from '@tbox/plugin-sdk';
13
+ *
14
+ * const client = new TboxPluginClient({ apiKey: 'your-api-key' });
15
+ *
16
+ * // 执行插件工具
17
+ * const result = await client.run('tool-id-xxx', { params: { key: 'value' } });
18
+ * ```
19
+ */
20
+ export declare class TboxPluginClient {
21
+ private readonly http;
22
+ constructor(config: TboxPluginClientConfig);
23
+ /**
24
+ * 文字转语音
25
+ *
26
+ * POST /openapi/v1/plugin/doTts
27
+ *
28
+ * @param request - TTS 请求参数
29
+ * @returns 音频数据(Base64 或 URL)
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const res = await client.doTts({ text: '你好,世界' });
34
+ * if (res.success) {
35
+ * console.log(res.data?.audioBase64);
36
+ * }
37
+ * ```
38
+ */
39
+ doTts(request: TtsRequest): Promise<SdkResponse<TtsResponse>>;
40
+ /**
41
+ * 语音转文字(Base64 音频输入)
42
+ *
43
+ * POST /openapi/v1/plugin/asrBase64V2
44
+ *
45
+ * @param request - ASR 请求参数,音频以 Base64 格式传入
46
+ * @returns 识别出的文本
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const res = await client.asrBase64({ audioBase64: '<base64-string>', format: 'mp3' });
51
+ * if (res.success) {
52
+ * console.log(res.data?.text);
53
+ * }
54
+ * ```
55
+ */
56
+ asrBase64(request: AsrRequest): Promise<SdkResponse<AsrResponse>>;
57
+ /**
58
+ * 按工具 ID 执行插件工具
59
+ *
60
+ * POST /openapi/v1/plugin/run/{pluginToolId}
61
+ *
62
+ * 适用于已知工具 ID 的场景,调用更直接、性能更好。
63
+ *
64
+ * @param pluginToolId - 插件工具 ID
65
+ * @param request - 工具执行请求(含输入参数)
66
+ * @returns 工具执行结果
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const res = await client.run('tool-id-xxx', {
71
+ * inputs: { city: '杭州' },
72
+ * });
73
+ * if (res.success) {
74
+ * console.log(res.data?.output);
75
+ * }
76
+ * ```
77
+ */
78
+ run(pluginToolId: string, request: PluginToolExecRequest): Promise<SdkResponse<PluginExecResult>>;
79
+ /**
80
+ * 查询插件配置信息(含工具集)
81
+ *
82
+ * GET /openapi/v1/plugin/info/{pluginId}
83
+ *
84
+ * @param pluginId - 插件 ID
85
+ * @returns 插件信息,包含插件名称、描述及工具列表
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * const res = await client.getPluginInfo('plugin-id');
90
+ * if (res.success) {
91
+ * console.log(res.data?.pluginToolList);
92
+ * }
93
+ * ```
94
+ */
95
+ getPluginInfo(pluginId: string): Promise<SdkResponse<PluginInfo>>;
96
+ /** 网络搜索工具的固定工具 ID */
97
+ private static readonly WEB_SEARCH_TOOL_ID;
98
+ /**
99
+ * 网络搜索
100
+ *
101
+ * 内部调用 run('20240611204600000001', ...) 实现,对外屏蔽工具 ID 细节。
102
+ * 服务端响应层级:result.result.result.data[],SDK 自动解包为扁平的 items 列表。
103
+ *
104
+ * @param request - 搜索请求,包含关键词 q
105
+ * @returns 搜索结果列表
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * const res = await client.webSearch({ q: '上海今天天气' });
110
+ * if (res.success) {
111
+ * for (const item of res.data?.items ?? []) {
112
+ * console.log(item.title, item.url);
113
+ * }
114
+ * }
115
+ * ```
116
+ */
117
+ webSearch(request: WebSearchRequest): Promise<SdkResponse<WebSearchResponse>>;
118
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @tbox/sdk — APIResource 基类
3
+ *
4
+ * 所有 Resource 子类(Knowledge、Plugins 等)继承此类,
5
+ * 通过 this._client 引用 APIClient 发起请求。
6
+ */
7
+ import type { APIClient } from './core';
8
+ export declare class APIResource {
9
+ protected _client: APIClient;
10
+ constructor(client: APIClient);
11
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @tbox/sdk — Knowledge Documents sub-resource
3
+ *
4
+ * Handles knowledge base creation and update (multipart/form-data uploads).
5
+ */
6
+ import { APIResource } from '../../resource';
7
+ import type { RequestOptions } from '../../core';
8
+ import type { DocumentCreateParams, DocumentCreateResult, DocumentUpdateParams, DocumentUpdateResult } from './types';
9
+ export declare class Documents extends APIResource {
10
+ /**
11
+ * Create a knowledge base by uploading a file.
12
+ *
13
+ * POST /openapi/v1/knowledge/createKnowledgeBaseByDataSet
14
+ * Content-Type: multipart/form-data
15
+ */
16
+ create(params: DocumentCreateParams, options?: RequestOptions): Promise<DocumentCreateResult>;
17
+ /**
18
+ * Update an existing knowledge base document.
19
+ *
20
+ * POST /openapi/v1/knowledge/updateDocument
21
+ * Content-Type: multipart/form-data
22
+ */
23
+ update(params: DocumentUpdateParams, options?: RequestOptions): Promise<DocumentUpdateResult>;
24
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @tbox/sdk — Knowledge Resource
3
+ *
4
+ * Provides knowledge base list, semantic retrieval, and document management.
5
+ */
6
+ import { APIResource } from '../../resource';
7
+ import type { APIClient, RequestOptions } from '../../core';
8
+ import { Documents } from './documents';
9
+ import type { DatasetListParams, DatasetListResult, RetrieveParams, RetrieveResult } from './types';
10
+ export declare class Knowledge extends APIResource {
11
+ /** Document management sub-resource (create / update). */
12
+ readonly documents: Documents;
13
+ constructor(client: APIClient);
14
+ /**
15
+ * Query knowledge base list.
16
+ *
17
+ * GET /api/datasets/queryDatasetsList
18
+ */
19
+ list(params?: DatasetListParams, options?: RequestOptions): Promise<DatasetListResult>;
20
+ /**
21
+ * Semantic retrieval against a knowledge base.
22
+ *
23
+ * POST /api/datasets/retrieve
24
+ */
25
+ retrieve(params: RetrieveParams, options?: RequestOptions): Promise<RetrieveResult>;
26
+ }
27
+ export { Documents } from './documents';
28
+ export type { DatasetListParams, DatasetListResult, DatasetInfo, RetrieveParams, RetrieveResult, RetrieveRecord, DocumentCreateParams, DocumentCreateResult, DocumentUpdateParams, DocumentUpdateResult, TableSchema, ColumnSchema, } from './types';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @tbox/sdk — Knowledge 模块 ResourceSchema 定义
3
+ *
4
+ * 用 JSON Schema 风格描述知识库的 4 个核心 API 操作,
5
+ * 端侧可据此动态渲染表单、校验参数、生成配置。
6
+ */
7
+ import type { ResourceDefinition } from '../../schema';
8
+ /** Knowledge resource schema — the complete definition */
9
+ export declare const knowledgeSchema: ResourceDefinition;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * @tbox/sdk — Knowledge 模块类型定义
3
+ */
4
+ export interface DatasetListParams {
5
+ /** 知识库名称(模糊搜索) */
6
+ name?: string;
7
+ /** 页码,从 1 开始 */
8
+ pageNo?: number;
9
+ /** 每页条数 */
10
+ pageSize?: number;
11
+ }
12
+ export interface DatasetListResult {
13
+ /** 知识库列表 */
14
+ data: DatasetInfo[];
15
+ /** 总条数 */
16
+ totalCount: number;
17
+ }
18
+ export interface DatasetInfo {
19
+ /** 知识库 ID */
20
+ datasetId: string;
21
+ /** 知识库名称 */
22
+ name: string;
23
+ /** 知识库描述 */
24
+ description?: string;
25
+ /** 知识库类型 */
26
+ type: 'STRUCTURED' | 'UNSTRUCTURED';
27
+ /** 文档数量 */
28
+ documentCount?: number;
29
+ /** 存储大小 */
30
+ storageSize?: number;
31
+ /** 创建时间 */
32
+ createdAt?: string;
33
+ /** 更新时间 */
34
+ updatedAt?: string;
35
+ }
36
+ export interface RetrieveParams {
37
+ /** 知识库 ID(必填) */
38
+ datasetId: string;
39
+ /** 检索查询文本(必填) */
40
+ query: string;
41
+ /** 返回结果数量上限 */
42
+ topK?: number;
43
+ /** 最低相关度分数阈值 */
44
+ scoreThreshold?: number;
45
+ }
46
+ export interface RetrieveResult {
47
+ /** 检索结果列表 */
48
+ data: RetrieveRecord[];
49
+ }
50
+ export interface RetrieveRecord {
51
+ /** 文档片段内容 */
52
+ content: string;
53
+ /** 相关度分数 (0~1) */
54
+ score: number;
55
+ /** 来源文件名 */
56
+ originFileName?: string;
57
+ /** 来源文档 ID */
58
+ documentId?: string;
59
+ /** 元数据 */
60
+ metadata?: Record<string, unknown>;
61
+ }
62
+ export interface DocumentCreateParams {
63
+ /** 上传的文件(必填) */
64
+ file: Blob;
65
+ /** 知识库类型(必填) */
66
+ type: 'STRUCTURED' | 'UNSTRUCTURED';
67
+ /** 表结构定义(STRUCTURED 类型必填) */
68
+ tableSchema?: TableSchema;
69
+ /** 索引列名列表 */
70
+ indexColumns?: string[];
71
+ }
72
+ export interface TableSchema {
73
+ /** 表名 */
74
+ name: string;
75
+ /** 表描述 */
76
+ description?: string;
77
+ /** 列定义列表 */
78
+ columns: ColumnSchema[];
79
+ }
80
+ export interface ColumnSchema {
81
+ /** Column name */
82
+ name: string;
83
+ /** Data type (e.g. "STRING", "INTEGER") */
84
+ dataType?: string;
85
+ /** Whether this column is a primary key */
86
+ primaryKey?: boolean;
87
+ /** Whether this column is required */
88
+ required?: boolean;
89
+ /** Column description */
90
+ description?: string;
91
+ /** Default value */
92
+ defaultValue?: string;
93
+ /** Sort order */
94
+ order?: number;
95
+ }
96
+ export interface DocumentCreateResult {
97
+ /** 创建的文档 ID */
98
+ documentId: string;
99
+ }
100
+ export interface DocumentUpdateParams {
101
+ /** 要更新的文档 ID(必填) */
102
+ documentId: string;
103
+ /** 上传的新文件(必填) */
104
+ file: Blob;
105
+ /** 知识库类型(必填) */
106
+ type: 'STRUCTURED' | 'UNSTRUCTURED';
107
+ /** 更新模式:OVERWRITE(覆盖) / UPSERT(增量,默认) */
108
+ updateMode?: 'OVERWRITE' | 'UPSERT';
109
+ /** 表结构定义 */
110
+ tableSchema?: TableSchema;
111
+ /** 索引列名列表 */
112
+ indexColumns?: string[];
113
+ }
114
+ export interface DocumentUpdateResult {
115
+ /** 更新的文档 ID */
116
+ documentId: string;
117
+ }