@kenkaiiii/gg-ai 5.55.1 → 5.56.0
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/dist/index.cjs +22 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -985,7 +985,7 @@ function toOpenAIMessages(messages, options) {
|
|
|
985
985
|
(part) => {
|
|
986
986
|
if (part.type === "text") return { type: "text", text: part.text };
|
|
987
987
|
if (part.type === "video") {
|
|
988
|
-
const videoUrl = part.fileId ? { url: `ms://${part.fileId}`, id: part.fileId } : { url: `data:${part.mediaType};base64,${part.data}` };
|
|
988
|
+
const videoUrl = options?.provider === "moonshot" && part.fileId ? { url: `ms://${part.fileId}`, id: part.fileId } : { url: `data:${part.mediaType};base64,${part.data}` };
|
|
989
989
|
return {
|
|
990
990
|
type: "video_url",
|
|
991
991
|
video_url: videoUrl
|
|
@@ -1923,7 +1923,7 @@ async function* runStream2(options) {
|
|
|
1923
1923
|
const k3Effort = options.thinking ? toKimiK3Effort(options.thinking) : void 0;
|
|
1924
1924
|
const isKimiK27 = options.provider === "moonshot" && options.model.startsWith("kimi-k2.7-code");
|
|
1925
1925
|
const hasFixedKimiSampling = isKimiK3 || isKimiK27;
|
|
1926
|
-
const usesThinkingParam = options.provider === "glm" || options.provider === "moonshot" && !isKimiK3 && !isKimiK27 || options.provider === "xiaomi";
|
|
1926
|
+
const usesThinkingParam = options.provider === "deepseek" || options.provider === "glm" || options.provider === "moonshot" && !isKimiK3 && !isKimiK27 || options.provider === "xiaomi";
|
|
1927
1927
|
const downgradedImages = downgradeUnsupportedImages(options.messages, options.supportsImages);
|
|
1928
1928
|
const downgradedMessages = downgradeUnsupportedVideos(downgradedImages, options.supportsVideo);
|
|
1929
1929
|
if (options.provider === "moonshot") {
|
|
@@ -1949,7 +1949,7 @@ async function* runStream2(options) {
|
|
|
1949
1949
|
model: options.model,
|
|
1950
1950
|
messages,
|
|
1951
1951
|
stream: useStreaming,
|
|
1952
|
-
...options.maxTokens ? { max_completion_tokens: options.maxTokens } : {},
|
|
1952
|
+
...options.maxTokens ? options.provider === "deepseek" || options.provider === "glm" || options.provider === "moonshot" ? { max_tokens: options.maxTokens } : { max_completion_tokens: options.maxTokens } : {},
|
|
1953
1953
|
...effectiveTemp != null && !options.thinking && !hasFixedKimiSampling ? { temperature: effectiveTemp } : {},
|
|
1954
1954
|
...options.topP != null && !hasFixedKimiSampling ? { top_p: options.topP } : {},
|
|
1955
1955
|
...options.stop ? { stop: options.stop } : {},
|
|
@@ -1972,6 +1972,9 @@ async function* runStream2(options) {
|
|
|
1972
1972
|
options.thinking
|
|
1973
1973
|
);
|
|
1974
1974
|
}
|
|
1975
|
+
if (options.provider === "sakana" && options.model === "fugu-ultra" && (options.thinking === "max" || options.thinking === "ultra")) {
|
|
1976
|
+
params.reasoning_effort = "max";
|
|
1977
|
+
}
|
|
1975
1978
|
if (options.provider === "openai" && options.serviceTier) {
|
|
1976
1979
|
params.service_tier = options.serviceTier;
|
|
1977
1980
|
}
|
|
@@ -1988,7 +1991,9 @@ async function* runStream2(options) {
|
|
|
1988
1991
|
if (usesThinkingParam) {
|
|
1989
1992
|
if (options.thinking) {
|
|
1990
1993
|
params.thinking = { type: "enabled" };
|
|
1991
|
-
if (options.provider === "
|
|
1994
|
+
if (options.provider === "deepseek") {
|
|
1995
|
+
params.reasoning_effort = options.thinking === "low" ? "low" : options.thinking === "medium" || options.thinking === "high" ? "high" : "max";
|
|
1996
|
+
} else if (options.provider === "glm") {
|
|
1992
1997
|
params.reasoning_effort = toGlmReasoningEffort(
|
|
1993
1998
|
options.thinking
|
|
1994
1999
|
);
|
|
@@ -2971,6 +2976,8 @@ var CODE_ASSIST_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
|
|
|
2971
2976
|
"gemini-3-flash",
|
|
2972
2977
|
"gemini-3.1-flash-lite",
|
|
2973
2978
|
"gemini-3.7-flash",
|
|
2979
|
+
"gemini-3.8-flash",
|
|
2980
|
+
"gemini-3.5-flash-lite",
|
|
2974
2981
|
"gemini-2.5-pro",
|
|
2975
2982
|
"gemini-2.5-flash",
|
|
2976
2983
|
"gemma-4-31b-it",
|
|
@@ -2994,12 +3001,20 @@ var ACCOUNT_GATED_MODELS = /* @__PURE__ */ new Set([
|
|
|
2994
3001
|
"gemini-3.5-flash",
|
|
2995
3002
|
"gemini-3.1-pro-preview",
|
|
2996
3003
|
"gemini-3.1-pro-preview-customtools",
|
|
2997
|
-
"gemini-3.7-flash"
|
|
3004
|
+
"gemini-3.7-flash",
|
|
3005
|
+
"gemini-3.8-flash",
|
|
3006
|
+
"gemini-3.5-flash-lite"
|
|
2998
3007
|
]);
|
|
2999
3008
|
function accountGatedMessage(model) {
|
|
3009
|
+
if (model === "gemini-3.8-flash" || model === "gemini-3.5-flash-lite") {
|
|
3010
|
+
return `${model} is not available through Code Assist for this account. Public Gemini API availability does not guarantee Code Assist OAuth access.`;
|
|
3011
|
+
}
|
|
3000
3012
|
return `Your Google account isn't entitled to "${model}" over Gemini Code Assist OAuth, so the API reports it as not found. This is an account-access limit, not a ggcoder bug.`;
|
|
3001
3013
|
}
|
|
3002
|
-
function accountGatedHint() {
|
|
3014
|
+
function accountGatedHint(model) {
|
|
3015
|
+
if (model === "gemini-3.8-flash" || model === "gemini-3.5-flash-lite") {
|
|
3016
|
+
return "Use /model to select Gemini 3.1 Flash Lite, or retry once Google enables this model through Code Assist for your account.";
|
|
3017
|
+
}
|
|
3003
3018
|
return `Newer Gemini models (3.7 Flash, 3.5 Flash, 3.1 Pro Preview) are available only to Code Assist Standard/Enterprise accounts with preview/GA access enabled by a cloud admin \u2014 free/personal accounts usually can't call them. Switch to Gemini 3.1 Flash Lite (it works on this account) with /model, or sign in with a Code Assist Standard/Enterprise account that has preview access.`;
|
|
3004
3019
|
}
|
|
3005
3020
|
function formatErrorMessage(status, body, model) {
|
|
@@ -3325,7 +3340,7 @@ async function fetchCodeAssist(plan, options) {
|
|
|
3325
3340
|
throw new ProviderError("gemini", message, {
|
|
3326
3341
|
statusCode: response.status,
|
|
3327
3342
|
...resetsAt !== void 0 ? { resetsAt } : {},
|
|
3328
|
-
...accountGated ? { hint: accountGatedHint() } : {}
|
|
3343
|
+
...accountGated ? { hint: accountGatedHint(options.model) } : {}
|
|
3329
3344
|
});
|
|
3330
3345
|
}
|
|
3331
3346
|
return response;
|