mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2026-04-27 21:44:25 +08:00
Compare commits
4 Commits
feature/ch
...
d08af47342
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d08af47342 | ||
|
|
a5289b39d0 | ||
|
|
1aa647688f | ||
|
|
fb5e9e5aed |
@@ -32,7 +32,7 @@ One-Click to get a well-designed cross-platform ChatGPT web UI, with Claude, GPT
|
|||||||
[MacOS-image]: https://img.shields.io/badge/-MacOS-black?logo=apple
|
[MacOS-image]: https://img.shields.io/badge/-MacOS-black?logo=apple
|
||||||
[Linux-image]: https://img.shields.io/badge/-Linux-333?logo=ubuntu
|
[Linux-image]: https://img.shields.io/badge/-Linux-333?logo=ubuntu
|
||||||
|
|
||||||
[<img src="https://vercel.com/button" alt="Deploy on Vercel" height="30">](https://vercel.com/new/clone?repository-url=https://github.com/Dogtiti/ChatGPT-Next-Web-EarlyBird&env=OPENAI_API_KEY&env=CODE&project-name=nextchat-earlyBird&repository-name=NextChat-EarlyBird) [<img src="https://zeabur.com/button.svg" alt="Deploy on Zeabur" height="30">](https://zeabur.com/templates/ZBUEFA) [<img src="https://gitpod.io/button/open-in-gitpod.svg" alt="Open in Gitpod" height="30">](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) [<img src="https://img.shields.io/badge/BT_Deploy-Install-20a53a" alt="BT Deply Install" height="30">](https://www.bt.cn/new/download.html)
|
[<img src="https://vercel.com/button" alt="Deploy on Vercel" height="30">](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FChatGPTNextWeb%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=nextchat&repository-name=NextChat) [<img src="https://zeabur.com/button.svg" alt="Deploy on Zeabur" height="30">](https://zeabur.com/templates/ZBUEFA) [<img src="https://gitpod.io/button/open-in-gitpod.svg" alt="Open in Gitpod" height="30">](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) [<img src="https://img.shields.io/badge/BT_Deploy-Install-20a53a" alt="BT Deply Install" height="30">](https://www.bt.cn/new/download.html)
|
||||||
|
|
||||||
[<img src="https://github.com/user-attachments/assets/903482d4-3e87-4134-9af1-f2588fa90659" height="60" width="288" >](https://monica.im/?utm=nxcrp)
|
[<img src="https://github.com/user-attachments/assets/903482d4-3e87-4134-9af1-f2588fa90659" height="60" width="288" >](https://monica.im/?utm=nxcrp)
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ If you want to add a new translation, read this [document](./docs/translation.md
|
|||||||
|
|
||||||
## Donation
|
## Donation
|
||||||
|
|
||||||
[Buy Me a Coffee](https://1kafei.com/dogtiti)
|
[Buy Me a Coffee](https://www.buymeacoffee.com/yidadaa)
|
||||||
|
|
||||||
## Special Thanks
|
## Special Thanks
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
1. 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys);
|
1. 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys);
|
||||||
2. 点击右侧按钮开始部署:
|
2. 点击右侧按钮开始部署:
|
||||||
[](https://vercel.com/new/clone?repository-url=https://github.com/Dogtiti/ChatGPT-Next-Web-EarlyBird&env=OPENAI_API_KEY&env=CODE&project-name=nextchat-earlyBird&repository-name=NextChat-EarlyBird),直接使用 Github 账号登录即可,记得在环境变量页填入 API Key 和[页面访问密码](#配置页面访问密码) CODE;
|
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&env=GOOGLE_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web),直接使用 Github 账号登录即可,记得在环境变量页填入 API Key 和[页面访问密码](#配置页面访问密码) CODE;
|
||||||
3. 部署完毕后,即可开始使用;
|
3. 部署完毕后,即可开始使用;
|
||||||
4. (可选)[绑定自定义域名](https://vercel.com/docs/concepts/projects/domains/add-a-domain):Vercel 分配的域名 DNS 在某些区域被污染了,绑定自定义域名即可直连。
|
4. (可选)[绑定自定义域名](https://vercel.com/docs/concepts/projects/domains/add-a-domain):Vercel 分配的域名 DNS 在某些区域被污染了,绑定自定义域名即可直连。
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
1. [OpenAI API Key](https://platform.openai.com/account/api-keys)を準備する;
|
1. [OpenAI API Key](https://platform.openai.com/account/api-keys)を準備する;
|
||||||
2. 右側のボタンをクリックしてデプロイを開始:
|
2. 右側のボタンをクリックしてデプロイを開始:
|
||||||
[](https://vercel.com/new/clone?repository-url=https://github.com/Dogtiti/ChatGPT-Next-Web-EarlyBird&env=OPENAI_API_KEY&env=CODE&project-name=nextchat-earlyBird&repository-name=NextChat-EarlyBird) 、GitHubアカウントで直接ログインし、環境変数ページにAPI Keyと[ページアクセスパスワード](#設定ページアクセスパスワード) CODEを入力してください;
|
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&env=GOOGLE_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) 、GitHubアカウントで直接ログインし、環境変数ページにAPI Keyと[ページアクセスパスワード](#設定ページアクセスパスワード) CODEを入力してください;
|
||||||
3. デプロイが完了したら、すぐに使用を開始できます;
|
3. デプロイが完了したら、すぐに使用を開始できます;
|
||||||
4. (オプション)[カスタムドメインをバインド](https://vercel.com/docs/concepts/projects/domains/add-a-domain):Vercelが割り当てたドメインDNSは一部の地域で汚染されているため、カスタムドメインをバインドすると直接接続できます。
|
4. (オプション)[カスタムドメインをバインド](https://vercel.com/docs/concepts/projects/domains/add-a-domain):Vercelが割り当てたドメインDNSは一部の地域で汚染されているため、カスタムドメインをバインドすると直接接続できます。
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ const DANGER_CONFIG = {
|
|||||||
hideBalanceQuery: serverConfig.hideBalanceQuery,
|
hideBalanceQuery: serverConfig.hideBalanceQuery,
|
||||||
disableFastLink: serverConfig.disableFastLink,
|
disableFastLink: serverConfig.disableFastLink,
|
||||||
customModels: serverConfig.customModels,
|
customModels: serverConfig.customModels,
|
||||||
|
visionModels: serverConfig.visionModels,
|
||||||
defaultModel: serverConfig.defaultModel,
|
defaultModel: serverConfig.defaultModel,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -84,10 +84,13 @@ export class ClaudeApi implements LLMApi {
|
|||||||
return res?.content?.[0]?.text;
|
return res?.content?.[0]?.text;
|
||||||
}
|
}
|
||||||
async chat(options: ChatOptions): Promise<void> {
|
async chat(options: ChatOptions): Promise<void> {
|
||||||
const visionModel = isVisionModel(options.config.model);
|
|
||||||
|
|
||||||
const accessStore = useAccessStore.getState();
|
const accessStore = useAccessStore.getState();
|
||||||
|
|
||||||
|
const visionModel = isVisionModel(
|
||||||
|
options.config.model,
|
||||||
|
accessStore.visionModels,
|
||||||
|
);
|
||||||
|
|
||||||
const shouldStream = !!options.config.stream;
|
const shouldStream = !!options.config.stream;
|
||||||
|
|
||||||
const modelConfig = {
|
const modelConfig = {
|
||||||
|
|||||||
@@ -25,103 +25,12 @@ import { getMessageTextContent } from "@/app/utils";
|
|||||||
import { RequestPayload } from "./openai";
|
import { RequestPayload } from "./openai";
|
||||||
import { fetch } from "@/app/utils/stream";
|
import { fetch } from "@/app/utils/stream";
|
||||||
|
|
||||||
interface BasePayload {
|
|
||||||
model: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ChatPayload extends BasePayload {
|
|
||||||
messages: ChatOptions["messages"];
|
|
||||||
stream?: boolean;
|
|
||||||
temperature?: number;
|
|
||||||
presence_penalty?: number;
|
|
||||||
frequency_penalty?: number;
|
|
||||||
top_p?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ImageGenerationPayload extends BasePayload {
|
|
||||||
prompt: string;
|
|
||||||
size?: string;
|
|
||||||
user_id?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface VideoGenerationPayload extends BasePayload {
|
|
||||||
prompt: string;
|
|
||||||
duration?: number;
|
|
||||||
resolution?: string;
|
|
||||||
user_id?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type ModelType = "chat" | "image" | "video";
|
|
||||||
|
|
||||||
export class ChatGLMApi implements LLMApi {
|
export class ChatGLMApi implements LLMApi {
|
||||||
private disableListModels = true;
|
private disableListModels = true;
|
||||||
|
|
||||||
private getModelType(model: string): ModelType {
|
|
||||||
if (model.startsWith("cogview-")) return "image";
|
|
||||||
if (model.startsWith("cogvideo-")) return "video";
|
|
||||||
return "chat";
|
|
||||||
}
|
|
||||||
|
|
||||||
private getModelPath(type: ModelType): string {
|
|
||||||
switch (type) {
|
|
||||||
case "image":
|
|
||||||
return ChatGLM.ImagePath;
|
|
||||||
case "video":
|
|
||||||
return ChatGLM.VideoPath;
|
|
||||||
default:
|
|
||||||
return ChatGLM.ChatPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private createPayload(
|
|
||||||
messages: ChatOptions["messages"],
|
|
||||||
modelConfig: any,
|
|
||||||
options: ChatOptions,
|
|
||||||
): BasePayload {
|
|
||||||
const modelType = this.getModelType(modelConfig.model);
|
|
||||||
const lastMessage = messages[messages.length - 1];
|
|
||||||
const prompt =
|
|
||||||
typeof lastMessage.content === "string"
|
|
||||||
? lastMessage.content
|
|
||||||
: lastMessage.content.map((c) => c.text).join("\n");
|
|
||||||
|
|
||||||
switch (modelType) {
|
|
||||||
case "image":
|
|
||||||
return {
|
|
||||||
model: modelConfig.model,
|
|
||||||
prompt,
|
|
||||||
size: options.config.size,
|
|
||||||
} as ImageGenerationPayload;
|
|
||||||
default:
|
|
||||||
return {
|
|
||||||
messages,
|
|
||||||
stream: options.config.stream,
|
|
||||||
model: modelConfig.model,
|
|
||||||
temperature: modelConfig.temperature,
|
|
||||||
presence_penalty: modelConfig.presence_penalty,
|
|
||||||
frequency_penalty: modelConfig.frequency_penalty,
|
|
||||||
top_p: modelConfig.top_p,
|
|
||||||
} as ChatPayload;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private parseResponse(modelType: ModelType, json: any): string {
|
|
||||||
switch (modelType) {
|
|
||||||
case "image": {
|
|
||||||
const imageUrl = json.data?.[0]?.url;
|
|
||||||
return imageUrl ? `` : "";
|
|
||||||
}
|
|
||||||
case "video": {
|
|
||||||
const videoUrl = json.data?.[0]?.url;
|
|
||||||
return videoUrl ? `<video controls src="${videoUrl}"></video>` : "";
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return this.extractMessage(json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
path(path: string): string {
|
path(path: string): string {
|
||||||
const accessStore = useAccessStore.getState();
|
const accessStore = useAccessStore.getState();
|
||||||
|
|
||||||
let baseUrl = "";
|
let baseUrl = "";
|
||||||
|
|
||||||
if (accessStore.useCustomConfig) {
|
if (accessStore.useCustomConfig) {
|
||||||
@@ -142,6 +51,7 @@ export class ChatGLMApi implements LLMApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log("[Proxy Endpoint] ", baseUrl, path);
|
console.log("[Proxy Endpoint] ", baseUrl, path);
|
||||||
|
|
||||||
return [baseUrl, path].join("/");
|
return [baseUrl, path].join("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,16 +79,24 @@ export class ChatGLMApi implements LLMApi {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const modelType = this.getModelType(modelConfig.model);
|
const requestPayload: RequestPayload = {
|
||||||
const requestPayload = this.createPayload(messages, modelConfig, options);
|
messages,
|
||||||
const path = this.path(this.getModelPath(modelType));
|
stream: options.config.stream,
|
||||||
|
model: modelConfig.model,
|
||||||
|
temperature: modelConfig.temperature,
|
||||||
|
presence_penalty: modelConfig.presence_penalty,
|
||||||
|
frequency_penalty: modelConfig.frequency_penalty,
|
||||||
|
top_p: modelConfig.top_p,
|
||||||
|
};
|
||||||
|
|
||||||
console.log(`[Request] glm ${modelType} payload: `, requestPayload);
|
console.log("[Request] glm payload: ", requestPayload);
|
||||||
|
|
||||||
|
const shouldStream = !!options.config.stream;
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
options.onController?.(controller);
|
options.onController?.(controller);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const chatPath = this.path(ChatGLM.ChatPath);
|
||||||
const chatPayload = {
|
const chatPayload = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(requestPayload),
|
body: JSON.stringify(requestPayload),
|
||||||
@@ -186,23 +104,12 @@ export class ChatGLMApi implements LLMApi {
|
|||||||
headers: getHeaders(),
|
headers: getHeaders(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// make a fetch request
|
||||||
const requestTimeoutId = setTimeout(
|
const requestTimeoutId = setTimeout(
|
||||||
() => controller.abort(),
|
() => controller.abort(),
|
||||||
REQUEST_TIMEOUT_MS,
|
REQUEST_TIMEOUT_MS,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (modelType === "image" || modelType === "video") {
|
|
||||||
const res = await fetch(path, chatPayload);
|
|
||||||
clearTimeout(requestTimeoutId);
|
|
||||||
|
|
||||||
const resJson = await res.json();
|
|
||||||
console.log(`[Response] glm ${modelType}:`, resJson);
|
|
||||||
const message = this.parseResponse(modelType, resJson);
|
|
||||||
options.onFinish(message, res);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const shouldStream = !!options.config.stream;
|
|
||||||
if (shouldStream) {
|
if (shouldStream) {
|
||||||
const [tools, funcs] = usePluginStore
|
const [tools, funcs] = usePluginStore
|
||||||
.getState()
|
.getState()
|
||||||
@@ -210,7 +117,7 @@ export class ChatGLMApi implements LLMApi {
|
|||||||
useChatStore.getState().currentSession().mask?.plugin || [],
|
useChatStore.getState().currentSession().mask?.plugin || [],
|
||||||
);
|
);
|
||||||
return stream(
|
return stream(
|
||||||
path,
|
chatPath,
|
||||||
requestPayload,
|
requestPayload,
|
||||||
getHeaders(),
|
getHeaders(),
|
||||||
tools as any,
|
tools as any,
|
||||||
@@ -218,6 +125,7 @@ export class ChatGLMApi implements LLMApi {
|
|||||||
controller,
|
controller,
|
||||||
// parseSSE
|
// parseSSE
|
||||||
(text: string, runTools: ChatMessageTool[]) => {
|
(text: string, runTools: ChatMessageTool[]) => {
|
||||||
|
// console.log("parseSSE", text, runTools);
|
||||||
const json = JSON.parse(text);
|
const json = JSON.parse(text);
|
||||||
const choices = json.choices as Array<{
|
const choices = json.choices as Array<{
|
||||||
delta: {
|
delta: {
|
||||||
@@ -246,7 +154,7 @@ export class ChatGLMApi implements LLMApi {
|
|||||||
}
|
}
|
||||||
return choices[0]?.delta?.content;
|
return choices[0]?.delta?.content;
|
||||||
},
|
},
|
||||||
// processToolMessage
|
// processToolMessage, include tool_calls message and tool call results
|
||||||
(
|
(
|
||||||
requestPayload: RequestPayload,
|
requestPayload: RequestPayload,
|
||||||
toolCallMessage: any,
|
toolCallMessage: any,
|
||||||
@@ -264,7 +172,7 @@ export class ChatGLMApi implements LLMApi {
|
|||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const res = await fetch(path, chatPayload);
|
const res = await fetch(chatPath, chatPayload);
|
||||||
clearTimeout(requestTimeoutId);
|
clearTimeout(requestTimeoutId);
|
||||||
|
|
||||||
const resJson = await res.json();
|
const resJson = await res.json();
|
||||||
@@ -276,7 +184,6 @@ export class ChatGLMApi implements LLMApi {
|
|||||||
options.onError?.(e as Error);
|
options.onError?.(e as Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async usage() {
|
async usage() {
|
||||||
return {
|
return {
|
||||||
used: 0,
|
used: 0,
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export class GeminiProApi implements LLMApi {
|
|||||||
}
|
}
|
||||||
const messages = _messages.map((v) => {
|
const messages = _messages.map((v) => {
|
||||||
let parts: any[] = [{ text: getMessageTextContent(v) }];
|
let parts: any[] = [{ text: getMessageTextContent(v) }];
|
||||||
if (isVisionModel(options.config.model)) {
|
if (isVisionModel(options.config.model, accessStore.visionModels)) {
|
||||||
const images = getMessageImages(v);
|
const images = getMessageImages(v);
|
||||||
if (images.length > 0) {
|
if (images.length > 0) {
|
||||||
multimodal = true;
|
multimodal = true;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import {
|
|||||||
stream,
|
stream,
|
||||||
} from "@/app/utils/chat";
|
} from "@/app/utils/chat";
|
||||||
import { cloudflareAIGatewayUrl } from "@/app/utils/cloudflare";
|
import { cloudflareAIGatewayUrl } from "@/app/utils/cloudflare";
|
||||||
import { ModelSize, DalleQuality, DalleStyle } from "@/app/typing";
|
import { DalleSize, DalleQuality, DalleStyle } from "@/app/typing";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ChatOptions,
|
ChatOptions,
|
||||||
@@ -73,7 +73,7 @@ export interface DalleRequestPayload {
|
|||||||
prompt: string;
|
prompt: string;
|
||||||
response_format: "url" | "b64_json";
|
response_format: "url" | "b64_json";
|
||||||
n: number;
|
n: number;
|
||||||
size: ModelSize;
|
size: DalleSize;
|
||||||
quality: DalleQuality;
|
quality: DalleQuality;
|
||||||
style: DalleStyle;
|
style: DalleStyle;
|
||||||
}
|
}
|
||||||
@@ -194,6 +194,8 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
|
|
||||||
let requestPayload: RequestPayload | DalleRequestPayload;
|
let requestPayload: RequestPayload | DalleRequestPayload;
|
||||||
|
|
||||||
|
const accessStore = useAccessStore.getState();
|
||||||
|
|
||||||
const isDalle3 = _isDalle3(options.config.model);
|
const isDalle3 = _isDalle3(options.config.model);
|
||||||
const isO1 = options.config.model.startsWith("o1");
|
const isO1 = options.config.model.startsWith("o1");
|
||||||
if (isDalle3) {
|
if (isDalle3) {
|
||||||
@@ -211,7 +213,10 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
style: options.config?.style ?? "vivid",
|
style: options.config?.style ?? "vivid",
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const visionModel = isVisionModel(options.config.model);
|
const visionModel = isVisionModel(
|
||||||
|
options.config.model,
|
||||||
|
accessStore.visionModels,
|
||||||
|
);
|
||||||
const messages: ChatOptions["messages"] = [];
|
const messages: ChatOptions["messages"] = [];
|
||||||
for (const v of options.messages) {
|
for (const v of options.messages) {
|
||||||
const content = visionModel
|
const content = visionModel
|
||||||
|
|||||||
@@ -94,7 +94,11 @@ export class HunyuanApi implements LLMApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async chat(options: ChatOptions) {
|
async chat(options: ChatOptions) {
|
||||||
const visionModel = isVisionModel(options.config.model);
|
const accessStore = useAccessStore.getState();
|
||||||
|
const visionModel = isVisionModel(
|
||||||
|
options.config.model,
|
||||||
|
accessStore.visionModels,
|
||||||
|
);
|
||||||
const messages = options.messages.map((v, index) => ({
|
const messages = options.messages.map((v, index) => ({
|
||||||
// "Messages 中 system 角色必须位于列表的最开始"
|
// "Messages 中 system 角色必须位于列表的最开始"
|
||||||
role: index !== 0 && v.role === "system" ? "user" : v.role,
|
role: index !== 0 && v.role === "system" ? "user" : v.role,
|
||||||
|
|||||||
@@ -72,8 +72,6 @@ import {
|
|||||||
isDalle3,
|
isDalle3,
|
||||||
showPlugins,
|
showPlugins,
|
||||||
safeLocalStorage,
|
safeLocalStorage,
|
||||||
getModelSizes,
|
|
||||||
supportsCustomSize,
|
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
|
|
||||||
import { uploadImage as uploadImageRemote } from "@/app/utils/chat";
|
import { uploadImage as uploadImageRemote } from "@/app/utils/chat";
|
||||||
@@ -81,7 +79,7 @@ import { uploadImage as uploadImageRemote } from "@/app/utils/chat";
|
|||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
|
|
||||||
import { ChatControllerPool } from "../client/controller";
|
import { ChatControllerPool } from "../client/controller";
|
||||||
import { DalleQuality, DalleStyle, ModelSize } from "../typing";
|
import { DalleSize, DalleQuality, DalleStyle } from "../typing";
|
||||||
import { Prompt, usePromptStore } from "../store/prompt";
|
import { Prompt, usePromptStore } from "../store/prompt";
|
||||||
import Locale from "../locales";
|
import Locale from "../locales";
|
||||||
|
|
||||||
@@ -492,6 +490,7 @@ export function ChatActions(props: {
|
|||||||
const currentProviderName =
|
const currentProviderName =
|
||||||
session.mask.modelConfig?.providerName || ServiceProvider.OpenAI;
|
session.mask.modelConfig?.providerName || ServiceProvider.OpenAI;
|
||||||
const allModels = useAllModels();
|
const allModels = useAllModels();
|
||||||
|
const customVisionModels = useAccessStore().visionModels;
|
||||||
const models = useMemo(() => {
|
const models = useMemo(() => {
|
||||||
const filteredModels = allModels.filter((m) => m.available);
|
const filteredModels = allModels.filter((m) => m.available);
|
||||||
const defaultModel = filteredModels.find((m) => m.isDefault);
|
const defaultModel = filteredModels.find((m) => m.isDefault);
|
||||||
@@ -521,18 +520,17 @@ export function ChatActions(props: {
|
|||||||
const [showSizeSelector, setShowSizeSelector] = useState(false);
|
const [showSizeSelector, setShowSizeSelector] = useState(false);
|
||||||
const [showQualitySelector, setShowQualitySelector] = useState(false);
|
const [showQualitySelector, setShowQualitySelector] = useState(false);
|
||||||
const [showStyleSelector, setShowStyleSelector] = useState(false);
|
const [showStyleSelector, setShowStyleSelector] = useState(false);
|
||||||
const modelSizes = getModelSizes(currentModel);
|
const dalle3Sizes: DalleSize[] = ["1024x1024", "1792x1024", "1024x1792"];
|
||||||
const dalle3Qualitys: DalleQuality[] = ["standard", "hd"];
|
const dalle3Qualitys: DalleQuality[] = ["standard", "hd"];
|
||||||
const dalle3Styles: DalleStyle[] = ["vivid", "natural"];
|
const dalle3Styles: DalleStyle[] = ["vivid", "natural"];
|
||||||
const currentSize =
|
const currentSize = session.mask.modelConfig?.size ?? "1024x1024";
|
||||||
session.mask.modelConfig?.size ?? ("1024x1024" as ModelSize);
|
|
||||||
const currentQuality = session.mask.modelConfig?.quality ?? "standard";
|
const currentQuality = session.mask.modelConfig?.quality ?? "standard";
|
||||||
const currentStyle = session.mask.modelConfig?.style ?? "vivid";
|
const currentStyle = session.mask.modelConfig?.style ?? "vivid";
|
||||||
|
|
||||||
const isMobileScreen = useMobileScreen();
|
const isMobileScreen = useMobileScreen();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const show = isVisionModel(currentModel);
|
const show = isVisionModel(currentModel, customVisionModels);
|
||||||
setShowUploadImage(show);
|
setShowUploadImage(show);
|
||||||
if (!show) {
|
if (!show) {
|
||||||
props.setAttachImages([]);
|
props.setAttachImages([]);
|
||||||
@@ -676,7 +674,7 @@ export function ChatActions(props: {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{supportsCustomSize(currentModel) && (
|
{isDalle3(currentModel) && (
|
||||||
<ChatAction
|
<ChatAction
|
||||||
onClick={() => setShowSizeSelector(true)}
|
onClick={() => setShowSizeSelector(true)}
|
||||||
text={currentSize}
|
text={currentSize}
|
||||||
@@ -687,7 +685,7 @@ export function ChatActions(props: {
|
|||||||
{showSizeSelector && (
|
{showSizeSelector && (
|
||||||
<Selector
|
<Selector
|
||||||
defaultSelectedValue={currentSize}
|
defaultSelectedValue={currentSize}
|
||||||
items={modelSizes.map((m) => ({
|
items={dalle3Sizes.map((m) => ({
|
||||||
title: m,
|
title: m,
|
||||||
value: m,
|
value: m,
|
||||||
}))}
|
}))}
|
||||||
@@ -1413,6 +1411,7 @@ function _Chat() {
|
|||||||
const payload = JSON.parse(text) as {
|
const payload = JSON.parse(text) as {
|
||||||
key?: string;
|
key?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
|
code?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("[Command] got settings from url: ", payload);
|
console.log("[Command] got settings from url: ", payload);
|
||||||
@@ -1434,6 +1433,16 @@ function _Chat() {
|
|||||||
accessStore.update((access) => (access.useCustomConfig = true));
|
accessStore.update((access) => (access.useCustomConfig = true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (payload.code) {
|
||||||
|
accessStore.update((access) => (access.accessCode = payload.code!));
|
||||||
|
if (accessStore.isAuthorized()) {
|
||||||
|
context.pop();
|
||||||
|
const copiedHello = Object.assign({}, BOT_HELLO);
|
||||||
|
context.push(copiedHello);
|
||||||
|
setUserInput(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
console.error("[Command] failed to get settings from url: ", text);
|
console.error("[Command] failed to get settings from url: ", text);
|
||||||
}
|
}
|
||||||
@@ -1460,10 +1469,12 @@ function _Chat() {
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const customVisionModels = useAccessStore().visionModels;
|
||||||
|
|
||||||
const handlePaste = useCallback(
|
const handlePaste = useCallback(
|
||||||
async (event: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
async (event: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
||||||
const currentModel = chatStore.currentSession().mask.modelConfig.model;
|
const currentModel = chatStore.currentSession().mask.modelConfig.model;
|
||||||
if (!isVisionModel(currentModel)) {
|
if (!isVisionModel(currentModel, customVisionModels)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const items = (event.clipboardData || window.clipboardData).items;
|
const items = (event.clipboardData || window.clipboardData).items;
|
||||||
@@ -1500,7 +1511,7 @@ function _Chat() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[attachImages, chatStore],
|
[attachImages, chatStore, customVisionModels],
|
||||||
);
|
);
|
||||||
|
|
||||||
async function uploadImage() {
|
async function uploadImage() {
|
||||||
@@ -1548,7 +1559,7 @@ function _Chat() {
|
|||||||
setAttachImages(images);
|
setAttachImages(images);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 快捷键 shortcut keys
|
// 捷键 shortcut keys
|
||||||
const [showShortcutKeyModal, setShowShortcutKeyModal] = useState(false);
|
const [showShortcutKeyModal, setShowShortcutKeyModal] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ declare global {
|
|||||||
ENABLE_BALANCE_QUERY?: string; // allow user to query balance or not
|
ENABLE_BALANCE_QUERY?: string; // allow user to query balance or not
|
||||||
DISABLE_FAST_LINK?: string; // disallow parse settings from url or not
|
DISABLE_FAST_LINK?: string; // disallow parse settings from url or not
|
||||||
CUSTOM_MODELS?: string; // to control custom models
|
CUSTOM_MODELS?: string; // to control custom models
|
||||||
|
VISION_MODELS?: string; // to control vision models
|
||||||
DEFAULT_MODEL?: string; // to control default model in every new chat window
|
DEFAULT_MODEL?: string; // to control default model in every new chat window
|
||||||
|
|
||||||
// stability only
|
// stability only
|
||||||
@@ -123,13 +124,16 @@ export const getServerSideConfig = () => {
|
|||||||
|
|
||||||
const disableGPT4 = !!process.env.DISABLE_GPT4;
|
const disableGPT4 = !!process.env.DISABLE_GPT4;
|
||||||
let customModels = process.env.CUSTOM_MODELS ?? "";
|
let customModels = process.env.CUSTOM_MODELS ?? "";
|
||||||
|
let visionModels = process.env.VISION_MODELS ?? "";
|
||||||
let defaultModel = process.env.DEFAULT_MODEL ?? "";
|
let defaultModel = process.env.DEFAULT_MODEL ?? "";
|
||||||
|
|
||||||
if (disableGPT4) {
|
if (disableGPT4) {
|
||||||
if (customModels) customModels += ",";
|
if (customModels) customModels += ",";
|
||||||
customModels += DEFAULT_MODELS.filter(
|
customModels += DEFAULT_MODELS.filter(
|
||||||
(m) =>
|
(m) =>
|
||||||
(m.name.startsWith("gpt-4") || m.name.startsWith("chatgpt-4o") || m.name.startsWith("o1")) &&
|
(m.name.startsWith("gpt-4") ||
|
||||||
|
m.name.startsWith("chatgpt-4o") ||
|
||||||
|
m.name.startsWith("o1")) &&
|
||||||
!m.name.startsWith("gpt-4o-mini"),
|
!m.name.startsWith("gpt-4o-mini"),
|
||||||
)
|
)
|
||||||
.map((m) => "-" + m.name)
|
.map((m) => "-" + m.name)
|
||||||
@@ -247,6 +251,7 @@ export const getServerSideConfig = () => {
|
|||||||
hideBalanceQuery: !process.env.ENABLE_BALANCE_QUERY,
|
hideBalanceQuery: !process.env.ENABLE_BALANCE_QUERY,
|
||||||
disableFastLink: !!process.env.DISABLE_FAST_LINK,
|
disableFastLink: !!process.env.DISABLE_FAST_LINK,
|
||||||
customModels,
|
customModels,
|
||||||
|
visionModels,
|
||||||
defaultModel,
|
defaultModel,
|
||||||
allowedWebDavEndpoints,
|
allowedWebDavEndpoints,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -233,8 +233,6 @@ export const XAI = {
|
|||||||
export const ChatGLM = {
|
export const ChatGLM = {
|
||||||
ExampleEndpoint: CHATGLM_BASE_URL,
|
ExampleEndpoint: CHATGLM_BASE_URL,
|
||||||
ChatPath: "api/paas/v4/chat/completions",
|
ChatPath: "api/paas/v4/chat/completions",
|
||||||
ImagePath: "api/paas/v4/images/generations",
|
|
||||||
VideoPath: "api/paas/v4/videos/generations",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
|
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
|
||||||
@@ -433,15 +431,6 @@ const chatglmModels = [
|
|||||||
"glm-4-long",
|
"glm-4-long",
|
||||||
"glm-4-flashx",
|
"glm-4-flashx",
|
||||||
"glm-4-flash",
|
"glm-4-flash",
|
||||||
"glm-4v-plus",
|
|
||||||
"glm-4v",
|
|
||||||
"glm-4v-flash", // free
|
|
||||||
"cogview-3-plus",
|
|
||||||
"cogview-3",
|
|
||||||
"cogview-3-flash", // free
|
|
||||||
// 目前无法适配轮询任务
|
|
||||||
// "cogvideox",
|
|
||||||
// "cogvideox-flash", // free
|
|
||||||
];
|
];
|
||||||
|
|
||||||
let seq = 1000; // 内置的模型序号生成器从1000开始
|
let seq = 1000; // 内置的模型序号生成器从1000开始
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ const DEFAULT_ACCESS_STATE = {
|
|||||||
disableGPT4: false,
|
disableGPT4: false,
|
||||||
disableFastLink: false,
|
disableFastLink: false,
|
||||||
customModels: "",
|
customModels: "",
|
||||||
|
visionModels: "",
|
||||||
defaultModel: "",
|
defaultModel: "",
|
||||||
|
|
||||||
// tts config
|
// tts config
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { LLMModel } from "../client/api";
|
import { LLMModel } from "../client/api";
|
||||||
import { DalleQuality, DalleStyle, ModelSize } from "../typing";
|
import { DalleSize, DalleQuality, DalleStyle } from "../typing";
|
||||||
import { getClientConfig } from "../config/client";
|
import { getClientConfig } from "../config/client";
|
||||||
import {
|
import {
|
||||||
DEFAULT_INPUT_TEMPLATE,
|
DEFAULT_INPUT_TEMPLATE,
|
||||||
DEFAULT_MODELS,
|
DEFAULT_MODELS,
|
||||||
DEFAULT_SIDEBAR_WIDTH,
|
|
||||||
DEFAULT_TTS_ENGINE,
|
DEFAULT_TTS_ENGINE,
|
||||||
DEFAULT_TTS_ENGINES,
|
DEFAULT_TTS_ENGINES,
|
||||||
DEFAULT_TTS_MODEL,
|
DEFAULT_TTS_MODEL,
|
||||||
@@ -46,18 +45,20 @@ export const DEFAULT_CONFIG = {
|
|||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontFamily: "",
|
fontFamily: "",
|
||||||
theme: Theme.Auto as Theme,
|
theme: Theme.Auto as Theme,
|
||||||
tightBorder: !!config?.isApp,
|
// tightBorder: !!config?.isApp,
|
||||||
sendPreviewBubble: true,
|
tightBorder: true,
|
||||||
|
sendPreviewBubble: false,
|
||||||
enableAutoGenerateTitle: true,
|
enableAutoGenerateTitle: true,
|
||||||
sidebarWidth: DEFAULT_SIDEBAR_WIDTH,
|
// sidebarWidth: DEFAULT_SIDEBAR_WIDTH,
|
||||||
|
sidebarWidth: 100,
|
||||||
|
|
||||||
enableArtifacts: true, // show artifacts config
|
enableArtifacts: true, // show artifacts config
|
||||||
|
|
||||||
enableCodeFold: true, // code fold config
|
enableCodeFold: true, // code fold config
|
||||||
|
|
||||||
disablePromptHint: false,
|
disablePromptHint: true,
|
||||||
|
|
||||||
dontShowMaskSplashScreen: false, // dont show splash screen when create chat
|
dontShowMaskSplashScreen: true, // dont show splash screen when create chat
|
||||||
hideBuiltinMasks: false, // dont add builtin masks
|
hideBuiltinMasks: false, // dont add builtin masks
|
||||||
|
|
||||||
customModels: "",
|
customModels: "",
|
||||||
@@ -68,17 +69,17 @@ export const DEFAULT_CONFIG = {
|
|||||||
providerName: "OpenAI" as ServiceProvider,
|
providerName: "OpenAI" as ServiceProvider,
|
||||||
temperature: 0.5,
|
temperature: 0.5,
|
||||||
top_p: 1,
|
top_p: 1,
|
||||||
max_tokens: 4000,
|
max_tokens: 8000,
|
||||||
presence_penalty: 0,
|
presence_penalty: 0,
|
||||||
frequency_penalty: 0,
|
frequency_penalty: 0,
|
||||||
sendMemory: true,
|
sendMemory: true,
|
||||||
historyMessageCount: 4,
|
historyMessageCount: 16,
|
||||||
compressMessageLengthThreshold: 1000,
|
compressMessageLengthThreshold: 1000000,
|
||||||
compressModel: "",
|
compressModel: "",
|
||||||
compressProviderName: "",
|
compressProviderName: "",
|
||||||
enableInjectSystemPrompts: true,
|
enableInjectSystemPrompts: true,
|
||||||
template: config?.template ?? DEFAULT_INPUT_TEMPLATE,
|
template: config?.template ?? DEFAULT_INPUT_TEMPLATE,
|
||||||
size: "1024x1024" as ModelSize,
|
size: "1024x1024" as DalleSize,
|
||||||
quality: "standard" as DalleQuality,
|
quality: "standard" as DalleQuality,
|
||||||
style: "vivid" as DalleStyle,
|
style: "vivid" as DalleStyle,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,14 +11,3 @@ export interface RequestMessage {
|
|||||||
export type DalleSize = "1024x1024" | "1792x1024" | "1024x1792";
|
export type DalleSize = "1024x1024" | "1792x1024" | "1024x1792";
|
||||||
export type DalleQuality = "standard" | "hd";
|
export type DalleQuality = "standard" | "hd";
|
||||||
export type DalleStyle = "vivid" | "natural";
|
export type DalleStyle = "vivid" | "natural";
|
||||||
|
|
||||||
export type ModelSize =
|
|
||||||
| "1024x1024"
|
|
||||||
| "1792x1024"
|
|
||||||
| "1024x1792"
|
|
||||||
| "768x1344"
|
|
||||||
| "864x1152"
|
|
||||||
| "1344x768"
|
|
||||||
| "1152x864"
|
|
||||||
| "1440x720"
|
|
||||||
| "720x1440";
|
|
||||||
|
|||||||
37
app/utils.ts
37
app/utils.ts
@@ -7,7 +7,7 @@ import { ServiceProvider } from "./constant";
|
|||||||
import { fetch as tauriStreamFetch } from "./utils/stream";
|
import { fetch as tauriStreamFetch } from "./utils/stream";
|
||||||
import { VISION_MODEL_REGEXES, EXCLUDE_VISION_MODEL_REGEXES } from "./constant";
|
import { VISION_MODEL_REGEXES, EXCLUDE_VISION_MODEL_REGEXES } from "./constant";
|
||||||
import { getClientConfig } from "./config/client";
|
import { getClientConfig } from "./config/client";
|
||||||
import { ModelSize } from "./typing";
|
import { getModelProvider } from "./utils/model";
|
||||||
|
|
||||||
export function trimTopic(topic: string) {
|
export function trimTopic(topic: string) {
|
||||||
// Fix an issue where double quotes still show in the Indonesian language
|
// Fix an issue where double quotes still show in the Indonesian language
|
||||||
@@ -254,12 +254,15 @@ export function getMessageImages(message: RequestMessage): string[] {
|
|||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isVisionModel(model: string) {
|
export function isVisionModel(model: string, customVisionModels: string) {
|
||||||
const clientConfig = getClientConfig();
|
const clientConfig = getClientConfig();
|
||||||
const envVisionModels = clientConfig?.visionModels
|
const allVisionModelsList = [customVisionModels, clientConfig?.visionModels]
|
||||||
?.split(",")
|
?.join(",")
|
||||||
.map((m) => m.trim());
|
.split(",")
|
||||||
if (envVisionModels?.includes(model)) {
|
.map((m) => m.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((m) => getModelProvider(m)[0]);
|
||||||
|
if (allVisionModelsList?.includes(model)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
@@ -272,28 +275,6 @@ export function isDalle3(model: string) {
|
|||||||
return "dall-e-3" === model;
|
return "dall-e-3" === model;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getModelSizes(model: string): ModelSize[] {
|
|
||||||
if (isDalle3(model)) {
|
|
||||||
return ["1024x1024", "1792x1024", "1024x1792"];
|
|
||||||
}
|
|
||||||
if (model.toLowerCase().includes("cogview")) {
|
|
||||||
return [
|
|
||||||
"1024x1024",
|
|
||||||
"768x1344",
|
|
||||||
"864x1152",
|
|
||||||
"1344x768",
|
|
||||||
"1152x864",
|
|
||||||
"1440x720",
|
|
||||||
"720x1440",
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function supportsCustomSize(model: string): boolean {
|
|
||||||
return getModelSizes(model).length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function showPlugins(provider: ServiceProvider, model: string) {
|
export function showPlugins(provider: ServiceProvider, model: string) {
|
||||||
if (
|
if (
|
||||||
provider == ServiceProvider.OpenAI ||
|
provider == ServiceProvider.OpenAI ||
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { isVisionModel } from "../app/utils";
|
|||||||
|
|
||||||
describe("isVisionModel", () => {
|
describe("isVisionModel", () => {
|
||||||
const originalEnv = process.env;
|
const originalEnv = process.env;
|
||||||
|
const customVisionModels = "custom-vlm,another-vlm";
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
@@ -27,12 +28,12 @@ describe("isVisionModel", () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
visionModels.forEach((model) => {
|
visionModels.forEach((model) => {
|
||||||
expect(isVisionModel(model)).toBe(true);
|
expect(isVisionModel(model, customVisionModels)).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should exclude specific models", () => {
|
test("should exclude specific models", () => {
|
||||||
expect(isVisionModel("claude-3-5-haiku-20241022")).toBe(false);
|
expect(isVisionModel("claude-3-5-haiku-20241022", customVisionModels)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should not identify non-vision models", () => {
|
test("should not identify non-vision models", () => {
|
||||||
@@ -44,24 +45,26 @@ describe("isVisionModel", () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
nonVisionModels.forEach((model) => {
|
nonVisionModels.forEach((model) => {
|
||||||
expect(isVisionModel(model)).toBe(false);
|
expect(isVisionModel(model, customVisionModels)).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should identify models from VISION_MODELS env var", () => {
|
test("should identify models from VISION_MODELS env var", () => {
|
||||||
process.env.VISION_MODELS = "custom-vision-model,another-vision-model";
|
process.env.VISION_MODELS = "custom-vision-model,another-vision-model";
|
||||||
|
|
||||||
expect(isVisionModel("custom-vision-model")).toBe(true);
|
expect(isVisionModel("custom-vision-model", customVisionModels)).toBe(true);
|
||||||
expect(isVisionModel("another-vision-model")).toBe(true);
|
expect(isVisionModel("another-vision-model", customVisionModels)).toBe(true);
|
||||||
expect(isVisionModel("unrelated-model")).toBe(false);
|
expect(isVisionModel("custom-vlm", customVisionModels)).toBe(true);
|
||||||
|
expect(isVisionModel("another-vlm", customVisionModels)).toBe(true);
|
||||||
|
expect(isVisionModel("unrelated-model", customVisionModels)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should handle empty or missing VISION_MODELS", () => {
|
test("should handle empty or missing VISION_MODELS", () => {
|
||||||
process.env.VISION_MODELS = "";
|
process.env.VISION_MODELS = "";
|
||||||
expect(isVisionModel("unrelated-model")).toBe(false);
|
expect(isVisionModel("unrelated-model", customVisionModels)).toBe(false);
|
||||||
|
|
||||||
delete process.env.VISION_MODELS;
|
delete process.env.VISION_MODELS;
|
||||||
expect(isVisionModel("unrelated-model")).toBe(false);
|
expect(isVisionModel("unrelated-model", customVisionModels)).toBe(false);
|
||||||
expect(isVisionModel("gpt-4-vision")).toBe(true);
|
expect(isVisionModel("gpt-4-vision", customVisionModels)).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user