koishi-plugin-chatluna-google-gemini-adapter 1.3.11 → 1.3.12
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 +15 -9
- package/lib/index.mjs +15 -9
- package/lib/utils.d.ts +2 -2
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -345,17 +345,21 @@ function prepareModelConfig(params, pluginConfig) {
|
|
|
345
345
|
} else if (thinkingBudget >= 0 && thinkingBudget < 128) {
|
|
346
346
|
thinkingBudget = 128;
|
|
347
347
|
}
|
|
348
|
-
if (model.includes("
|
|
348
|
+
if (model.includes("gemini-3")) {
|
|
349
349
|
enabledThinking = true;
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
350
|
+
thinkingBudget = void 0;
|
|
351
|
+
const match = model.match(/-(low|medium|high|tiny)-thinking/);
|
|
352
|
+
if (match && match[1]) {
|
|
353
353
|
model = model.replace(`-${match[1]}-thinking`, "");
|
|
354
|
+
}
|
|
355
|
+
if (match && match[1] !== "tiny") {
|
|
356
|
+
thinkingLevel = match[1];
|
|
357
|
+
} else if (match[1] === "tiny") {
|
|
358
|
+
thinkingLevel = void 0;
|
|
359
|
+
thinkingBudget = 128;
|
|
354
360
|
} else {
|
|
355
361
|
thinkingLevel = "THINKING_LEVEL_UNSPECIFIED";
|
|
356
|
-
model = model.replace("-thinking", "");
|
|
357
362
|
}
|
|
358
|
-
thinkingBudget = void 0;
|
|
359
363
|
} else {
|
|
360
364
|
thinkingLevel = void 0;
|
|
361
365
|
}
|
|
@@ -1020,6 +1024,9 @@ var GeminiClient = class extends import_client.PlatformModelAndEmbeddingsClient
|
|
|
1020
1024
|
return logger;
|
|
1021
1025
|
}
|
|
1022
1026
|
async refreshModels(config) {
|
|
1027
|
+
const thinkingModel = ["gemini-2.5-pro", "gemini-2.5-flash"];
|
|
1028
|
+
const thinkingLevelModel = ["gemini-3-pro"];
|
|
1029
|
+
const imageResolutionModel = ["gemini-3-pro-image"];
|
|
1023
1030
|
try {
|
|
1024
1031
|
const rawModels = await this._requester.getModels(config);
|
|
1025
1032
|
if (!rawModels.length) {
|
|
@@ -1040,9 +1047,6 @@ var GeminiClient = class extends import_client.PlatformModelAndEmbeddingsClient
|
|
|
1040
1047
|
import_types2.ModelCapabilities.ToolCall
|
|
1041
1048
|
]
|
|
1042
1049
|
};
|
|
1043
|
-
const thinkingModel = ["gemini-2.5-pro", "gemini-2.5-flash"];
|
|
1044
|
-
const thinkingLevelModel = ["gemini-3.0-pro"];
|
|
1045
|
-
const imageResolutionModel = ["gemini-3.0-pro-image"];
|
|
1046
1050
|
if (imageResolutionModel.some(
|
|
1047
1051
|
(name2) => modelNameLower.includes(name2)
|
|
1048
1052
|
)) {
|
|
@@ -1068,6 +1072,8 @@ var GeminiClient = class extends import_client.PlatformModelAndEmbeddingsClient
|
|
|
1068
1072
|
)) {
|
|
1069
1073
|
models.push(
|
|
1070
1074
|
{ ...info, name: model.name + "-low-thinking" },
|
|
1075
|
+
{ ...info, name: model.name + "-high-thinking" },
|
|
1076
|
+
{ ...info, name: model.name + "-tiny-thinking" },
|
|
1071
1077
|
info
|
|
1072
1078
|
);
|
|
1073
1079
|
} else {
|
package/lib/index.mjs
CHANGED
|
@@ -342,17 +342,21 @@ function prepareModelConfig(params, pluginConfig) {
|
|
|
342
342
|
} else if (thinkingBudget >= 0 && thinkingBudget < 128) {
|
|
343
343
|
thinkingBudget = 128;
|
|
344
344
|
}
|
|
345
|
-
if (model.includes("
|
|
345
|
+
if (model.includes("gemini-3")) {
|
|
346
346
|
enabledThinking = true;
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
347
|
+
thinkingBudget = void 0;
|
|
348
|
+
const match = model.match(/-(low|medium|high|tiny)-thinking/);
|
|
349
|
+
if (match && match[1]) {
|
|
350
350
|
model = model.replace(`-${match[1]}-thinking`, "");
|
|
351
|
+
}
|
|
352
|
+
if (match && match[1] !== "tiny") {
|
|
353
|
+
thinkingLevel = match[1];
|
|
354
|
+
} else if (match[1] === "tiny") {
|
|
355
|
+
thinkingLevel = void 0;
|
|
356
|
+
thinkingBudget = 128;
|
|
351
357
|
} else {
|
|
352
358
|
thinkingLevel = "THINKING_LEVEL_UNSPECIFIED";
|
|
353
|
-
model = model.replace("-thinking", "");
|
|
354
359
|
}
|
|
355
|
-
thinkingBudget = void 0;
|
|
356
360
|
} else {
|
|
357
361
|
thinkingLevel = void 0;
|
|
358
362
|
}
|
|
@@ -1017,6 +1021,9 @@ var GeminiClient = class extends PlatformModelAndEmbeddingsClient {
|
|
|
1017
1021
|
return logger;
|
|
1018
1022
|
}
|
|
1019
1023
|
async refreshModels(config) {
|
|
1024
|
+
const thinkingModel = ["gemini-2.5-pro", "gemini-2.5-flash"];
|
|
1025
|
+
const thinkingLevelModel = ["gemini-3-pro"];
|
|
1026
|
+
const imageResolutionModel = ["gemini-3-pro-image"];
|
|
1020
1027
|
try {
|
|
1021
1028
|
const rawModels = await this._requester.getModels(config);
|
|
1022
1029
|
if (!rawModels.length) {
|
|
@@ -1037,9 +1044,6 @@ var GeminiClient = class extends PlatformModelAndEmbeddingsClient {
|
|
|
1037
1044
|
ModelCapabilities.ToolCall
|
|
1038
1045
|
]
|
|
1039
1046
|
};
|
|
1040
|
-
const thinkingModel = ["gemini-2.5-pro", "gemini-2.5-flash"];
|
|
1041
|
-
const thinkingLevelModel = ["gemini-3.0-pro"];
|
|
1042
|
-
const imageResolutionModel = ["gemini-3.0-pro-image"];
|
|
1043
1047
|
if (imageResolutionModel.some(
|
|
1044
1048
|
(name2) => modelNameLower.includes(name2)
|
|
1045
1049
|
)) {
|
|
@@ -1065,6 +1069,8 @@ var GeminiClient = class extends PlatformModelAndEmbeddingsClient {
|
|
|
1065
1069
|
)) {
|
|
1066
1070
|
models.push(
|
|
1067
1071
|
{ ...info, name: model.name + "-low-thinking" },
|
|
1072
|
+
{ ...info, name: model.name + "-high-thinking" },
|
|
1073
|
+
{ ...info, name: model.name + "-tiny-thinking" },
|
|
1068
1074
|
info
|
|
1069
1075
|
);
|
|
1070
1076
|
} else {
|
package/lib/utils.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare function createGenerationConfig(params: ModelRequestParams, model
|
|
|
33
33
|
imageConfig: {
|
|
34
34
|
imageSize: string;
|
|
35
35
|
};
|
|
36
|
-
thinkingConfig: Record<"thinkingBudget" | "
|
|
36
|
+
thinkingConfig: Record<"thinkingBudget" | "thinkingLevel" | "includeThoughts", string | number | boolean>;
|
|
37
37
|
} & Record<string, any>;
|
|
38
38
|
export declare function createChatGenerationParams(params: ModelRequestParams, plugin: ChatLunaPlugin<ClientConfig, Config>, modelConfig: ReturnType<typeof prepareModelConfig>, pluginConfig: Config): Promise<{
|
|
39
39
|
[x: string]: Record<string, any> | ChatCompletionResponseMessage | ChatCompletionResponseMessage[] | {
|
|
@@ -54,7 +54,7 @@ export declare function createChatGenerationParams(params: ModelRequestParams, p
|
|
|
54
54
|
imageConfig: {
|
|
55
55
|
imageSize: string;
|
|
56
56
|
};
|
|
57
|
-
thinkingConfig: Record<"thinkingBudget" | "
|
|
57
|
+
thinkingConfig: Record<"thinkingBudget" | "thinkingLevel" | "includeThoughts", string | number | boolean>;
|
|
58
58
|
} & Record<string, any>;
|
|
59
59
|
tools: Record<string, any>;
|
|
60
60
|
}>;
|
package/package.json
CHANGED