koishi-plugin-chatluna-google-gemini-adapter 1.3.0-alpha.4 → 1.3.0-alpha.5
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 +5 -3
- package/lib/index.mjs +5 -3
- package/package.json +2 -2
package/lib/index.cjs
CHANGED
|
@@ -72,7 +72,7 @@ async function langchainMessageToGeminiMessage(messages, plugin, model) {
|
|
|
72
72
|
return Promise.all(
|
|
73
73
|
messages.map(async (message) => {
|
|
74
74
|
const role = messageTypeToGeminiRole(message.getType());
|
|
75
|
-
const hasFunctionCall = message.tool_calls != null;
|
|
75
|
+
const hasFunctionCall = message.tool_calls != null && message.tool_calls.length > 0;
|
|
76
76
|
if (role === "function" || hasFunctionCall) {
|
|
77
77
|
return processFunctionMessage(message);
|
|
78
78
|
}
|
|
@@ -121,9 +121,11 @@ __name(extractSystemMessages, "extractSystemMessages");
|
|
|
121
121
|
function parseJsonArgs(args) {
|
|
122
122
|
try {
|
|
123
123
|
const result = JSON.parse(args);
|
|
124
|
-
|
|
124
|
+
if (typeof result === "string") return { response: result };
|
|
125
|
+
if (Array.isArray(result)) return { response: result };
|
|
126
|
+
return result;
|
|
125
127
|
} catch {
|
|
126
|
-
return {
|
|
128
|
+
return { response: args };
|
|
127
129
|
}
|
|
128
130
|
}
|
|
129
131
|
__name(parseJsonArgs, "parseJsonArgs");
|
package/lib/index.mjs
CHANGED
|
@@ -72,7 +72,7 @@ async function langchainMessageToGeminiMessage(messages, plugin, model) {
|
|
|
72
72
|
return Promise.all(
|
|
73
73
|
messages.map(async (message) => {
|
|
74
74
|
const role = messageTypeToGeminiRole(message.getType());
|
|
75
|
-
const hasFunctionCall = message.tool_calls != null;
|
|
75
|
+
const hasFunctionCall = message.tool_calls != null && message.tool_calls.length > 0;
|
|
76
76
|
if (role === "function" || hasFunctionCall) {
|
|
77
77
|
return processFunctionMessage(message);
|
|
78
78
|
}
|
|
@@ -121,9 +121,11 @@ __name(extractSystemMessages, "extractSystemMessages");
|
|
|
121
121
|
function parseJsonArgs(args) {
|
|
122
122
|
try {
|
|
123
123
|
const result = JSON.parse(args);
|
|
124
|
-
|
|
124
|
+
if (typeof result === "string") return { response: result };
|
|
125
|
+
if (Array.isArray(result)) return { response: result };
|
|
126
|
+
return result;
|
|
125
127
|
} catch {
|
|
126
|
-
return {
|
|
128
|
+
return { response: args };
|
|
127
129
|
}
|
|
128
130
|
}
|
|
129
131
|
__name(parseJsonArgs, "parseJsonArgs");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-chatluna-google-gemini-adapter",
|
|
3
3
|
"description": "google-gemini adapter for chatluna",
|
|
4
|
-
"version": "1.3.0-alpha.
|
|
4
|
+
"version": "1.3.0-alpha.5",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
7
7
|
"typings": "lib/index.d.ts",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"koishi": "^4.18.7",
|
|
76
|
-
"koishi-plugin-chatluna": "^1.3.0-alpha.
|
|
76
|
+
"koishi-plugin-chatluna": "^1.3.0-alpha.31",
|
|
77
77
|
"koishi-plugin-chatluna-storage-service": "^0.0.8"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|