koishi-plugin-chatluna-google-gemini-adapter 1.3.0-alpha.3 → 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 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
- return typeof result === "string" ? { input: result } : result;
124
+ if (typeof result === "string") return { response: result };
125
+ if (Array.isArray(result)) return { response: result };
126
+ return result;
125
127
  } catch {
126
- return { input: args };
128
+ return { response: args };
127
129
  }
128
130
  }
129
131
  __name(parseJsonArgs, "parseJsonArgs");
@@ -316,7 +318,7 @@ function prepareModelConfig(params, pluginConfig) {
316
318
  let enabledThinking = null;
317
319
  if (model.includes("-thinking") && model.includes("gemini-2.5")) {
318
320
  enabledThinking = !model.includes("-non-thinking");
319
- model = model.replace("-nom-thinking", "").replace("-thinking", "");
321
+ model = model.replace("-non-thinking", "").replace("-thinking", "");
320
322
  }
321
323
  let thinkingBudget = pluginConfig.thinkingBudget ?? -1;
322
324
  if (!enabledThinking && !model.includes("2.5-pro")) {
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
- return typeof result === "string" ? { input: result } : result;
124
+ if (typeof result === "string") return { response: result };
125
+ if (Array.isArray(result)) return { response: result };
126
+ return result;
125
127
  } catch {
126
- return { input: args };
128
+ return { response: args };
127
129
  }
128
130
  }
129
131
  __name(parseJsonArgs, "parseJsonArgs");
@@ -316,7 +318,7 @@ function prepareModelConfig(params, pluginConfig) {
316
318
  let enabledThinking = null;
317
319
  if (model.includes("-thinking") && model.includes("gemini-2.5")) {
318
320
  enabledThinking = !model.includes("-non-thinking");
319
- model = model.replace("-nom-thinking", "").replace("-thinking", "");
321
+ model = model.replace("-non-thinking", "").replace("-thinking", "");
320
322
  }
321
323
  let thinkingBudget = pluginConfig.thinkingBudget ?? -1;
322
324
  if (!enabledThinking && !model.includes("2.5-pro")) {
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.3",
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.30",
76
+ "koishi-plugin-chatluna": "^1.3.0-alpha.31",
77
77
  "koishi-plugin-chatluna-storage-service": "^0.0.8"
78
78
  },
79
79
  "peerDependenciesMeta": {