@getnote/mcp 1.3.1
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.
- package/.github/workflows/release.yml +32 -0
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/client.d.ts +406 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +244 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +861 -0
- package/package.json +42 -0
- package/src/client.ts +714 -0
- package/src/index.ts +897 -0
- package/tsconfig.json +19 -0
package/src/client.ts
ADDED
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
import axios, { AxiosInstance, AxiosError } from "axios";
|
|
2
|
+
|
|
3
|
+
const BASE_URL = "https://openapi.biji.com/open/api/v1";
|
|
4
|
+
|
|
5
|
+
export class GetNoteAPIError extends Error {
|
|
6
|
+
constructor(
|
|
7
|
+
public readonly code: number,
|
|
8
|
+
public readonly reason: string,
|
|
9
|
+
message: string,
|
|
10
|
+
public readonly requestId?: string
|
|
11
|
+
) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = "GetNoteAPIError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class GetNoteClient {
|
|
18
|
+
private http: AxiosInstance;
|
|
19
|
+
|
|
20
|
+
constructor(apiKey: string, clientId: string) {
|
|
21
|
+
this.http = axios.create({
|
|
22
|
+
baseURL: BASE_URL,
|
|
23
|
+
headers: {
|
|
24
|
+
Authorization: `Bearer ${apiKey}`,
|
|
25
|
+
"X-Client-ID": clientId,
|
|
26
|
+
"Content-Type": "application/json",
|
|
27
|
+
},
|
|
28
|
+
timeout: 30000,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
this.http.interceptors.response.use(
|
|
32
|
+
(res) => res,
|
|
33
|
+
(err: AxiosError) => {
|
|
34
|
+
throw err;
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private async request<T>(
|
|
40
|
+
method: "GET" | "POST",
|
|
41
|
+
path: string,
|
|
42
|
+
params?: Record<string, unknown>,
|
|
43
|
+
data?: unknown
|
|
44
|
+
): Promise<T> {
|
|
45
|
+
try {
|
|
46
|
+
const res = await this.http.request<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
data: T;
|
|
49
|
+
error?: { code: number; message: string; reason: string };
|
|
50
|
+
request_id?: string;
|
|
51
|
+
}>({
|
|
52
|
+
method,
|
|
53
|
+
url: path,
|
|
54
|
+
params,
|
|
55
|
+
data,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const body = res.data;
|
|
59
|
+
if (!body.success) {
|
|
60
|
+
const err = body.error;
|
|
61
|
+
throw new GetNoteAPIError(
|
|
62
|
+
err?.code ?? -1,
|
|
63
|
+
err?.reason ?? "unknown",
|
|
64
|
+
err?.message ?? "API request failed",
|
|
65
|
+
body.request_id
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return body.data;
|
|
70
|
+
} catch (err) {
|
|
71
|
+
if (err instanceof GetNoteAPIError) throw err;
|
|
72
|
+
|
|
73
|
+
if (axios.isAxiosError(err) && err.response) {
|
|
74
|
+
const body = err.response.data as {
|
|
75
|
+
success?: boolean;
|
|
76
|
+
error?: { code: number; message: string; reason: string };
|
|
77
|
+
request_id?: string;
|
|
78
|
+
};
|
|
79
|
+
if (body?.error) {
|
|
80
|
+
throw new GetNoteAPIError(
|
|
81
|
+
body.error.code,
|
|
82
|
+
body.error.reason,
|
|
83
|
+
body.error.message,
|
|
84
|
+
body.request_id
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
throw new Error(`HTTP ${err.response.status}: ${err.message}`);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
throw err;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ─── Notes ───────────────────────────────────────────────────────────────
|
|
95
|
+
|
|
96
|
+
async listNotes(params: { since_id: number | string }) {
|
|
97
|
+
return this.request<ListNotesResp>("GET", "/resource/note/list", {
|
|
98
|
+
since_id: params.since_id,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async getNote(id: number | string, image_quality?: string) {
|
|
103
|
+
return this.request<GetNoteResp>("GET", "/resource/note/detail", { id, image_quality });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async saveNote(body: SaveNoteReq) {
|
|
107
|
+
return this.request<SaveNoteResp>("POST", "/resource/note/save", undefined, body);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async deleteNote(note_id: number | string) {
|
|
111
|
+
return this.request<DeleteNoteResp>("POST", "/resource/note/delete", undefined, {
|
|
112
|
+
note_id,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async updateNote(body: UpdateNoteReq) {
|
|
117
|
+
return this.request<UpdateNoteResp>("POST", "/resource/note/update", undefined, body);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async getNoteTaskProgress(task_id: string) {
|
|
121
|
+
return this.request<NoteTaskProgress>(
|
|
122
|
+
"POST",
|
|
123
|
+
"/resource/note/task/progress",
|
|
124
|
+
undefined,
|
|
125
|
+
{ task_id }
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ─── Tags ────────────────────────────────────────────────────────────────
|
|
130
|
+
|
|
131
|
+
async addNoteTags(note_id: number | string, tags: string[]) {
|
|
132
|
+
return this.request<AddNoteTagsResp>(
|
|
133
|
+
"POST",
|
|
134
|
+
"/resource/note/tags/add",
|
|
135
|
+
undefined,
|
|
136
|
+
{ note_id, tags }
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async deleteNoteTag(note_id: number | string, tag_id: string) {
|
|
141
|
+
return this.request<DeleteNoteTagResp>(
|
|
142
|
+
"POST",
|
|
143
|
+
"/resource/note/tags/delete",
|
|
144
|
+
undefined,
|
|
145
|
+
{ note_id, tag_id }
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ─── Image ───────────────────────────────────────────────────────────────
|
|
150
|
+
|
|
151
|
+
async getUploadConfig() {
|
|
152
|
+
return this.request<GetUploadConfigResp>(
|
|
153
|
+
"GET",
|
|
154
|
+
"/resource/image/config"
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async getUploadToken(params: { count?: number; mime_type?: string }) {
|
|
159
|
+
return this.request<GetUploadTokenResp>(
|
|
160
|
+
"GET",
|
|
161
|
+
"/resource/image/upload_token",
|
|
162
|
+
{ count: params.count, mime_type: params.mime_type }
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 上传图片到 OSS(使用预签名 URL)
|
|
168
|
+
* @param signUrl 预签名上传 URL(从 getUploadToken 获取的 sign_url)
|
|
169
|
+
* @param token 上传凭证
|
|
170
|
+
* @param imageData 图片数据(Buffer 或 Uint8Array)
|
|
171
|
+
* @returns OSS 回调响应(包含 image_id)
|
|
172
|
+
*/
|
|
173
|
+
async uploadImageToOSS(
|
|
174
|
+
token: ImageUploadToken,
|
|
175
|
+
imageData: Buffer | Uint8Array
|
|
176
|
+
): Promise<{ image_id: string }> {
|
|
177
|
+
// 使用 FormData 构建 multipart 请求
|
|
178
|
+
const FormData = (await import("form-data")).default;
|
|
179
|
+
const form = new FormData();
|
|
180
|
+
|
|
181
|
+
form.append("OSSAccessKeyId", token.accessid);
|
|
182
|
+
form.append("policy", token.policy);
|
|
183
|
+
form.append("Signature", token.signature);
|
|
184
|
+
form.append("key", token.object_key);
|
|
185
|
+
form.append("callback", token.callback);
|
|
186
|
+
form.append("success_action_status", "200");
|
|
187
|
+
form.append("file", imageData, {
|
|
188
|
+
filename: "image",
|
|
189
|
+
contentType: token.oss_content_type,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
const response = await fetch(token.host, {
|
|
193
|
+
method: "POST",
|
|
194
|
+
body: form as unknown as BodyInit,
|
|
195
|
+
headers: form.getHeaders(),
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
if (!response.ok) {
|
|
199
|
+
throw new Error(`OSS upload failed: ${response.status}`);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// 解析回调响应: {"h":{"c":0},"c":{"image":{"id":"xxx"}}}
|
|
203
|
+
const result = await response.json() as { h: { c: number }; c: { image: { id: string } } };
|
|
204
|
+
if (result.h?.c !== 0) {
|
|
205
|
+
throw new Error("OSS callback failed");
|
|
206
|
+
}
|
|
207
|
+
return { image_id: result.c.image.id };
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* 完整的图片上传流程:获取 token + 上传到 OSS
|
|
212
|
+
* @param imageData 图片数据
|
|
213
|
+
* @param mimeType MIME 类型(如 png, jpg)
|
|
214
|
+
* @returns 上传结果(包含 image_id 和 access_url)
|
|
215
|
+
*/
|
|
216
|
+
async uploadImage(
|
|
217
|
+
imageData: Buffer | Uint8Array,
|
|
218
|
+
mimeType: string = "png"
|
|
219
|
+
): Promise<{ image_id: string; access_url: string }> {
|
|
220
|
+
// 1. 获取上传凭证(现在直接返回单个对象)
|
|
221
|
+
const token = await this.getUploadToken({ mime_type: mimeType });
|
|
222
|
+
|
|
223
|
+
// 2. 上传到 OSS
|
|
224
|
+
const { image_id } = await this.uploadImageToOSS(token, imageData);
|
|
225
|
+
|
|
226
|
+
// 3. 返回结果
|
|
227
|
+
return { image_id, access_url: token.access_url };
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// ─── Knowledge / Topics ─────────────────────────────────────────────────
|
|
231
|
+
|
|
232
|
+
async listTopics(params?: { page?: number; size?: number }) {
|
|
233
|
+
return this.request<ListTopicsResp>("GET", "/resource/knowledge/list", {
|
|
234
|
+
page: params?.page,
|
|
235
|
+
size: params?.size,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async createTopic(body: { name: string; description?: string; cover?: string }) {
|
|
240
|
+
return this.request<CreateTopicResp>(
|
|
241
|
+
"POST",
|
|
242
|
+
"/resource/knowledge/create",
|
|
243
|
+
undefined,
|
|
244
|
+
body
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async listTopicNotes(params: { topic_id: string; page?: number }) {
|
|
249
|
+
return this.request<ListTopicNotesResp>(
|
|
250
|
+
"GET",
|
|
251
|
+
"/resource/knowledge/notes",
|
|
252
|
+
{ topic_id: params.topic_id, page: params.page }
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async batchAddNotesToTopic(body: { topic_id: string; note_ids: string[] }) {
|
|
257
|
+
return this.request<BatchAddNotesResp>(
|
|
258
|
+
"POST",
|
|
259
|
+
"/resource/knowledge/note/batch-add",
|
|
260
|
+
undefined,
|
|
261
|
+
body
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
async removeNoteFromTopic(body: { topic_id: string; note_ids: string[] }) {
|
|
266
|
+
return this.request<RemoveNoteResp>(
|
|
267
|
+
"POST",
|
|
268
|
+
"/resource/knowledge/note/remove",
|
|
269
|
+
undefined,
|
|
270
|
+
body
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// ─── Knowledge / Bloggers ────────────────────────────────────────────────
|
|
275
|
+
|
|
276
|
+
async listTopicBloggers(params: { topic_id: string; page?: number }) {
|
|
277
|
+
return this.request<ListTopicBloggersResp>(
|
|
278
|
+
"GET",
|
|
279
|
+
"/resource/knowledge/bloggers",
|
|
280
|
+
{ topic_id: params.topic_id, page: params.page }
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
async listTopicBloggerContents(params: {
|
|
285
|
+
topic_id: string;
|
|
286
|
+
follow_id: number | string;
|
|
287
|
+
page?: number;
|
|
288
|
+
}) {
|
|
289
|
+
return this.request<ListTopicBloggerContentsResp>(
|
|
290
|
+
"GET",
|
|
291
|
+
"/resource/knowledge/blogger/contents",
|
|
292
|
+
{ topic_id: params.topic_id, follow_id: params.follow_id, page: params.page }
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
async getBloggerContentDetail(params: { topic_id: string; post_id: string }) {
|
|
297
|
+
return this.request<BloggerContentDetail>(
|
|
298
|
+
"GET",
|
|
299
|
+
"/resource/knowledge/blogger/content/detail",
|
|
300
|
+
{ topic_id: params.topic_id, post_id: params.post_id }
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// ─── Knowledge / Lives ───────────────────────────────────────────────────
|
|
305
|
+
|
|
306
|
+
async listTopicLives(params: { topic_id: string; page?: number }) {
|
|
307
|
+
return this.request<ListTopicLivesResp>(
|
|
308
|
+
"GET",
|
|
309
|
+
"/resource/knowledge/lives",
|
|
310
|
+
{ topic_id: params.topic_id, page: params.page }
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
async getLiveDetail(params: { topic_id: string; live_id: number | string }) {
|
|
315
|
+
return this.request<LiveDetail>(
|
|
316
|
+
"GET",
|
|
317
|
+
"/resource/knowledge/live/detail",
|
|
318
|
+
{ topic_id: params.topic_id, live_id: params.live_id }
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
async followTopicLive(params: { topic_id: string; link: string }) {
|
|
323
|
+
return this.request<FollowTopicLiveResp>(
|
|
324
|
+
"POST",
|
|
325
|
+
"/resource/knowledge/live/follow",
|
|
326
|
+
undefined,
|
|
327
|
+
{ topic_id: params.topic_id, link: params.link }
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
async shareNote(params: { note_id: string; share_exclude_audio?: boolean }) {
|
|
332
|
+
return this.request<ShareNoteResp>(
|
|
333
|
+
"POST",
|
|
334
|
+
"/resource/note/sharing",
|
|
335
|
+
undefined,
|
|
336
|
+
{ note_id: params.note_id, share_exclude_audio: params.share_exclude_audio }
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
async listSubscribeTopics(params: { page?: number }) {
|
|
341
|
+
return this.request<ListSubscribeTopicsResp>(
|
|
342
|
+
"GET",
|
|
343
|
+
"/resource/knowledge/subscribe/list",
|
|
344
|
+
{ page: params.page }
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// ─── Rate Limit / Quota ──────────────────────────────────────────────────
|
|
349
|
+
|
|
350
|
+
async getQuota() {
|
|
351
|
+
return this.request<GetQuotaResp>("GET", "/resource/rate-limit/quota");
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// ─── Recall / Search ─────────────────────────────────────────────────────
|
|
355
|
+
|
|
356
|
+
async recall(body: { query: string; top_k?: number }) {
|
|
357
|
+
return this.request<RecallResp>("POST", "/resource/recall", undefined, body);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
async recallKnowledge(body: { topic_id: string; query: string; top_k?: number }) {
|
|
361
|
+
return this.request<RecallResp>("POST", "/resource/recall/knowledge", undefined, body);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// ─── Response Types ──────────────────────────────────────────────────────────
|
|
366
|
+
|
|
367
|
+
export interface TagInfo {
|
|
368
|
+
id: string;
|
|
369
|
+
name: string;
|
|
370
|
+
type: "ai" | "manual" | "system";
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export interface NoteItem {
|
|
374
|
+
id: number;
|
|
375
|
+
title: string;
|
|
376
|
+
content: string;
|
|
377
|
+
ref_content?: string;
|
|
378
|
+
note_type: string;
|
|
379
|
+
source: string;
|
|
380
|
+
tags: TagInfo[];
|
|
381
|
+
parent_id?: number;
|
|
382
|
+
children_count?: number;
|
|
383
|
+
topics?: { id: string; name: string }[];
|
|
384
|
+
is_child_note?: boolean;
|
|
385
|
+
created_at: string;
|
|
386
|
+
updated_at: string;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export interface NoteDetail extends NoteItem {
|
|
390
|
+
entry_type?: string;
|
|
391
|
+
attachments?: {
|
|
392
|
+
type: string;
|
|
393
|
+
url: string;
|
|
394
|
+
title?: string;
|
|
395
|
+
size?: number;
|
|
396
|
+
duration?: number;
|
|
397
|
+
}[];
|
|
398
|
+
audio?: {
|
|
399
|
+
play_url?: string;
|
|
400
|
+
duration?: number;
|
|
401
|
+
/** 录音转写原文(未经 AI 润色的原始转写文本) */
|
|
402
|
+
original?: string;
|
|
403
|
+
};
|
|
404
|
+
web_page?: {
|
|
405
|
+
url: string;
|
|
406
|
+
domain?: string;
|
|
407
|
+
excerpt?: string;
|
|
408
|
+
/** 链接原文(网页正文内容) */
|
|
409
|
+
content?: string;
|
|
410
|
+
};
|
|
411
|
+
share_id?: string;
|
|
412
|
+
version?: number;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export interface ListNotesResp {
|
|
416
|
+
notes: NoteItem[];
|
|
417
|
+
has_more: boolean;
|
|
418
|
+
next_cursor?: number;
|
|
419
|
+
total: number;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export interface GetNoteResp {
|
|
423
|
+
note: NoteDetail;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export interface SaveNoteReq {
|
|
427
|
+
id?: number | string;
|
|
428
|
+
title?: string;
|
|
429
|
+
content?: string;
|
|
430
|
+
note_type?: "plain_text" | "link" | "img_text";
|
|
431
|
+
tags?: string[];
|
|
432
|
+
parent_id?: number | string;
|
|
433
|
+
link_url?: string;
|
|
434
|
+
image_urls?: string[];
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export interface NoteTaskItem {
|
|
438
|
+
/** 任务 ID */
|
|
439
|
+
task_id: string;
|
|
440
|
+
/** 链接 URL */
|
|
441
|
+
url: string;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export interface SaveNoteResp {
|
|
445
|
+
id: number;
|
|
446
|
+
title: string;
|
|
447
|
+
created_at: string;
|
|
448
|
+
updated_at: string;
|
|
449
|
+
message?: string;
|
|
450
|
+
/** 链接笔记创建时返回的任务列表 */
|
|
451
|
+
tasks?: NoteTaskItem[];
|
|
452
|
+
/** 成功创建的笔记数量 */
|
|
453
|
+
created_count?: number;
|
|
454
|
+
/** 重复的链接数量(已存在) */
|
|
455
|
+
duplicate_count?: number;
|
|
456
|
+
/** 无效的链接数量 */
|
|
457
|
+
invalid_count?: number;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export interface NoteTaskProgress {
|
|
461
|
+
/** 任务 ID */
|
|
462
|
+
task_id: string;
|
|
463
|
+
/** 任务类型,目前为 "link" */
|
|
464
|
+
task_type: string;
|
|
465
|
+
/** 任务状态:pending / processing / success / failed */
|
|
466
|
+
status: "pending" | "processing" | "success" | "failed";
|
|
467
|
+
/** 笔记 ID(status 为 success 时返回) */
|
|
468
|
+
note_id?: number;
|
|
469
|
+
/** 错误信息(status 为 failed 时返回) */
|
|
470
|
+
error_msg?: string;
|
|
471
|
+
/** 任务创建时间 */
|
|
472
|
+
create_time: string;
|
|
473
|
+
/** 任务最后更新时间 */
|
|
474
|
+
update_time: string;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export interface DeleteNoteResp {
|
|
478
|
+
note_id: number;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export interface AddNoteTagsResp {
|
|
482
|
+
note_id: number;
|
|
483
|
+
tags: TagInfo[];
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export interface DeleteNoteTagResp {
|
|
487
|
+
note_id: number;
|
|
488
|
+
tags: TagInfo[];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export interface GetUploadConfigResp {
|
|
492
|
+
support_extensions: string[];
|
|
493
|
+
max_size_bytes: number;
|
|
494
|
+
max_count: number;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// OSS 上传凭证(与 Web 端格式一致)
|
|
498
|
+
export interface ImageUploadToken {
|
|
499
|
+
accessid: string;
|
|
500
|
+
host: string;
|
|
501
|
+
policy: string;
|
|
502
|
+
signature: string;
|
|
503
|
+
expire: number;
|
|
504
|
+
callback: string;
|
|
505
|
+
object_key: string;
|
|
506
|
+
access_url: string;
|
|
507
|
+
oss_content_type: string;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// 直接返回单个 token
|
|
511
|
+
export type GetUploadTokenResp = ImageUploadToken;
|
|
512
|
+
|
|
513
|
+
export interface KnowledgeTopic {
|
|
514
|
+
id: string;
|
|
515
|
+
name: string;
|
|
516
|
+
description?: string;
|
|
517
|
+
cover?: string;
|
|
518
|
+
scope?: string;
|
|
519
|
+
created_at?: number;
|
|
520
|
+
updated_at?: number;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export interface ListTopicsResp {
|
|
524
|
+
topics: KnowledgeTopic[];
|
|
525
|
+
has_more: boolean;
|
|
526
|
+
total: number;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export interface CreateTopicResp {
|
|
530
|
+
id: string;
|
|
531
|
+
name: string;
|
|
532
|
+
description?: string;
|
|
533
|
+
cover?: string;
|
|
534
|
+
scope?: string;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export interface TopicNoteItem {
|
|
538
|
+
note_id: number;
|
|
539
|
+
title: string;
|
|
540
|
+
content: string;
|
|
541
|
+
note_type: string;
|
|
542
|
+
tags: string[];
|
|
543
|
+
is_ai?: boolean;
|
|
544
|
+
created_at: string;
|
|
545
|
+
edit_time: string;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export interface ListTopicNotesResp {
|
|
549
|
+
notes: TopicNoteItem[];
|
|
550
|
+
has_more: boolean;
|
|
551
|
+
total: number;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export interface BatchAddNotesResp {
|
|
555
|
+
topic_id?: string;
|
|
556
|
+
success_count: number;
|
|
557
|
+
failed_note_ids: string[];
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export interface RemoveNoteResp {
|
|
561
|
+
removed_count: number;
|
|
562
|
+
failed_note_ids: string[];
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export interface QuotaInfo {
|
|
566
|
+
limit: number;
|
|
567
|
+
used: number;
|
|
568
|
+
remaining: number;
|
|
569
|
+
reset_at: number;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export interface QuotaBucket {
|
|
573
|
+
daily: QuotaInfo;
|
|
574
|
+
monthly: QuotaInfo;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
export interface GetQuotaResp {
|
|
578
|
+
read: QuotaBucket;
|
|
579
|
+
write: QuotaBucket;
|
|
580
|
+
write_note: QuotaBucket;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// ─── Blogger Types ───────────────────────────────────────────────────────────
|
|
584
|
+
|
|
585
|
+
export interface BloggerItem {
|
|
586
|
+
follow_id: number;
|
|
587
|
+
account_name: string;
|
|
588
|
+
account_avatar: string;
|
|
589
|
+
notes_count: number;
|
|
590
|
+
platform: string;
|
|
591
|
+
hook_state: string;
|
|
592
|
+
follow_time: string;
|
|
593
|
+
follow_link: string;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
export interface ListTopicBloggersResp {
|
|
597
|
+
bloggers: BloggerItem[];
|
|
598
|
+
has_more: boolean;
|
|
599
|
+
total: number;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
export interface BloggerContentItem {
|
|
603
|
+
post_id_alias: string;
|
|
604
|
+
post_name: string;
|
|
605
|
+
post_type: string;
|
|
606
|
+
post_cover: string;
|
|
607
|
+
post_title: string;
|
|
608
|
+
post_summary: string;
|
|
609
|
+
post_url: string;
|
|
610
|
+
post_icon: string;
|
|
611
|
+
post_subtitle: string;
|
|
612
|
+
post_create_time: string;
|
|
613
|
+
post_publish_time: string;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export interface ListTopicBloggerContentsResp {
|
|
617
|
+
contents: BloggerContentItem[];
|
|
618
|
+
has_more: boolean;
|
|
619
|
+
total: number;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
export interface BloggerContentDetail extends BloggerContentItem {
|
|
623
|
+
post_media_text: string;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// ─── Live Types ──────────────────────────────────────────────────────────────
|
|
627
|
+
|
|
628
|
+
export interface LiveItem {
|
|
629
|
+
live_id: string | number; // API may return string or number
|
|
630
|
+
follow_id: number;
|
|
631
|
+
name: string;
|
|
632
|
+
cover: string;
|
|
633
|
+
sub_title: string;
|
|
634
|
+
link: string;
|
|
635
|
+
platform: string;
|
|
636
|
+
status: string;
|
|
637
|
+
follow_time: string;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export interface ListTopicLivesResp {
|
|
641
|
+
lives: LiveItem[];
|
|
642
|
+
has_more: boolean;
|
|
643
|
+
total: number;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
export interface LiveDetail {
|
|
647
|
+
post_id_alias: string;
|
|
648
|
+
post_name: string;
|
|
649
|
+
post_type: string;
|
|
650
|
+
post_cover: string;
|
|
651
|
+
post_subtitle: string;
|
|
652
|
+
post_url: string;
|
|
653
|
+
post_title: string;
|
|
654
|
+
post_summary: string;
|
|
655
|
+
post_media_text: string;
|
|
656
|
+
post_create_time: string;
|
|
657
|
+
post_publish_time: string;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// ─── Follow Topic Live Types ─────────────────────────────────────────────────
|
|
661
|
+
|
|
662
|
+
export interface FollowTopicLiveResp {
|
|
663
|
+
follow_id: number;
|
|
664
|
+
url: string;
|
|
665
|
+
platform: string;
|
|
666
|
+
type: string;
|
|
667
|
+
created_at: string;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
// ─── Share Note Types ─────────────────────────────────────────────────────────
|
|
671
|
+
|
|
672
|
+
export interface ShareNoteResp {
|
|
673
|
+
note_id: string;
|
|
674
|
+
share_id: string;
|
|
675
|
+
share_url: string;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// ─── List Subscribe Topics Types ──────────────────────────────────────────────
|
|
679
|
+
|
|
680
|
+
export interface ListSubscribeTopicsResp {
|
|
681
|
+
topics: KnowledgeTopic[];
|
|
682
|
+
has_more: boolean;
|
|
683
|
+
total: number;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// ─── Update Note Types ───────────────────────────────────────────────────────
|
|
687
|
+
|
|
688
|
+
export interface UpdateNoteReq {
|
|
689
|
+
note_id: number | string;
|
|
690
|
+
title?: string;
|
|
691
|
+
content?: string;
|
|
692
|
+
tags?: string[];
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
export interface UpdateNoteResp {
|
|
696
|
+
note_id: number;
|
|
697
|
+
title: string;
|
|
698
|
+
updated_at: string;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// ─── Recall / Search Types ───────────────────────────────────────────────────
|
|
702
|
+
|
|
703
|
+
export interface RecallResultItem {
|
|
704
|
+
note_id: string;
|
|
705
|
+
note_type: "NOTE" | "FILE" | "BLOGGER" | "LIVE" | "URL" | "DEDAO";
|
|
706
|
+
title: string;
|
|
707
|
+
content: string;
|
|
708
|
+
created_at: string;
|
|
709
|
+
page_no?: number;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
export interface RecallResp {
|
|
713
|
+
results: RecallResultItem[];
|
|
714
|
+
}
|