@chatluna/v1-shared-adapter 1.0.16 → 1.0.18
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/lib/index.cjs +4 -2
- package/lib/index.mjs +4 -2
- package/lib/requester.d.ts +1 -1
- package/lib/utils.d.ts +2 -2
- package/package.json +71 -71
package/lib/index.cjs
CHANGED
|
@@ -75,7 +75,8 @@ function getModelMaxContextSize(info) {
|
|
|
75
75
|
"gemini-1.0-pro": 30720,
|
|
76
76
|
"gemini-2.0-flash": 1048576,
|
|
77
77
|
"gemini-2.0-pro": 2097152,
|
|
78
|
-
"gemini-2.5
|
|
78
|
+
"gemini-2.5": 2097152,
|
|
79
|
+
"gemini-3.0-pro": 1097152,
|
|
79
80
|
"gemini-2.0": 2097152,
|
|
80
81
|
deepseek: 128e3,
|
|
81
82
|
"llama3.1": 128e3,
|
|
@@ -443,6 +444,7 @@ __name(convertDeltaToMessageChunk, "convertDeltaToMessageChunk");
|
|
|
443
444
|
var import_messages2 = require("@langchain/core/messages");
|
|
444
445
|
var import_string2 = require("koishi-plugin-chatluna/utils/string");
|
|
445
446
|
var import_logger = require("koishi-plugin-chatluna/utils/logger");
|
|
447
|
+
var import_object = require("koishi-plugin-chatluna/utils/object");
|
|
446
448
|
async function buildChatCompletionParams(params, plugin, enableGoogleSearch, supportImageInput2) {
|
|
447
449
|
const base = {
|
|
448
450
|
model: params.model,
|
|
@@ -477,7 +479,7 @@ async function buildChatCompletionParams(params, plugin, enableGoogleSearch, sup
|
|
|
477
479
|
delete base.n;
|
|
478
480
|
delete base.top_p;
|
|
479
481
|
}
|
|
480
|
-
return base;
|
|
482
|
+
return (0, import_object.deepAssign)({}, base, params.overrideRequestParams ?? {});
|
|
481
483
|
}
|
|
482
484
|
__name(buildChatCompletionParams, "buildChatCompletionParams");
|
|
483
485
|
function processReasoningContent(delta, reasoningState) {
|
package/lib/index.mjs
CHANGED
|
@@ -32,7 +32,8 @@ function getModelMaxContextSize(info) {
|
|
|
32
32
|
"gemini-1.0-pro": 30720,
|
|
33
33
|
"gemini-2.0-flash": 1048576,
|
|
34
34
|
"gemini-2.0-pro": 2097152,
|
|
35
|
-
"gemini-2.5
|
|
35
|
+
"gemini-2.5": 2097152,
|
|
36
|
+
"gemini-3.0-pro": 1097152,
|
|
36
37
|
"gemini-2.0": 2097152,
|
|
37
38
|
deepseek: 128e3,
|
|
38
39
|
"llama3.1": 128e3,
|
|
@@ -413,6 +414,7 @@ __name(convertDeltaToMessageChunk, "convertDeltaToMessageChunk");
|
|
|
413
414
|
import { AIMessageChunk as AIMessageChunk2 } from "@langchain/core/messages";
|
|
414
415
|
import { getMessageContent } from "koishi-plugin-chatluna/utils/string";
|
|
415
416
|
import { trackLogToLocal } from "koishi-plugin-chatluna/utils/logger";
|
|
417
|
+
import { deepAssign } from "koishi-plugin-chatluna/utils/object";
|
|
416
418
|
async function buildChatCompletionParams(params, plugin, enableGoogleSearch, supportImageInput2) {
|
|
417
419
|
const base = {
|
|
418
420
|
model: params.model,
|
|
@@ -447,7 +449,7 @@ async function buildChatCompletionParams(params, plugin, enableGoogleSearch, sup
|
|
|
447
449
|
delete base.n;
|
|
448
450
|
delete base.top_p;
|
|
449
451
|
}
|
|
450
|
-
return base;
|
|
452
|
+
return deepAssign({}, base, params.overrideRequestParams ?? {});
|
|
451
453
|
}
|
|
452
454
|
__name(buildChatCompletionParams, "buildChatCompletionParams");
|
|
453
455
|
function processReasoningContent(delta, reasoningState) {
|
package/lib/requester.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare function buildChatCompletionParams(params: ModelRequestParams, pl
|
|
|
30
30
|
stream_options: {
|
|
31
31
|
include_usage: boolean;
|
|
32
32
|
};
|
|
33
|
-
}
|
|
33
|
+
} & Record<string, any>>;
|
|
34
34
|
export declare function processReasoningContent(delta: {
|
|
35
35
|
reasoning_content?: string;
|
|
36
36
|
content?: string;
|
package/lib/utils.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export declare function messageTypeToOpenAIRole(type: MessageType): ChatCompleti
|
|
|
9
9
|
export declare function formatToolsToOpenAITools(tools: StructuredTool[], includeGoogleSearch: boolean): ChatCompletionTool[];
|
|
10
10
|
export declare function formatToolToOpenAITool(tool: StructuredTool): ChatCompletionTool;
|
|
11
11
|
export declare function removeAdditionalProperties(schema: JsonSchema7Type): JsonSchema7Type;
|
|
12
|
-
export declare function convertMessageToMessageChunk(message: ChatCompletionResponseMessage):
|
|
13
|
-
export declare function convertDeltaToMessageChunk(delta: Record<string, any>, defaultRole?: ChatCompletionResponseMessageRoleEnum):
|
|
12
|
+
export declare function convertMessageToMessageChunk(message: ChatCompletionResponseMessage): HumanMessageChunk | AIMessageChunk | SystemMessageChunk | FunctionMessageChunk | ToolMessageChunk | ChatMessageChunk;
|
|
13
|
+
export declare function convertDeltaToMessageChunk(delta: Record<string, any>, defaultRole?: ChatCompletionResponseMessageRoleEnum): HumanMessageChunk | AIMessageChunk | SystemMessageChunk | FunctionMessageChunk | ToolMessageChunk | ChatMessageChunk;
|
package/package.json
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
"./package.json": "./package.json"
|
|
19
|
-
},
|
|
20
|
-
"type": "module",
|
|
21
|
-
"author": "dingyi222666 <dingyi222666@foxmail.com>",
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "https://github.com/ChatLunaLab/chatluna.git",
|
|
25
|
-
"directory": "packages/shared-adapter"
|
|
26
|
-
},
|
|
27
|
-
"license": "AGPL-3.0",
|
|
28
|
-
"bugs": {
|
|
29
|
-
"url": "https://github.com/ChatLunaLab/chatluna/issues"
|
|
30
|
-
},
|
|
31
|
-
"homepage": "https://github.com/ChatLunaLab/chatluna/tree/v1-dev/packages/shared-adapter#readme",
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "atsc -b"
|
|
34
|
-
},
|
|
35
|
-
"engines": {
|
|
36
|
-
"node": ">=18.0.0"
|
|
37
|
-
},
|
|
38
|
-
"resolutions": {
|
|
39
|
-
"@langchain/core": "0.3.62",
|
|
40
|
-
"js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
|
|
2
|
+
"name": "@chatluna/v1-shared-adapter",
|
|
3
|
+
"description": "chatluna shared adapter",
|
|
4
|
+
"version": "1.0.18",
|
|
5
|
+
"main": "lib/index.cjs",
|
|
6
|
+
"module": "lib/index.mjs",
|
|
7
|
+
"typings": "lib/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"lib",
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./lib/index.d.ts",
|
|
15
|
+
"import": "./lib/index.mjs",
|
|
16
|
+
"require": "./lib/index.cjs"
|
|
41
17
|
},
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"author": "dingyi222666 <dingyi222666@foxmail.com>",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/ChatLunaLab/chatluna.git",
|
|
25
|
+
"directory": "packages/shared-adapter"
|
|
26
|
+
},
|
|
27
|
+
"license": "AGPL-3.0",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/ChatLunaLab/chatluna/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/ChatLunaLab/chatluna/tree/v1-dev/packages/shared-adapter#readme",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "atsc -b"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=18.0.0"
|
|
37
|
+
},
|
|
38
|
+
"resolutions": {
|
|
39
|
+
"@langchain/core": "0.3.62",
|
|
40
|
+
"js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
|
|
41
|
+
},
|
|
42
|
+
"overrides": {
|
|
43
|
+
"@langchain/core": "0.3.62",
|
|
44
|
+
"js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
|
|
45
|
+
},
|
|
46
|
+
"pnpm": {
|
|
42
47
|
"overrides": {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
"pnpm": {
|
|
47
|
-
"overrides": {
|
|
48
|
-
"@langchain/core": "0.3.62",
|
|
49
|
-
"js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"keywords": [
|
|
53
|
-
"chatbot",
|
|
54
|
-
"koishi",
|
|
55
|
-
"plugin",
|
|
56
|
-
"service",
|
|
57
|
-
"chatgpt",
|
|
58
|
-
"gpt",
|
|
59
|
-
"chatluna",
|
|
60
|
-
"adapter"
|
|
61
|
-
],
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"@langchain/core": "0.3.62",
|
|
64
|
-
"zod": "3.25.76",
|
|
65
|
-
"zod-to-json-schema": "^3.24.6"
|
|
66
|
-
},
|
|
67
|
-
"devDependencies": {
|
|
68
|
-
"atsc": "^2.1.0",
|
|
69
|
-
"koishi": "^4.18.9"
|
|
70
|
-
},
|
|
71
|
-
"peerDependencies": {
|
|
72
|
-
"koishi": "^4.18.9",
|
|
73
|
-
"koishi-plugin-chatluna": "^1.3.0-alpha.77"
|
|
48
|
+
"@langchain/core": "0.3.62",
|
|
49
|
+
"js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
|
|
74
50
|
}
|
|
75
|
-
}
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"chatbot",
|
|
54
|
+
"koishi",
|
|
55
|
+
"plugin",
|
|
56
|
+
"service",
|
|
57
|
+
"chatgpt",
|
|
58
|
+
"gpt",
|
|
59
|
+
"chatluna",
|
|
60
|
+
"adapter"
|
|
61
|
+
],
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@langchain/core": "0.3.62",
|
|
64
|
+
"zod": "3.25.76",
|
|
65
|
+
"zod-to-json-schema": "^3.24.6"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"atsc": "^2.1.0",
|
|
69
|
+
"koishi": "^4.18.9"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"koishi": "^4.18.9",
|
|
73
|
+
"koishi-plugin-chatluna": "^1.3.2"
|
|
74
|
+
}
|
|
75
|
+
}
|