@blueking/chat-helper 0.0.1-beta.15 → 0.0.1-beta.17
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/dist/http/fetch/fetch.ts.js +13 -2
- package/dist/http/transform/agent.ts.js +1 -0
- package/package.json +2 -2
- package/dist/agent/index.d.ts +0 -2
- package/dist/agent/type.d.ts +0 -101
- package/dist/agent/use-agent.d.ts +0 -597
- package/dist/event/ag-ui.d.ts +0 -153
- package/dist/event/index.d.ts +0 -2
- package/dist/event/type.d.ts +0 -252
- package/dist/http/fetch/fetch.d.ts +0 -88
- package/dist/http/fetch/index.d.ts +0 -7
- package/dist/http/index.d.ts +0 -46
- package/dist/http/module/agent.d.ts +0 -9
- package/dist/http/module/index.d.ts +0 -42
- package/dist/http/module/message.d.ts +0 -29
- package/dist/http/module/session.d.ts +0 -28
- package/dist/http/transform/agent.d.ts +0 -7
- package/dist/http/transform/index.d.ts +0 -3
- package/dist/http/transform/message.d.ts +0 -13
- package/dist/http/transform/session.d.ts +0 -37
- package/dist/index.d.ts +0 -3429
- package/dist/mediator/index.d.ts +0 -2
- package/dist/mediator/type.d.ts +0 -50
- package/dist/mediator/use-mediator.d.ts +0 -7
- package/dist/message/index.d.ts +0 -2
- package/dist/message/type.d.ts +0 -370
- package/dist/message/use-message.d.ts +0 -902
- package/dist/session/index.d.ts +0 -2
- package/dist/session/type.d.ts +0 -71
- package/dist/session/use-session.d.ts +0 -1906
- package/dist/type.d.ts +0 -14
|
@@ -309,7 +309,9 @@ export class FetchClient {
|
|
|
309
309
|
// 验证状态码
|
|
310
310
|
const validateStatus = requestConfig.validateStatus || _this.defaults.validateStatus;
|
|
311
311
|
if (!validateStatus(fetchResponse.status)) {
|
|
312
|
-
|
|
312
|
+
var _response_data;
|
|
313
|
+
const message = ((_response_data = response.data) === null || _response_data === void 0 ? void 0 : _response_data.message) || `Request failed with status code ${fetchResponse.status}`;
|
|
314
|
+
throw createError(message, requestConfig, `ERR_BAD_RESPONSE`, response);
|
|
313
315
|
}
|
|
314
316
|
// 应用响应拦截器
|
|
315
317
|
let finalResponse = response;
|
|
@@ -375,7 +377,16 @@ export class FetchClient {
|
|
|
375
377
|
const validateStatus = requestConfig.validateStatus || _this.defaults.validateStatus;
|
|
376
378
|
if (!validateStatus(fetchResponse.status)) {
|
|
377
379
|
var _config_onError;
|
|
378
|
-
|
|
380
|
+
let message = `Request failed with status code ${fetchResponse.status}`;
|
|
381
|
+
try {
|
|
382
|
+
const errorData = yield fetchResponse.json();
|
|
383
|
+
if (errorData === null || errorData === void 0 ? void 0 : errorData.message) {
|
|
384
|
+
message = errorData.message;
|
|
385
|
+
}
|
|
386
|
+
} catch (_error) {
|
|
387
|
+
message = `Request failed with status code ${fetchResponse.status}`;
|
|
388
|
+
}
|
|
389
|
+
const error = createError(message, requestConfig, `ERR_BAD_RESPONSE`, undefined);
|
|
379
390
|
(_config_onError = config.onError) === null || _config_onError === void 0 ? void 0 : _config_onError.call(config, error);
|
|
380
391
|
return;
|
|
381
392
|
}
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
commands: data === null || data === void 0 ? void 0 : (_data_conversation_settings2 = data.conversation_settings) === null || _data_conversation_settings2 === void 0 ? void 0 : (_data_conversation_settings_commands = _data_conversation_settings2.commands) === null || _data_conversation_settings_commands === void 0 ? void 0 : _data_conversation_settings_commands.map((command)=>({
|
|
36
36
|
id: command.id,
|
|
37
37
|
name: command.name,
|
|
38
|
+
alias: command.alias,
|
|
38
39
|
icon: command.icon,
|
|
39
40
|
components: command.components.map((component)=>({
|
|
40
41
|
type: component.type,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueking/chat-helper",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.ts.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
"typescript": "^5.5.4",
|
|
26
26
|
"vue-tsc": "^3.1.4"
|
|
27
27
|
}
|
|
28
|
-
}
|
|
28
|
+
}
|
package/dist/agent/index.d.ts
DELETED
package/dist/agent/type.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { IMessage } from '../message/type';
|
|
2
|
-
export interface IAgentCommand {
|
|
3
|
-
agentId: number;
|
|
4
|
-
components: IAgentCommandComponent[];
|
|
5
|
-
content: null | string;
|
|
6
|
-
icon?: string;
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
status: string;
|
|
10
|
-
}
|
|
11
|
-
export interface IAgentCommandApi {
|
|
12
|
-
agent_id: number;
|
|
13
|
-
components: IAgentCommandComponentApi[];
|
|
14
|
-
content: null | string;
|
|
15
|
-
icon: string;
|
|
16
|
-
id: string;
|
|
17
|
-
name: string;
|
|
18
|
-
selectedText?: null | string;
|
|
19
|
-
status: string;
|
|
20
|
-
}
|
|
21
|
-
export interface IAgentCommandComponent {
|
|
22
|
-
default?: null | string;
|
|
23
|
-
fillBack?: boolean;
|
|
24
|
-
fillRegx?: null | string;
|
|
25
|
-
hide?: boolean;
|
|
26
|
-
key: string;
|
|
27
|
-
max?: null | number;
|
|
28
|
-
min?: null | number;
|
|
29
|
-
name: string;
|
|
30
|
-
options?: unknown;
|
|
31
|
-
placeholder?: null | string;
|
|
32
|
-
required?: boolean;
|
|
33
|
-
rows?: null | number;
|
|
34
|
-
selectedText?: null | string;
|
|
35
|
-
showSendButton?: boolean;
|
|
36
|
-
type: string;
|
|
37
|
-
}
|
|
38
|
-
export interface IAgentCommandComponentApi {
|
|
39
|
-
default: null | string;
|
|
40
|
-
fill_back: boolean;
|
|
41
|
-
fill_regx: null | string;
|
|
42
|
-
key: string;
|
|
43
|
-
max: null | number;
|
|
44
|
-
min: null | number;
|
|
45
|
-
name: string;
|
|
46
|
-
options: unknown;
|
|
47
|
-
placeholder: null | string;
|
|
48
|
-
required: boolean;
|
|
49
|
-
rows: null | number;
|
|
50
|
-
type: string;
|
|
51
|
-
}
|
|
52
|
-
export interface IAgentInfo {
|
|
53
|
-
agentName?: string;
|
|
54
|
-
resources?: IAgentResources;
|
|
55
|
-
saasUrl?: string;
|
|
56
|
-
chatGroup?: {
|
|
57
|
-
enabled: boolean;
|
|
58
|
-
staff: string[];
|
|
59
|
-
username: string;
|
|
60
|
-
};
|
|
61
|
-
conversationSettings?: {
|
|
62
|
-
commands?: IAgentCommand[];
|
|
63
|
-
enableChatSession?: boolean;
|
|
64
|
-
openingRemark?: string;
|
|
65
|
-
predefinedQuestions?: string[];
|
|
66
|
-
};
|
|
67
|
-
promptSetting?: {
|
|
68
|
-
content?: IMessage[];
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export interface IAgentInfoApi {
|
|
72
|
-
agent_name: string;
|
|
73
|
-
resources?: IAgentResources;
|
|
74
|
-
saas_url?: string;
|
|
75
|
-
chat_group?: {
|
|
76
|
-
enabled: boolean;
|
|
77
|
-
staff: string[];
|
|
78
|
-
username: string;
|
|
79
|
-
};
|
|
80
|
-
conversation_settings?: {
|
|
81
|
-
commands?: IAgentCommandApi[];
|
|
82
|
-
enable_chat_session?: boolean;
|
|
83
|
-
opening_remark?: string;
|
|
84
|
-
predefined_questions?: string[];
|
|
85
|
-
};
|
|
86
|
-
prompt_setting?: {
|
|
87
|
-
content?: IMessage[];
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
export interface IAgentResourceItem {
|
|
91
|
-
code: string;
|
|
92
|
-
icon: null | string;
|
|
93
|
-
id: null | number;
|
|
94
|
-
name: string;
|
|
95
|
-
}
|
|
96
|
-
export interface IAgentResources {
|
|
97
|
-
command?: IAgentResourceItem[];
|
|
98
|
-
knowledgebase?: IAgentResourceItem[];
|
|
99
|
-
mcp?: IAgentResourceItem[];
|
|
100
|
-
tool?: IAgentResourceItem[];
|
|
101
|
-
}
|