@chatluna/v1-shared-adapter 1.0.5 → 1.0.7
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 +3 -3
- package/lib/index.mjs +3 -3
- package/package.json +7 -7
package/lib/index.cjs
CHANGED
|
@@ -138,6 +138,7 @@ var import_sse = require("koishi-plugin-chatluna/utils/sse");
|
|
|
138
138
|
var import_messages = require("@langchain/core/messages");
|
|
139
139
|
var import_zod_to_json_schema = require("zod-to-json-schema");
|
|
140
140
|
var import_string = require("koishi-plugin-chatluna/utils/string");
|
|
141
|
+
var import_zod = require("zod");
|
|
141
142
|
async function langchainMessageToOpenAIMessage(messages, plugin, model, supportImageInput2, removeSystemMessage) {
|
|
142
143
|
const result = [];
|
|
143
144
|
for (const rawMessage of messages) {
|
|
@@ -293,10 +294,9 @@ function formatToolsToOpenAITools(tools, includeGoogleSearch) {
|
|
|
293
294
|
__name(formatToolsToOpenAITools, "formatToolsToOpenAITools");
|
|
294
295
|
function formatToolToOpenAITool(tool) {
|
|
295
296
|
const parameters = removeAdditionalProperties(
|
|
296
|
-
|
|
297
|
-
(0, import_zod_to_json_schema.zodToJsonSchema)(tool.schema, {
|
|
297
|
+
tool.schema instanceof import_zod.ZodSchema ? (0, import_zod_to_json_schema.zodToJsonSchema)(tool.schema, {
|
|
298
298
|
allowedAdditionalProperties: void 0
|
|
299
|
-
})
|
|
299
|
+
}) : tool.schema
|
|
300
300
|
);
|
|
301
301
|
return {
|
|
302
302
|
type: "function",
|
package/lib/index.mjs
CHANGED
|
@@ -108,6 +108,7 @@ import {
|
|
|
108
108
|
getImageMimeType,
|
|
109
109
|
isMessageContentImageUrl
|
|
110
110
|
} from "koishi-plugin-chatluna/utils/string";
|
|
111
|
+
import { ZodSchema } from "zod";
|
|
111
112
|
async function langchainMessageToOpenAIMessage(messages, plugin, model, supportImageInput2, removeSystemMessage) {
|
|
112
113
|
const result = [];
|
|
113
114
|
for (const rawMessage of messages) {
|
|
@@ -263,10 +264,9 @@ function formatToolsToOpenAITools(tools, includeGoogleSearch) {
|
|
|
263
264
|
__name(formatToolsToOpenAITools, "formatToolsToOpenAITools");
|
|
264
265
|
function formatToolToOpenAITool(tool) {
|
|
265
266
|
const parameters = removeAdditionalProperties(
|
|
266
|
-
|
|
267
|
-
zodToJsonSchema(tool.schema, {
|
|
267
|
+
tool.schema instanceof ZodSchema ? zodToJsonSchema(tool.schema, {
|
|
268
268
|
allowedAdditionalProperties: void 0
|
|
269
|
-
})
|
|
269
|
+
}) : tool.schema
|
|
270
270
|
);
|
|
271
271
|
return {
|
|
272
272
|
type: "function",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatluna/v1-shared-adapter",
|
|
3
3
|
"description": "chatluna shared adapter",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
7
7
|
"typings": "lib/index.d.ts",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"node": ">=18.0.0"
|
|
37
37
|
},
|
|
38
38
|
"resolutions": {
|
|
39
|
-
"@langchain/core": "0.3.
|
|
39
|
+
"@langchain/core": "0.3.62",
|
|
40
40
|
"js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.19"
|
|
41
41
|
},
|
|
42
42
|
"overrides": {
|
|
43
|
-
"@langchain/core": "0.3.
|
|
43
|
+
"@langchain/core": "0.3.62",
|
|
44
44
|
"js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.19"
|
|
45
45
|
},
|
|
46
46
|
"pnpm": {
|
|
47
47
|
"overrides": {
|
|
48
|
-
"@langchain/core": "0.3.
|
|
48
|
+
"@langchain/core": "0.3.62",
|
|
49
49
|
"js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.19"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"adapter"
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@langchain/core": "
|
|
64
|
-
"zod": "
|
|
63
|
+
"@langchain/core": "0.3.62",
|
|
64
|
+
"zod": "3.25.76",
|
|
65
65
|
"zod-to-json-schema": "^3.24.5"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"koishi": "^4.18.7",
|
|
73
|
-
"koishi-plugin-chatluna": "^1.3.0-alpha.
|
|
73
|
+
"koishi-plugin-chatluna": "^1.3.0-alpha.28"
|
|
74
74
|
}
|
|
75
75
|
}
|