koishi-plugin-chatluna-google-gemini-adapter 1.2.16 → 1.2.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 +9 -7
- package/lib/index.mjs +9 -7
- package/package.json +4 -4
package/lib/index.cjs
CHANGED
|
@@ -210,7 +210,8 @@ function formatToolsToGeminiAITools(tools, config, model) {
|
|
|
210
210
|
];
|
|
211
211
|
const imageGenerationModels = [
|
|
212
212
|
"gemini-2.0-flash-exp",
|
|
213
|
-
"gemini-2.0-flash-exp-image-generation"
|
|
213
|
+
"gemini-2.0-flash-exp-image-generation",
|
|
214
|
+
"gemini-2.5-flash-image-preview"
|
|
214
215
|
];
|
|
215
216
|
let googleSearch = config.googleSearch;
|
|
216
217
|
let codeExecution = config.codeExecution;
|
|
@@ -344,6 +345,10 @@ var GeminiRequester = class extends import_api.ModelRequester {
|
|
|
344
345
|
} else if (thinkingBudget >= 0 && thinkingBudget < 128) {
|
|
345
346
|
thinkingBudget = 128;
|
|
346
347
|
}
|
|
348
|
+
let imageGeneration = this._pluginConfig.imageGeneration ?? false;
|
|
349
|
+
if (imageGeneration) {
|
|
350
|
+
imageGeneration = params.model.includes("gemini-2.0-flash-exp") || params.model.includes("gemini-2.5-flash-image");
|
|
351
|
+
}
|
|
347
352
|
const response = await this._post(
|
|
348
353
|
`models/${model}:streamGenerateContent?alt=sse`,
|
|
349
354
|
{
|
|
@@ -375,10 +380,7 @@ var GeminiRequester = class extends import_api.ModelRequester {
|
|
|
375
380
|
temperature: params.temperature,
|
|
376
381
|
maxOutputTokens: params.model.includes("vision") ? void 0 : params.maxTokens,
|
|
377
382
|
topP: params.topP,
|
|
378
|
-
responseModalities:
|
|
379
|
-
// TODO: Wait for google release to all models
|
|
380
|
-
"gemini-2.0-flash-exp"
|
|
381
|
-
) && this._pluginConfig.imageGeneration ? ["TEXT", "IMAGE"] : void 0,
|
|
383
|
+
responseModalities: imageGeneration ? ["TEXT", "IMAGE"] : void 0,
|
|
382
384
|
thinkingConfig: enabledThinking != null || this._pluginConfig.includeThoughts ? {
|
|
383
385
|
thinkingBudget,
|
|
384
386
|
includeThoughts: this._pluginConfig.includeThoughts
|
|
@@ -694,7 +696,7 @@ var GeminiClient = class extends import_client.PlatformModelAndEmbeddingsClient
|
|
|
694
696
|
functionCall: !model.name.includes("vision"),
|
|
695
697
|
supportMode: ["all"]
|
|
696
698
|
};
|
|
697
|
-
if (model.name.includes("gemini-2.5") && !model.name.includes("pro")) {
|
|
699
|
+
if (model.name.includes("gemini-2.5") && !model.name.includes("pro") && !model.name.includes("image")) {
|
|
698
700
|
if (!model.name.includes("-thinking")) {
|
|
699
701
|
models.push(
|
|
700
702
|
{ ...info, name: model.name + "-nonthinking" },
|
|
@@ -781,7 +783,7 @@ var Config4 = import_koishi.Schema.intersect([
|
|
|
781
783
|
}),
|
|
782
784
|
import_koishi.Schema.object({
|
|
783
785
|
maxTokens: import_koishi.Schema.number().min(16).max(2097e3).step(16).default(8064),
|
|
784
|
-
temperature: import_koishi.Schema.percent().min(0).max(2).step(0.1).default(
|
|
786
|
+
temperature: import_koishi.Schema.percent().min(0).max(2).step(0.1).default(1),
|
|
785
787
|
googleSearch: import_koishi.Schema.boolean().default(false),
|
|
786
788
|
codeExecution: import_koishi.Schema.boolean().default(false),
|
|
787
789
|
urlContext: import_koishi.Schema.boolean().default(false),
|
package/lib/index.mjs
CHANGED
|
@@ -203,7 +203,8 @@ function formatToolsToGeminiAITools(tools, config, model) {
|
|
|
203
203
|
];
|
|
204
204
|
const imageGenerationModels = [
|
|
205
205
|
"gemini-2.0-flash-exp",
|
|
206
|
-
"gemini-2.0-flash-exp-image-generation"
|
|
206
|
+
"gemini-2.0-flash-exp-image-generation",
|
|
207
|
+
"gemini-2.5-flash-image-preview"
|
|
207
208
|
];
|
|
208
209
|
let googleSearch = config.googleSearch;
|
|
209
210
|
let codeExecution = config.codeExecution;
|
|
@@ -337,6 +338,10 @@ var GeminiRequester = class extends ModelRequester {
|
|
|
337
338
|
} else if (thinkingBudget >= 0 && thinkingBudget < 128) {
|
|
338
339
|
thinkingBudget = 128;
|
|
339
340
|
}
|
|
341
|
+
let imageGeneration = this._pluginConfig.imageGeneration ?? false;
|
|
342
|
+
if (imageGeneration) {
|
|
343
|
+
imageGeneration = params.model.includes("gemini-2.0-flash-exp") || params.model.includes("gemini-2.5-flash-image");
|
|
344
|
+
}
|
|
340
345
|
const response = await this._post(
|
|
341
346
|
`models/${model}:streamGenerateContent?alt=sse`,
|
|
342
347
|
{
|
|
@@ -368,10 +373,7 @@ var GeminiRequester = class extends ModelRequester {
|
|
|
368
373
|
temperature: params.temperature,
|
|
369
374
|
maxOutputTokens: params.model.includes("vision") ? void 0 : params.maxTokens,
|
|
370
375
|
topP: params.topP,
|
|
371
|
-
responseModalities:
|
|
372
|
-
// TODO: Wait for google release to all models
|
|
373
|
-
"gemini-2.0-flash-exp"
|
|
374
|
-
) && this._pluginConfig.imageGeneration ? ["TEXT", "IMAGE"] : void 0,
|
|
376
|
+
responseModalities: imageGeneration ? ["TEXT", "IMAGE"] : void 0,
|
|
375
377
|
thinkingConfig: enabledThinking != null || this._pluginConfig.includeThoughts ? {
|
|
376
378
|
thinkingBudget,
|
|
377
379
|
includeThoughts: this._pluginConfig.includeThoughts
|
|
@@ -687,7 +689,7 @@ var GeminiClient = class extends PlatformModelAndEmbeddingsClient {
|
|
|
687
689
|
functionCall: !model.name.includes("vision"),
|
|
688
690
|
supportMode: ["all"]
|
|
689
691
|
};
|
|
690
|
-
if (model.name.includes("gemini-2.5") && !model.name.includes("pro")) {
|
|
692
|
+
if (model.name.includes("gemini-2.5") && !model.name.includes("pro") && !model.name.includes("image")) {
|
|
691
693
|
if (!model.name.includes("-thinking")) {
|
|
692
694
|
models.push(
|
|
693
695
|
{ ...info, name: model.name + "-nonthinking" },
|
|
@@ -774,7 +776,7 @@ var Config4 = Schema.intersect([
|
|
|
774
776
|
}),
|
|
775
777
|
Schema.object({
|
|
776
778
|
maxTokens: Schema.number().min(16).max(2097e3).step(16).default(8064),
|
|
777
|
-
temperature: Schema.percent().min(0).max(2).step(0.1).default(
|
|
779
|
+
temperature: Schema.percent().min(0).max(2).step(0.1).default(1),
|
|
778
780
|
googleSearch: Schema.boolean().default(false),
|
|
779
781
|
codeExecution: Schema.boolean().default(false),
|
|
780
782
|
urlContext: Schema.boolean().default(false),
|
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.2.
|
|
4
|
+
"version": "1.2.18",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
7
7
|
"typings": "lib/index.d.ts",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"adapter"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
+
"@chatluna/v1-shared-adapter": "^1.0.2",
|
|
65
66
|
"@langchain/core": "^0.3.43",
|
|
66
67
|
"zod": "^3.25.0-canary.20250211T214501",
|
|
67
|
-
"zod-to-json-schema": "^3.24.5"
|
|
68
|
-
"@chatluna/v1-shared-adapter": "^1.0.1"
|
|
68
|
+
"zod-to-json-schema": "^3.24.5"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"atsc": "^2.1.0",
|
|
@@ -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.11"
|
|
77
77
|
},
|
|
78
78
|
"koishi": {
|
|
79
79
|
"description": {
|