From f1fcd9510ddfedef67af1a24756aa3fb1e830768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ACT=E4=B8=B6=E6=B5=81=E6=98=9F=E9=9B=A8?= <1340145680@qq.com> Date: Fri, 6 Feb 2026 21:43:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0grok=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/utils/ai/text/modelList.ts | 30 ++++++++++++++++++++++++++++++ yarn.lock | 11 ++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 35962ed..5696623 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@ai-sdk/google": "^3.0.20", "@ai-sdk/openai": "^3.0.25", "@ai-sdk/openai-compatible": "^2.0.27", + "@ai-sdk/xai": "^3.0.47", "@rmp135/sql-ts": "^2.2.0", "ai": "^6.0.67", "axios": "^1.13.2", diff --git a/src/utils/ai/text/modelList.ts b/src/utils/ai/text/modelList.ts index a37ea8a..b82a731 100644 --- a/src/utils/ai/text/modelList.ts +++ b/src/utils/ai/text/modelList.ts @@ -5,6 +5,7 @@ import { createQwen } from "qwen-ai-provider"; import { createGoogleGenerativeAI } from "@ai-sdk/google"; import { createAnthropic } from "@ai-sdk/anthropic"; import { createOpenAICompatible } from "@ai-sdk/openai-compatible"; +import { createXai } from '@ai-sdk/xai'; interface Owned { manufacturer: string; @@ -411,6 +412,35 @@ const modelList: Owned[] = [ instance: createAnthropic, tool: true, }, + //xai + { + manufacturer: "xai", + model: "grok-3", + responseFormat: "schema", + image: false, + think: false, + instance: createXai, + tool: true, + }, + { + manufacturer: "xai", + model: "grok-4", + responseFormat: "schema", + image: false, + think: false, + instance: createXai, + tool: true, + }, + { + manufacturer: "xai", + model: "grok-4.1", + responseFormat: "schema", + image: true, + think: false, + instance: createXai, + tool: true, + }, + //其他 { manufacturer: "other", model: "gpt-4.1", diff --git a/yarn.lock b/yarn.lock index 28d17cd..9177991 100644 --- a/yarn.lock +++ b/yarn.lock @@ -49,7 +49,7 @@ "@ai-sdk/provider" "3.0.7" "@ai-sdk/provider-utils" "4.0.13" -"@ai-sdk/openai-compatible@^2.0.27": +"@ai-sdk/openai-compatible@2.0.27", "@ai-sdk/openai-compatible@^2.0.27": version "2.0.27" resolved "https://registry.npmmirror.com/@ai-sdk/openai-compatible/-/openai-compatible-2.0.27.tgz#55c6bf3c59d71e71d9c337dbef8b764fa69e7ccd" integrity sha512-YpAZe7OQuMkYqcM/m1BMX0xFn4QdhuL4qGo8sNaiLq1VjEeU/pPfz51rnlpCfCvYanUL5TjIZEbdclBUwLooSQ== @@ -113,6 +113,15 @@ dependencies: json-schema "^0.4.0" +"@ai-sdk/xai@^3.0.47": + version "3.0.47" + resolved "https://registry.npmmirror.com/@ai-sdk/xai/-/xai-3.0.47.tgz#a8d3e08603865c5e401e19c801c7a80c3f31b890" + integrity sha512-JW43TqzPhc6Y9konMFlQ0kYcdFmTSCFu3yJlXP6RzaJSa3N2CKweUhMhXTzspqvA/wBCkCttTxf8hzXLMtSJ9Q== + dependencies: + "@ai-sdk/openai-compatible" "2.0.27" + "@ai-sdk/provider" "3.0.7" + "@ai-sdk/provider-utils" "4.0.13" + "@develar/schema-utils@~2.6.5": version "2.6.5" resolved "https://registry.npmmirror.com/@develar/schema-utils/-/schema-utils-2.6.5.tgz#3ece22c5838402419a6e0425f85742b961d9b6c6" From 6700a933012464cf43713d008b0a65347754bfae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ACT=E4=B8=B6=E6=B5=81=E6=98=9F=E9=9B=A8?= <1340145680@qq.com> Date: Fri, 6 Feb 2026 23:16:48 +0800 Subject: [PATCH 2/2] no message --- src/utils/ai/text/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/ai/text/index.ts b/src/utils/ai/text/index.ts index 09a987e..f2e450f 100644 --- a/src/utils/ai/text/index.ts +++ b/src/utils/ai/text/index.ts @@ -51,7 +51,7 @@ const buildOptions = async (input: AIInput, config: AIConfig) => { }, }; - const output = input.output ? (outputBuilders[owned.responseFormat]?.(input.output) ?? null) : null; + const output = input.output ? outputBuilders[owned.responseFormat]?.(input.output) ?? null : null; const modelFn = owned.manufacturer == "doubao" ? (modelInstance as OpenAIProvider).chat(model!) : modelInstance(model!); return { config: {