Merge branch 'main' of https://github.com/ChatGPTNextWeb/NextChat into feature-dsmodels-20250228

This commit is contained in:
wangjianhua
2025-09-19 15:14:25 +08:00
42 changed files with 1728 additions and 94 deletions

128
app/api/302ai.ts Normal file
View File

@@ -0,0 +1,128 @@
import { getServerSideConfig } from "@/app/config/server";
import {
AI302_BASE_URL,
ApiPath,
ModelProvider,
ServiceProvider,
} from "@/app/constant";
import { prettyObject } from "@/app/utils/format";
import { NextRequest, NextResponse } from "next/server";
import { auth } from "@/app/api/auth";
import { isModelNotavailableInServer } from "@/app/utils/model";
const serverConfig = getServerSideConfig();
export async function handle(
req: NextRequest,
{ params }: { params: { path: string[] } },
) {
console.log("[302.AI Route] params ", params);
if (req.method === "OPTIONS") {
return NextResponse.json({ body: "OK" }, { status: 200 });
}
const authResult = auth(req, ModelProvider["302.AI"]);
if (authResult.error) {
return NextResponse.json(authResult, {
status: 401,
});
}
try {
const response = await request(req);
return response;
} catch (e) {
console.error("[302.AI] ", e);
return NextResponse.json(prettyObject(e));
}
}
async function request(req: NextRequest) {
const controller = new AbortController();
// alibaba use base url or just remove the path
let path = `${req.nextUrl.pathname}`.replaceAll(ApiPath["302.AI"], "");
let baseUrl = serverConfig.ai302Url || AI302_BASE_URL;
if (!baseUrl.startsWith("http")) {
baseUrl = `https://${baseUrl}`;
}
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.slice(0, -1);
}
console.log("[Proxy] ", path);
console.log("[Base Url]", baseUrl);
const timeoutId = setTimeout(
() => {
controller.abort();
},
10 * 60 * 1000,
);
const fetchUrl = `${baseUrl}${path}`;
const fetchOptions: RequestInit = {
headers: {
"Content-Type": "application/json",
Authorization: req.headers.get("Authorization") ?? "",
},
method: req.method,
body: req.body,
redirect: "manual",
// @ts-ignore
duplex: "half",
signal: controller.signal,
};
// #1815 try to refuse some request to some models
if (serverConfig.customModels && req.body) {
try {
const clonedBody = await req.text();
fetchOptions.body = clonedBody;
const jsonBody = JSON.parse(clonedBody) as { model?: string };
// not undefined and is false
if (
isModelNotavailableInServer(
serverConfig.customModels,
jsonBody?.model as string,
ServiceProvider["302.AI"] as string,
)
) {
return NextResponse.json(
{
error: true,
message: `you are not allowed to use ${jsonBody?.model} model`,
},
{
status: 403,
},
);
}
} catch (e) {
console.error(`[302.AI] filter`, e);
}
}
try {
const res = await fetch(fetchUrl, fetchOptions);
// to prevent browser prompt for credentials
const newHeaders = new Headers(res.headers);
newHeaders.delete("www-authenticate");
// to disable nginx buffering
newHeaders.set("X-Accel-Buffering", "no");
return new Response(res.body, {
status: res.status,
statusText: res.statusText,
headers: newHeaders,
});
} finally {
clearTimeout(timeoutId);
}
}

View File

@@ -16,6 +16,7 @@ import { handle as xaiHandler } from "../../xai";
import { handle as chatglmHandler } from "../../glm";
import { handle as proxyHandler } from "../../proxy";
import { handle as huaweiHandler } from "../../huawei";
import { handle as ai302Handler } from "../../302ai";
async function handle(
req: NextRequest,
@@ -55,6 +56,8 @@ async function handle(
return openaiHandler(req, { params });
case ApiPath.Huawei:
return huaweiHandler(req, { params });
case ApiPath["302.AI"]:
return ai302Handler(req, { params });
default:
return proxyHandler(req, { params });
}

View File

@@ -25,6 +25,7 @@ import { XAIApi } from "./platforms/xai";
import { ChatGLMApi } from "./platforms/glm";
import { SiliconflowApi } from "./platforms/siliconflow";
import { HuaweiApi } from "./platforms/huawei";
import { Ai302Api } from "./platforms/ai302";
export const ROLES = ["system", "user", "assistant"] as const;
export type MessageRole = (typeof ROLES)[number];
@@ -177,6 +178,9 @@ export class ClientApi {
case ModelProvider.Huawei:
this.llm = new HuaweiApi();
break;
case ModelProvider["302.AI"]:
this.llm = new Ai302Api();
break;
default:
this.llm = new ChatGPTApi();
}
@@ -270,6 +274,7 @@ export function getHeaders(ignoreHeaders: boolean = false) {
const isSiliconFlow =
modelConfig.providerName === ServiceProvider.SiliconFlow;
const isHuawei = modelConfig.providerName == ServiceProvider.Huawei;
const isAI302 = modelConfig.providerName === ServiceProvider["302.AI"];
const isEnabledAccessControl = accessStore.enabledAccessControl();
const apiKey = isGoogle
? accessStore.googleApiKey
@@ -297,6 +302,8 @@ export function getHeaders(ignoreHeaders: boolean = false) {
: ""
: isHuawei
? accessStore.huaweiApiKey
: isAI302
? accessStore.ai302ApiKey
: accessStore.openaiApiKey;
return {
isGoogle,
@@ -312,6 +319,7 @@ export function getHeaders(ignoreHeaders: boolean = false) {
isChatGLM,
isSiliconFlow,
isHuawei,
isAI302,
apiKey,
isEnabledAccessControl,
};
@@ -341,6 +349,7 @@ export function getHeaders(ignoreHeaders: boolean = false) {
isChatGLM,
isSiliconFlow,
isHuawei: boolean,
isAI302,
apiKey,
isEnabledAccessControl,
} = getConfig();
@@ -393,6 +402,8 @@ export function getClientApi(provider: ServiceProvider): ClientApi {
return new ClientApi(ModelProvider.SiliconFlow);
case ServiceProvider.Huawei:
return new ClientApi(ModelProvider.Huawei);
case ServiceProvider["302.AI"]:
return new ClientApi(ModelProvider["302.AI"]);
default:
return new ClientApi(ModelProvider.GPT);
}

View File

@@ -0,0 +1,287 @@
"use client";
import {
ApiPath,
AI302_BASE_URL,
DEFAULT_MODELS,
AI302,
} from "@/app/constant";
import {
useAccessStore,
useAppConfig,
useChatStore,
ChatMessageTool,
usePluginStore,
} from "@/app/store";
import { preProcessImageContent, streamWithThink } from "@/app/utils/chat";
import {
ChatOptions,
getHeaders,
LLMApi,
LLMModel,
SpeechOptions,
} from "../api";
import { getClientConfig } from "@/app/config/client";
import {
getMessageTextContent,
getMessageTextContentWithoutThinking,
isVisionModel,
getTimeoutMSByModel,
} from "@/app/utils";
import { RequestPayload } from "./openai";
import { fetch } from "@/app/utils/stream";
export interface Ai302ListModelResponse {
object: string;
data: Array<{
id: string;
object: string;
root: string;
}>;
}
export class Ai302Api implements LLMApi {
private disableListModels = false;
path(path: string): string {
const accessStore = useAccessStore.getState();
let baseUrl = "";
if (accessStore.useCustomConfig) {
baseUrl = accessStore.ai302Url;
}
if (baseUrl.length === 0) {
const isApp = !!getClientConfig()?.isApp;
const apiPath = ApiPath["302.AI"];
baseUrl = isApp ? AI302_BASE_URL : apiPath;
}
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.slice(0, baseUrl.length - 1);
}
if (
!baseUrl.startsWith("http") &&
!baseUrl.startsWith(ApiPath["302.AI"])
) {
baseUrl = "https://" + baseUrl;
}
console.log("[Proxy Endpoint] ", baseUrl, path);
return [baseUrl, path].join("/");
}
extractMessage(res: any) {
return res.choices?.at(0)?.message?.content ?? "";
}
speech(options: SpeechOptions): Promise<ArrayBuffer> {
throw new Error("Method not implemented.");
}
async chat(options: ChatOptions) {
const visionModel = isVisionModel(options.config.model);
const messages: ChatOptions["messages"] = [];
for (const v of options.messages) {
if (v.role === "assistant") {
const content = getMessageTextContentWithoutThinking(v);
messages.push({ role: v.role, content });
} else {
const content = visionModel
? await preProcessImageContent(v.content)
: getMessageTextContent(v);
messages.push({ role: v.role, content });
}
}
const modelConfig = {
...useAppConfig.getState().modelConfig,
...useChatStore.getState().currentSession().mask.modelConfig,
...{
model: options.config.model,
providerName: options.config.providerName,
},
};
const requestPayload: RequestPayload = {
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,
// max_tokens: Math.max(modelConfig.max_tokens, 1024),
// Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore.
};
console.log("[Request] openai payload: ", requestPayload);
const shouldStream = !!options.config.stream;
const controller = new AbortController();
options.onController?.(controller);
try {
const chatPath = this.path(AI302.ChatPath);
const chatPayload = {
method: "POST",
body: JSON.stringify(requestPayload),
signal: controller.signal,
headers: getHeaders(),
};
// console.log(chatPayload);
// Use extended timeout for thinking models as they typically require more processing time
const requestTimeoutId = setTimeout(
() => controller.abort(),
getTimeoutMSByModel(options.config.model),
);
if (shouldStream) {
const [tools, funcs] = usePluginStore
.getState()
.getAsTools(
useChatStore.getState().currentSession().mask?.plugin || [],
);
return streamWithThink(
chatPath,
requestPayload,
getHeaders(),
tools as any,
funcs,
controller,
// parseSSE
(text: string, runTools: ChatMessageTool[]) => {
// console.log("parseSSE", text, runTools);
const json = JSON.parse(text);
const choices = json.choices as Array<{
delta: {
content: string | null;
tool_calls: ChatMessageTool[];
reasoning_content: string | null;
};
}>;
const tool_calls = choices[0]?.delta?.tool_calls;
if (tool_calls?.length > 0) {
const index = tool_calls[0]?.index;
const id = tool_calls[0]?.id;
const args = tool_calls[0]?.function?.arguments;
if (id) {
runTools.push({
id,
type: tool_calls[0]?.type,
function: {
name: tool_calls[0]?.function?.name as string,
arguments: args,
},
});
} else {
// @ts-ignore
runTools[index]["function"]["arguments"] += args;
}
}
const reasoning = choices[0]?.delta?.reasoning_content;
const content = choices[0]?.delta?.content;
// Skip if both content and reasoning_content are empty or null
if (
(!reasoning || reasoning.length === 0) &&
(!content || content.length === 0)
) {
return {
isThinking: false,
content: "",
};
}
if (reasoning && reasoning.length > 0) {
return {
isThinking: true,
content: reasoning,
};
} else if (content && content.length > 0) {
return {
isThinking: false,
content: content,
};
}
return {
isThinking: false,
content: "",
};
},
// processToolMessage, include tool_calls message and tool call results
(
requestPayload: RequestPayload,
toolCallMessage: any,
toolCallResult: any[],
) => {
// @ts-ignore
requestPayload?.messages?.splice(
// @ts-ignore
requestPayload?.messages?.length,
0,
toolCallMessage,
...toolCallResult,
);
},
options,
);
} else {
const res = await fetch(chatPath, chatPayload);
clearTimeout(requestTimeoutId);
const resJson = await res.json();
const message = this.extractMessage(resJson);
options.onFinish(message, res);
}
} catch (e) {
console.log("[Request] failed to make a chat request", e);
options.onError?.(e as Error);
}
}
async usage() {
return {
used: 0,
total: 0,
};
}
async models(): Promise<LLMModel[]> {
if (this.disableListModels) {
return DEFAULT_MODELS.slice();
}
const res = await fetch(this.path(AI302.ListModelPath), {
method: "GET",
headers: {
...getHeaders(),
},
});
const resJson = (await res.json()) as Ai302ListModelResponse;
const chatModels = resJson.data;
console.log("[Models]", chatModels);
if (!chatModels) {
return [];
}
let seq = 1000; //同 Constant.ts 中的排序保持一致
return chatModels.map((m) => ({
name: m.id,
available: true,
sorted: seq++,
provider: {
id: "ai302",
providerName: "302.AI",
providerType: "ai302",
sorted: 15,
},
}));
}
}

View File

@@ -224,7 +224,7 @@ export class ClaudeApi implements LLMApi {
let chunkJson:
| undefined
| {
type: "content_block_delta" | "content_block_stop";
type: "content_block_delta" | "content_block_stop" | "message_delta" | "message_stop";
content_block?: {
type: "tool_use";
id: string;
@@ -234,11 +234,20 @@ export class ClaudeApi implements LLMApi {
type: "text_delta" | "input_json_delta";
text?: string;
partial_json?: string;
stop_reason?: string;
};
index: number;
};
chunkJson = JSON.parse(text);
// Handle refusal stop reason in message_delta
if (chunkJson?.delta?.stop_reason === "refusal") {
// Return a message to display to the user
const refusalMessage = "\n\n[Assistant refused to respond. Please modify your request and try again.]";
options.onError?.(new Error("Content policy violation: " + refusalMessage));
return refusalMessage;
}
if (chunkJson?.content_block?.type == "tool_use") {
index += 1;
const id = chunkJson?.content_block.id;

View File

@@ -56,7 +56,7 @@ export interface OpenAIListModelResponse {
export interface RequestPayload {
messages: {
role: "system" | "user" | "assistant";
role: "developer" | "system" | "user" | "assistant";
content: string | MultimodalContent[];
}[];
stream?: boolean;
@@ -198,7 +198,9 @@ export class ChatGPTApi implements LLMApi {
const isDalle3 = _isDalle3(options.config.model);
const isO1OrO3 =
options.config.model.startsWith("o1") ||
options.config.model.startsWith("o3");
options.config.model.startsWith("o3") ||
options.config.model.startsWith("o4-mini");
const isGpt5 = options.config.model.startsWith("gpt-5");
if (isDalle3) {
const prompt = getMessageTextContent(
options.messages.slice(-1)?.pop() as any,
@@ -229,7 +231,7 @@ export class ChatGPTApi implements LLMApi {
messages,
stream: options.config.stream,
model: modelConfig.model,
temperature: !isO1OrO3 ? modelConfig.temperature : 1,
temperature: (!isO1OrO3 && !isGpt5) ? modelConfig.temperature : 1,
presence_penalty: !isO1OrO3 ? modelConfig.presence_penalty : 0,
frequency_penalty: !isO1OrO3 ? modelConfig.frequency_penalty : 0,
top_p: !isO1OrO3 ? modelConfig.top_p : 1,
@@ -237,13 +239,28 @@ export class ChatGPTApi implements LLMApi {
// Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore.
};
// O1 使用 max_completion_tokens 控制token数 (https://platform.openai.com/docs/guides/reasoning#controlling-costs)
if (isO1OrO3) {
if (isGpt5) {
// Remove max_tokens if present
delete requestPayload.max_tokens;
// Add max_completion_tokens (or max_completion_tokens if that's what you meant)
requestPayload["max_completion_tokens"] = modelConfig.max_tokens;
} else if (isO1OrO3) {
// by default the o1/o3 models will not attempt to produce output that includes markdown formatting
// manually add "Formatting re-enabled" developer message to encourage markdown inclusion in model responses
// (https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/reasoning?tabs=python-secure#markdown-output)
requestPayload["messages"].unshift({
role: "developer",
content: "Formatting re-enabled",
});
// o1/o3 uses max_completion_tokens to control the number of tokens (https://platform.openai.com/docs/guides/reasoning#controlling-costs)
requestPayload["max_completion_tokens"] = modelConfig.max_tokens;
}
// add max_tokens to vision model
if (visionModel) {
if (visionModel && !isO1OrO3 && ! isGpt5) {
requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000);
}
}

View File

@@ -29,11 +29,11 @@ type HTMLPreviewProps = {
onLoad?: (title?: string) => void;
};
export type HTMLPreviewHander = {
export type HTMLPreviewHandler = {
reload: () => void;
};
export const HTMLPreview = forwardRef<HTMLPreviewHander, HTMLPreviewProps>(
export const HTMLPreview = forwardRef<HTMLPreviewHandler, HTMLPreviewProps>(
function HTMLPreview(props, ref) {
const iframeRef = useRef<HTMLIFrameElement>(null);
const [frameId, setFrameId] = useState<string>(nanoid());
@@ -207,7 +207,7 @@ export function Artifacts() {
const [code, setCode] = useState("");
const [loading, setLoading] = useState(true);
const [fileName, setFileName] = useState("");
const previewRef = useRef<HTMLPreviewHander>(null);
const previewRef = useRef<HTMLPreviewHandler>(null);
useEffect(() => {
if (id) {

View File

@@ -17,7 +17,7 @@ import { showImageModal, FullScreen } from "./ui-lib";
import {
ArtifactsShareButton,
HTMLPreview,
HTMLPreviewHander,
HTMLPreviewHandler,
} from "./artifacts";
import { useChatStore } from "../store";
import { IconButton } from "./button";
@@ -73,7 +73,7 @@ export function Mermaid(props: { code: string }) {
export function PreCode(props: { children: any }) {
const ref = useRef<HTMLPreElement>(null);
const previewRef = useRef<HTMLPreviewHander>(null);
const previewRef = useRef<HTMLPreviewHandler>(null);
const [mermaidCode, setMermaidCode] = useState("");
const [htmlCode, setHtmlCode] = useState("");
const { height } = useWindowSize();

View File

@@ -75,6 +75,7 @@ import {
ChatGLM,
DeepSeek,
SiliconFlow,
AI302,
Huawei,
} from "../constant";
import { Prompt, SearchService, usePromptStore } from "../store/prompt";
@@ -1458,6 +1459,46 @@ export function Settings() {
</ListItem>
</>
);
const ai302ConfigComponent = accessStore.provider === ServiceProvider["302.AI"] && (
<>
<ListItem
title={Locale.Settings.Access.AI302.Endpoint.Title}
subTitle={
Locale.Settings.Access.AI302.Endpoint.SubTitle +
AI302.ExampleEndpoint
}
>
<input
aria-label={Locale.Settings.Access.AI302.Endpoint.Title}
type="text"
value={accessStore.ai302Url}
placeholder={AI302.ExampleEndpoint}
onChange={(e) =>
accessStore.update(
(access) => (access.ai302Url = e.currentTarget.value),
)
}
></input>
</ListItem>
<ListItem
title={Locale.Settings.Access.AI302.ApiKey.Title}
subTitle={Locale.Settings.Access.AI302.ApiKey.SubTitle}
>
<PasswordInput
aria-label={Locale.Settings.Access.AI302.ApiKey.Title}
value={accessStore.ai302ApiKey}
type="text"
placeholder={Locale.Settings.Access.AI302.ApiKey.Placeholder}
onChange={(e) => {
accessStore.update(
(access) => (access.ai302ApiKey = e.currentTarget.value),
);
}}
/>
</ListItem>
</>
);
const huaweiConfigComponent = accessStore.provider ===
ServiceProvider.Huawei && (
<>
@@ -1864,6 +1905,7 @@ export function Settings() {
{chatglmConfigComponent}
{siliconflowConfigComponent}
{huaweiConfigComponent}
{ai302ConfigComponent}
</>
)}
</>

View File

@@ -92,6 +92,10 @@ declare global {
HUAWEI_URL?: string;
HUAWEI_API_KEY?: string;
// 302.AI only
AI302_URL?: string;
AI302_API_KEY?: string;
// custom template for preprocessing user input
DEFAULT_INPUT_TEMPLATE?: string;
@@ -167,6 +171,7 @@ export const getServerSideConfig = () => {
const isXAI = !!process.env.XAI_API_KEY;
const isChatGLM = !!process.env.CHATGLM_API_KEY;
const isSiliconFlow = !!process.env.SILICONFLOW_API_KEY;
const isAI302 = !!process.env.AI302_API_KEY;
const isHuawei = !!process.env.HUAWEI_API_KEY;
// const apiKeyEnvVar = process.env.OPENAI_API_KEY ?? "";
// const apiKeys = apiKeyEnvVar.split(",").map((v) => v.trim());
@@ -255,6 +260,10 @@ export const getServerSideConfig = () => {
siliconFlowUrl: process.env.SILICONFLOW_URL,
siliconFlowApiKey: getApiKey(process.env.SILICONFLOW_API_KEY),
isAI302,
ai302Url: process.env.AI302_URL,
ai302ApiKey: getApiKey(process.env.AI302_API_KEY),
gtmId: process.env.GTM_ID,
gaId: process.env.GA_ID || DEFAULT_GA_ID,

View File

@@ -25,7 +25,7 @@ export const ALIBABA_BASE_URL = "https://dashscope.aliyuncs.com/api/";
export const TENCENT_BASE_URL = "https://hunyuan.tencentcloudapi.com";
export const MOONSHOT_BASE_URL = "https://api.moonshot.cn";
export const MOONSHOT_BASE_URL = "https://api.moonshot.ai";
export const IFLYTEK_BASE_URL = "https://spark-api-open.xf-yun.com";
export const DEEPSEEK_BASE_URL = "https://api.deepseek.com";
@@ -36,6 +36,8 @@ export const CHATGLM_BASE_URL = "https://open.bigmodel.cn";
export const SILICONFLOW_BASE_URL = "https://api.siliconflow.cn";
export const AI302_BASE_URL = "https://api.302.ai";
export const HUAWEI_BASE_URL =
"https://maas-cn-southwest-2.modelarts-maas.com/v1/infers";
@@ -76,6 +78,7 @@ export enum ApiPath {
DeepSeek = "/api/deepseek",
SiliconFlow = "/api/siliconflow",
Huawei = "/api/huawei",
"302.AI" = "/api/302ai",
}
export enum SlotID {
@@ -135,6 +138,7 @@ export enum ServiceProvider {
DeepSeek = "DeepSeek",
SiliconFlow = "SiliconFlow",
Huawei = "Huawei",
"302.AI" = "302.AI",
}
// Google API safety settings, see https://ai.google.dev/gemini-api/docs/safety-settings
@@ -162,6 +166,7 @@ export enum ModelProvider {
DeepSeek = "DeepSeek",
SiliconFlow = "SiliconFlow",
Huawei = "Huawei",
"302.AI" = "302.AI",
}
export const Stability = {
@@ -277,6 +282,13 @@ export const SiliconFlow = {
ListModelPath: "v1/models?&sub_type=chat",
};
export const AI302 = {
ExampleEndpoint: AI302_BASE_URL,
ChatPath: "v1/chat/completions",
EmbeddingsPath: "jina/v1/embeddings",
ListModelPath: "v1/models?llm=1",
};
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
// export const DEFAULT_SYSTEM_TEMPLATE = `
// You are ChatGPT, a large language model trained by {{ServiceProvider}}.
@@ -428,6 +440,14 @@ export const KnowledgeCutOffDate: Record<string, string> = {
"gpt-4-turbo": "2023-12",
"gpt-4-turbo-2024-04-09": "2023-12",
"gpt-4-turbo-preview": "2023-12",
"gpt-4.1": "2024-06",
"gpt-4.1-2025-04-14": "2024-06",
"gpt-4.1-mini": "2024-06",
"gpt-4.1-mini-2025-04-14": "2024-06",
"gpt-4.1-nano": "2024-06",
"gpt-4.1-nano-2025-04-14": "2024-06",
"gpt-4.5-preview": "2023-10",
"gpt-4.5-preview-2025-02-27": "2023-10",
"gpt-4o": "2023-10",
"gpt-4o-2024-05-13": "2023-10",
"gpt-4o-2024-08-06": "2023-10",
@@ -469,17 +489,22 @@ export const DEFAULT_TTS_VOICES = [
export const VISION_MODEL_REGEXES = [
/vision/,
/gpt-4o/,
/claude-3/,
/gpt-4\.1/,
/claude.*[34]/,
/gemini-1\.5/,
/gemini-exp/,
/gemini-2\.0/,
/gemini-2\.[05]/,
/learnlm/,
/qwen-vl/,
/qwen2-vl/,
/gpt-4-turbo(?!.*preview)/, // Matches "gpt-4-turbo" but not "gpt-4-turbo-preview"
/^dall-e-3$/, // Matches exactly "dall-e-3"
/gpt-4-turbo(?!.*preview)/,
/^dall-e-3$/,
/glm-4v/,
/vl/i,
/o3/,
/o4-mini/,
/grok-4/i,
/gpt-5/
];
export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/];
@@ -496,6 +521,19 @@ const openaiModels = [
"gpt-4-32k-0613",
"gpt-4-turbo",
"gpt-4-turbo-preview",
"gpt-4.1",
"gpt-4.1-2025-04-14",
"gpt-4.1-mini",
"gpt-4.1-mini-2025-04-14",
"gpt-4.1-nano",
"gpt-4.1-nano-2025-04-14",
"gpt-4.5-preview",
"gpt-4.5-preview-2025-02-27",
"gpt-5-chat",
"gpt-5-mini",
"gpt-5-nano",
"gpt-5",
"gpt-5-chat-2025-01-01-preview",
"gpt-4o",
"gpt-4o-2024-05-13",
"gpt-4o-2024-08-06",
@@ -510,23 +548,20 @@ const openaiModels = [
"o1-mini",
"o1-preview",
"o3-mini",
"o3",
"o4-mini",
];
const googleModels = [
"gemini-1.0-pro", // Deprecated on 2/15/2025
"gemini-1.5-pro-latest",
"gemini-1.5-pro",
"gemini-1.5-pro-002",
"gemini-1.5-pro-exp-0827",
"gemini-1.5-flash-latest",
"gemini-1.5-flash-8b-latest",
"gemini-1.5-flash",
"gemini-1.5-flash-8b",
"gemini-1.5-flash-002",
"gemini-1.5-flash-exp-0827",
"learnlm-1.5-pro-experimental",
"gemini-exp-1114",
"gemini-exp-1121",
"gemini-exp-1206",
"gemini-2.0-flash",
"gemini-2.0-flash-exp",
@@ -536,6 +571,8 @@ const googleModels = [
"gemini-2.0-flash-thinking-exp-01-21",
"gemini-2.0-pro-exp",
"gemini-2.0-pro-exp-02-05",
"gemini-2.5-pro-preview-06-05",
"gemini-2.5-pro"
];
const anthropicModels = [
@@ -553,6 +590,8 @@ const anthropicModels = [
"claude-3-5-sonnet-latest",
"claude-3-7-sonnet-20250219",
"claude-3-7-sonnet-latest",
"claude-sonnet-4-20250514",
"claude-opus-4-20250514",
];
const baiduModels = [
@@ -606,7 +645,18 @@ const tencentModels = [
"hunyuan-vision",
];
const moonshotModes = ["moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k"];
const moonshotModels = [
"moonshot-v1-auto",
"moonshot-v1-8k",
"moonshot-v1-32k",
"moonshot-v1-128k",
"moonshot-v1-8k-vision-preview",
"moonshot-v1-32k-vision-preview",
"moonshot-v1-128k-vision-preview",
"kimi-thinking-preview",
"kimi-k2-0711-preview",
"kimi-latest",
];
const iflytekModels = [
"general",
@@ -627,6 +677,18 @@ const xAIModes = [
"grok-2-vision-1212",
"grok-2-vision",
"grok-2-vision-latest",
"grok-3-mini-fast-beta",
"grok-3-mini-fast",
"grok-3-mini-fast-latest",
"grok-3-mini-beta",
"grok-3-mini",
"grok-3-mini-latest",
"grok-3-fast-beta",
"grok-3-fast",
"grok-3-fast-latest",
"grok-3-beta",
"grok-3",
"grok-3-latest",
];
const chatglmModels = [
@@ -666,6 +728,31 @@ const siliconflowModels = [
"Pro/deepseek-ai/DeepSeek-V3",
];
const ai302Models = [
"deepseek-chat",
"gpt-4o",
"chatgpt-4o-latest",
"llama3.3-70b",
"deepseek-reasoner",
"gemini-2.0-flash",
"claude-3-7-sonnet-20250219",
"claude-3-7-sonnet-latest",
"grok-3-beta",
"grok-3-mini-beta",
"gpt-4.1",
"gpt-4.1-mini",
"o3",
"o4-mini",
"qwen3-235b-a22b",
"qwen3-32b",
"gemini-2.5-pro-preview-05-06",
"llama-4-maverick",
"gemini-2.5-flash",
"claude-sonnet-4-20250514",
"claude-opus-4-20250514",
"gemini-2.5-pro",
];
const huaweiModels = ["DeepSeek-R1", "DeepSeek-V3"];
let seq = 1000; // 内置的模型序号生成器从1000开始
@@ -758,7 +845,7 @@ export const DEFAULT_MODELS = [
sorted: 8,
},
})),
...moonshotModes.map((name) => ({
...moonshotModels.map((name) => ({
name,
available: true,
sorted: seq++,
@@ -835,6 +922,17 @@ export const DEFAULT_MODELS = [
sorted: 15,
},
})),
...ai302Models.map((name) => ({
name,
available: true,
sorted: seq++,
provider: {
id: "ai302",
providerName: "302.AI",
providerType: "ai302",
sorted: 15,
},
})),
] as const;
export const CHAT_PAGE_SIZE = 15;

View File

@@ -416,6 +416,17 @@ const ar: PartialLocaleType = {
SubTitle: "مثال:",
},
},
AI302: {
ApiKey: {
Title: "مفتاح 302.AI API",
SubTitle: "استخدم مفتاح 302.AI API مخصص",
Placeholder: "مفتاح 302.AI API",
},
Endpoint: {
Title: "عنوان الواجهة",
SubTitle: "مثال:",
},
},
CustomModel: {
Title: "اسم النموذج المخصص",
SubTitle: "أضف خيارات نموذج مخصص، مفصولة بفواصل إنجليزية",

View File

@@ -423,6 +423,17 @@ const bn: PartialLocaleType = {
SubTitle: "উদাহরণ:",
},
},
AI302: {
ApiKey: {
Title: "ইন্টারফেস কী",
SubTitle: "স্বনির্ধারিত 302.AI API কী ব্যবহার করুন",
Placeholder: "302.AI API কী",
},
Endpoint: {
Title: "ইন্টারফেস ঠিকানা",
SubTitle: "উদাহরণ:",
},
},
CustomModel: {
Title: "স্বনির্ধারিত মডেল নাম",
SubTitle:

View File

@@ -538,6 +538,17 @@ const cn = {
Title: "自定义模型名",
SubTitle: "增加自定义模型可选项,使用英文逗号隔开",
},
AI302: {
ApiKey: {
Title: "接口密钥",
SubTitle: "使用自定义302.AI API Key",
Placeholder: "302.AI API Key",
},
Endpoint: {
Title: "接口地址",
SubTitle: "样例:",
},
},
Huawei: {
ApiKey: {
Title: "API Key",

View File

@@ -423,6 +423,17 @@ const cs: PartialLocaleType = {
SubTitle: "Příklad:",
},
},
AI302: {
ApiKey: {
Title: "Rozhraní klíč",
SubTitle: "Použijte vlastní 302.AI API Key",
Placeholder: "302.AI API Key",
},
Endpoint: {
Title: "Adresa rozhraní",
SubTitle: "Příklad:",
},
},
CustomModel: {
Title: "Vlastní názvy modelů",
SubTitle: "Přidejte možnosti vlastních modelů, oddělené čárkami",

View File

@@ -533,6 +533,17 @@ const da: PartialLocaleType = {
SubTitle: "Vælg et niveau for indholdskontrol",
},
},
AI302: {
ApiKey: {
Title: "302.AI API Key",
SubTitle: "Brug en custom 302.AI API Key",
Placeholder: "302.AI API Key",
},
Endpoint: {
Title: "Endpoint-adresse",
SubTitle: "Eksempel: ",
},
},
},
Model: "Model",
CompressModel: {

View File

@@ -434,6 +434,17 @@ const de: PartialLocaleType = {
SubTitle: "Beispiel:",
},
},
AI302: {
ApiKey: {
Title: "Schnittstellenschlüssel",
SubTitle: "Verwenden Sie einen benutzerdefinierten 302.AI API-Schlüssel",
Placeholder: "302.AI API-Schlüssel",
},
Endpoint: {
Title: "Endpunktadresse",
SubTitle: "Beispiel:",
},
},
CustomModel: {
Title: "Benutzerdefinierter Modellname",
SubTitle:

View File

@@ -559,6 +559,17 @@ const en: LocaleType = {
SubTitle: "Select a safety filtering level",
},
},
AI302: {
ApiKey: {
Title: "302.AI API Key",
SubTitle: "Use a custom 302.AI API Key",
Placeholder: "302.AI API Key",
},
Endpoint: {
Title: "Endpoint Address",
SubTitle: "Example: ",
},
},
},
Model: "Model",

View File

@@ -436,6 +436,17 @@ const es: PartialLocaleType = {
SubTitle: "Ejemplo:",
},
},
AI302: {
ApiKey: {
Title: "Clave de interfaz",
SubTitle: "Usa una clave API de 302.AI personalizada",
Placeholder: "Clave API de 302.AI",
},
Endpoint: {
Title: "Dirección del endpoint",
SubTitle: "Ejemplo:",
},
},
CustomModel: {
Title: "Nombre del modelo personalizado",
SubTitle:

View File

@@ -435,6 +435,17 @@ const fr: PartialLocaleType = {
SubTitle: "Exemple :",
},
},
AI302: {
ApiKey: {
Title: "Clé d'interface",
SubTitle: "Utiliser une clé API 302.AI personnalisée",
Placeholder: "Clé API 302.AI",
},
Endpoint: {
Title: "Adresse de l'endpoint",
SubTitle: "Exemple :",
},
},
CustomModel: {
Title: "Nom du modèle personnalisé",
SubTitle:

View File

@@ -424,6 +424,17 @@ const id: PartialLocaleType = {
SubTitle: "Contoh:",
},
},
AI302: {
ApiKey: {
Title: "Kunci Antarmuka",
SubTitle: "Gunakan 302.AI API Key kustom",
Placeholder: "302.AI API Key",
},
Endpoint: {
Title: "Alamat Antarmuka",
SubTitle: "Contoh:",
},
},
CustomModel: {
Title: "Nama Model Kustom",
SubTitle: "Tambahkan opsi model kustom, pisahkan dengan koma",

View File

@@ -436,6 +436,17 @@ const it: PartialLocaleType = {
SubTitle: "Esempio:",
},
},
AI302: {
ApiKey: {
Title: "Chiave dell'interfaccia",
SubTitle: "Utilizza una chiave API 302.AI personalizzata",
Placeholder: "Chiave API 302.AI",
},
Endpoint: {
Title: "Indirizzo dell'interfaccia",
SubTitle: "Esempio:",
},
},
CustomModel: {
Title: "Nome del modello personalizzato",
SubTitle:

View File

@@ -420,6 +420,17 @@ const jp: PartialLocaleType = {
SubTitle: "例:",
},
},
AI302: {
ApiKey: {
Title: "APIキー",
SubTitle: "カスタム302.AI APIキーを使用",
Placeholder: "302.AI APIキー",
},
Endpoint: {
Title: "エンドポイント",
SubTitle: "例:",
},
},
CustomModel: {
Title: "カスタムモデル名",
SubTitle: "カスタムモデルの選択肢を追加、英語のカンマで区切る",

View File

@@ -9,10 +9,10 @@ const ko: PartialLocaleType = {
Error: {
Unauthorized: isApp
? `😆 대화 중 문제가 발생했습니다, 걱정하지 마세요:
\\ 1제로 구성으로 시작하고 싶다면, [여기를 클릭하여 즉시 대화를 시작하세요 🚀](${SAAS_CHAT_UTM_URL})
\\ 1세팅 없이 시작하고 싶다면, [여기를 클릭하여 즉시 대화를 시작하세요 🚀](${SAAS_CHAT_UTM_URL})
\\ 2⃣ 자신의 OpenAI 리소스를 사용하고 싶다면, [여기를 클릭하여](/#/settings) 설정을 수정하세요 ⚙️`
: `😆 대화 중 문제가 발생했습니다, 걱정하지 마세요:
\ 1제로 구성으로 시작하고 싶다면, [여기를 클릭하여 즉시 대화를 시작하세요 🚀](${SAAS_CHAT_UTM_URL})
\ 1세팅 없이 시작하고 싶다면, [여기를 클릭하여 즉시 대화를 시작하세요 🚀](${SAAS_CHAT_UTM_URL})
\ 2⃣ 개인 배포 버전을 사용하고 있다면, [여기를 클릭하여](/#/auth) 접근 키를 입력하세요 🔑
\ 3⃣ 자신의 OpenAI 리소스를 사용하고 싶다면, [여기를 클릭하여](/#/settings) 설정을 수정하세요 ⚙️
`,
@@ -27,7 +27,7 @@ const ko: PartialLocaleType = {
Return: "돌아가기",
SaasTips: "설정이 너무 복잡합니다. 즉시 사용하고 싶습니다.",
TopTips:
"🥳 NextChat AI 출시 기념 할인, 지금 OpenAI o1, GPT-4o, Claude-3.5 및 최신 대형 모델을 해제하세요",
"🥳 NextChat AI 출시 기념 할인: 지금 OpenAI o1, GPT-4o, Claude-3.5 및 최신 대형 모델을 사용해보세요!",
},
ChatItem: {
ChatItemCount: (count: number) => `${count} 개의 대화`,
@@ -53,8 +53,11 @@ const ko: PartialLocaleType = {
PinToastAction: "보기",
Delete: "삭제",
Edit: "편집",
FullScreen: "전체 화면",
RefreshTitle: "제목 새로고침",
RefreshToast: "제목 새로고침 요청이 전송되었습니다",
Speech: "재생",
StopSpeech: "정지",
},
Commands: {
new: "새 채팅",
@@ -62,6 +65,7 @@ const ko: PartialLocaleType = {
next: "다음 채팅",
prev: "이전 채팅",
clear: "컨텍스트 지우기",
fork: "채팅 복사",
del: "채팅 삭제",
},
InputActions: {
@@ -88,11 +92,22 @@ const ko: PartialLocaleType = {
return inputHints + "/ 자동 완성,: 명령어 입력";
},
Send: "전송",
StartSpeak: "재생 시작",
StopSpeak: "재생 정지",
Config: {
Reset: "기억 지우기",
SaveAs: "마스크로 저장",
},
IsContext: "프롬프트 설정",
ShortcutKey: {
Title: "키보드 단축키",
newChat: "새 채팅 열기",
focusInput: "입력 필드 포커스",
copyLastMessage: "마지막 답변 복사",
copyLastCode: "마지막 코드 블록 복사",
showShortcutKey: "단축키 보기",
clearContext: "컨텍스트 지우기",
},
},
Export: {
Title: "채팅 기록 공유",
@@ -114,9 +129,13 @@ const ko: PartialLocaleType = {
Preview: "미리보기",
},
Image: {
Toast: "스크린샷 생성 중",
Toast: "스크린샷 생성 중...",
Modal: "길게 누르거나 오른쪽 클릭하여 이미지를 저장하십시오.",
},
Artifacts: {
Title: "공유 아티팩트",
Error: "공유 오류",
},
},
Select: {
Search: "메시지 검색",
@@ -141,7 +160,7 @@ const ko: PartialLocaleType = {
Settings: {
Title: "설정",
SubTitle: "모든 설정 옵션",
ShowPassword: "비밀번호 보기",
Danger: {
Reset: {
Title: "모든 설정 초기화",
@@ -187,8 +206,10 @@ const ko: PartialLocaleType = {
IsChecking: "업데이트 확인 중...",
FoundUpdate: (x: string) => `새 버전 발견: ${x}`,
GoToUpdate: "업데이트로 이동",
Success: "업데이트 성공",
Failed: "업데이트 실패",
},
SendKey: "전송",
SendKey: "전송",
Theme: "테마",
TightBorder: "테두리 없는 모드",
SendPreviewBubble: {
@@ -221,7 +242,7 @@ const ko: PartialLocaleType = {
},
ProxyUrl: {
Title: "프록시 주소",
SubTitle: "이 프로젝트에서 제공하는 교차 출처 프록시만 해당",
SubTitle: "이 프로젝트에서 제공하는 CORS 프록시만 해당",
},
WebDav: {
@@ -295,7 +316,7 @@ const ko: PartialLocaleType = {
Title: "NextChat AI 사용하기",
Label: "(가장 비용 효율적인 솔루션)",
SubTitle:
"NextChat에 의해 공식적으로 유지 관리되며, 제로 구성으로 즉시 사용할 수 있으며, OpenAI o1, GPT-4o, Claude-3.5와 같은 최신 대형 모델을 지원합니다",
"NextChat에 의해 공식적으로 유지 관리되며, 설정 없이 즉시 사용할 수 있으며, OpenAI o1, GPT-4o, Claude-3.5와 같은 최신 대형 모델을 지원합니다",
ChatNow: "지금 채팅하기",
},
@@ -395,6 +416,22 @@ const ko: PartialLocaleType = {
SubTitle: "커스터마이즈는 .env에서 설정",
},
},
Tencent: {
ApiKey: {
Title: "Tencent API 키",
SubTitle: "커스텀 Tencent API 키 사용",
Placeholder: "Tencent API 키",
},
SecretKey: {
Title: "Tencent Secret 키",
SubTitle: "커스텀 Tencent Secret 키 사용",
Placeholder: "Tencent Secret 키",
},
Endpoint: {
Title: "엔드포인트 주소",
SubTitle: "지원되지 않음, .env에서 설정",
},
},
ByteDance: {
ApiKey: {
Title: "엔드포인트 키",
@@ -417,6 +454,88 @@ const ko: PartialLocaleType = {
SubTitle: "예: ",
},
},
Moonshot: {
ApiKey: {
Title: "Moonshot API 키",
SubTitle: "커스텀 Moonshot API 키 사용",
Placeholder: "Moonshot API 키",
},
Endpoint: {
Title: "엔드포인트 주소",
SubTitle: "예: ",
},
},
DeepSeek: {
ApiKey: {
Title: "DeepSeek API 키",
SubTitle: "커스텀 DeepSeek API 키 사용",
Placeholder: "DeepSeek API 키",
},
Endpoint: {
Title: "엔드포인트 주소",
SubTitle: "예: ",
},
},
XAI: {
ApiKey: {
Title: "XAI API 키",
SubTitle: "커스텀 XAI API 키 사용",
Placeholder: "XAI API 키",
},
Endpoint: {
Title: "엔드포인트 주소",
SubTitle: "예: ",
},
},
ChatGLM: {
ApiKey: {
Title: "ChatGLM API 키",
SubTitle: "커스텀 ChatGLM API 키 사용",
Placeholder: "ChatGLM API 키",
},
Endpoint: {
Title: "엔드포인트 주소",
SubTitle: "예: ",
},
},
SiliconFlow: {
ApiKey: {
Title: "SiliconFlow API 키",
SubTitle: "커스텀 SiliconFlow API 키 사용",
Placeholder: "SiliconFlow API 키",
},
Endpoint: {
Title: "엔드포인트 주소",
SubTitle: "예: ",
},
},
Stability: {
ApiKey: {
Title: "Stability API 키",
SubTitle: "커스텀 Stability API 키 사용",
Placeholder: "Stability API 키",
},
Endpoint: {
Title: "엔드포인트 주소",
SubTitle: "예: ",
},
},
Iflytek: {
ApiKey: {
Title: "Iflytek API 키",
SubTitle: "커스텀 Iflytek API 키 사용",
Placeholder: "Iflytek API 키",
},
ApiSecret: {
Title: "Iflytek API Secret",
SubTitle: "커스텀 Iflytek API Secret 키 사용",
Placeholder: "Iflytek API Secret 키",
},
Endpoint: {
Title: "엔드포인트 주소",
SubTitle: "예: ",
},
},
CustomModel: {
Title: "커스텀 모델 이름",
SubTitle: "커스텀 모델 옵션 추가, 영어 쉼표로 구분",
@@ -437,6 +556,17 @@ const ko: PartialLocaleType = {
SubTitle: "사용자 정의 .env 구성을 지원하지 않습니다",
},
},
AI302: {
ApiKey: {
Title: "엔드포인트 키",
SubTitle: "커스텀 302.AI API 키 사용",
Placeholder: "302.AI API 키",
},
Endpoint: {
Title: "엔드포인트 주소",
SubTitle: "예: ",
},
},
},
Model: "모델 (model)",
@@ -464,13 +594,67 @@ const ko: PartialLocaleType = {
Title: "빈도 벌점 (frequency_penalty)",
SubTitle: "값이 클수록 중복 단어 감소 가능성 높음",
},
TTS: {
Enable: {
Title: "TTS 활성화",
SubTitle: "TTS 서비스 활성화",
},
Autoplay: {
Title: "자동 재생 활성화",
SubTitle:
"자동으로 음성을 생성하고 재생, 먼저 TTS 스위치를 활성화해야 함",
},
Model: "모델",
Voice: {
Title: "음성",
SubTitle: "음성을 생성할 때 사용할 음성",
},
Speed: {
Title: "속도",
SubTitle: "생성된 음성의 속도",
},
Engine: "TTS Engine",
},
Realtime: {
Enable: {
Title: "실시간 채팅",
SubTitle: "실시간 채팅 기능 활성화",
},
Provider: {
Title: "모델 제공업체",
SubTitle: "다른 제공업체 간 전환",
},
Model: {
Title: "모델",
SubTitle: "모델 선택",
},
ApiKey: {
Title: "API 키",
SubTitle: "API 키",
Placeholder: "API 키",
},
Azure: {
Endpoint: {
Title: "엔드포인트",
SubTitle: "엔드포인트",
},
Deployment: {
Title: "배포 이름",
SubTitle: "배포 이름",
},
},
Temperature: {
Title: "무작위성 (temperature)",
SubTitle: "값이 클수록 응답이 더 무작위적",
},
},
},
Store: {
DefaultTopic: "새 채팅",
BotHello: "무엇을 도와드릴까요?",
Error: "오류가 발생했습니다. 나중에 다시 시도해 주세요.",
Prompt: {
History: (content: string) => "이것은 이전 채팅 요약입니다: " + content,
History: (content: string) => "이전 채팅 요약: " + content,
Topic:
"네 글자에서 다섯 글자로 이 문장의 간략한 주제를 반환하세요. 설명이나 문장 부호, 어미, 불필요한 텍스트, 굵은 글씨는 필요 없습니다. 주제가 없다면 '잡담'이라고만 반환하세요.",
Summarize:
@@ -492,8 +676,11 @@ const ko: PartialLocaleType = {
Clear: "컨텍스트가 지워졌습니다.",
Revert: "컨텍스트 복원",
},
Plugin: {
Name: "플러그인",
Discovery: {
Name: "디스커버리",
},
Mcp: {
Name: "MCP 플러그인",
},
FineTuned: {
Sysmessage: "당신은 보조자입니다.",
@@ -505,7 +692,7 @@ const ko: PartialLocaleType = {
Search: "검색어 입력",
NoResult: "결과를 찾을 수 없습니다",
NoData: "데이터가 없습니다",
Loading: "로딩 중",
Loading: "로딩 중...",
SubTitle: (count: number) => `${count}개의 결과를 찾았습니다`,
},
@@ -513,6 +700,47 @@ const ko: PartialLocaleType = {
View: "보기",
},
},
Plugin: {
Name: "플러그인",
Page: {
Title: "플러그인",
SubTitle: (count: number) => `${count} 개의 플러그인`,
Search: "플러그인 검색",
Create: "새로 만들기",
Find: "github에서 멋진 플러그인을 찾을 수 있습니다: ",
},
Item: {
Info: (count: number) => `${count} 개의 메서드`,
View: "보기",
Edit: "편집",
Delete: "삭제",
DeleteConfirm: "삭제하시겠습니까?",
},
Auth: {
None: "없음",
Basic: "기본",
Bearer: "Bearer",
Custom: "커스텀",
CustomHeader: "파라미터 이름",
Token: "토큰",
Proxy: "프록시 사용",
ProxyDescription: "CORS 오류 해결을 위해 프록시 사용",
Location: "위치",
LocationHeader: "헤더",
LocationQuery: "쿼리",
LocationBody: "바디",
},
EditModal: {
Title: (readonly: boolean) =>
`플러그인 편집 ${readonly ? "(읽기 전용)" : ""}`,
Download: "다운로드",
Auth: "인증 유형",
Content: "OpenAPI Schema",
Load: "URL에서 로드",
Method: "메서드",
Error: "OpenAPI Schema 오류",
},
},
Mask: {
Name: "마스크",
Page: {
@@ -592,6 +820,61 @@ const ko: PartialLocaleType = {
Topic: "주제",
Time: "시간",
},
SdPanel: {
Prompt: "프롬프트",
NegativePrompt: "부정적 프롬프트",
PleaseInput: (name: string) => `${name}을 입력하세요`,
AspectRatio: "비율",
ImageStyle: "이미지 스타일",
OutFormat: "출력 형식",
AIModel: "AI 모델",
ModelVersion: "모델 버전",
Submit: "제출",
ParamIsRequired: (name: string) => `${name}은 필수 입력 항목입니다`,
Styles: {
D3Model: "3d-model",
AnalogFilm: "analog-film",
Anime: "anime",
Cinematic: "cinematic",
ComicBook: "comic-book",
DigitalArt: "digital-art",
Enhance: "enhance",
FantasyArt: "fantasy-art",
Isometric: "isometric",
LineArt: "line-art",
LowPoly: "low-poly",
ModelingCompound: "modeling-compound",
NeonPunk: "neon-punk",
Origami: "origami",
Photographic: "photographic",
PixelArt: "pixel-art",
TileTexture: "tile-texture",
},
},
Sd: {
SubTitle: (count: number) => `${count} 개의 이미지`,
Actions: {
Params: "파라미터 보기",
Copy: "프롬프트 복사",
Delete: "삭제",
Retry: "다시 시도",
ReturnHome: "홈으로 돌아가기",
History: "기록",
},
EmptyRecord: "아직 이미지가 없습니다",
Status: {
Name: "상태",
Success: "성공",
Error: "오류",
Wait: "대기",
Running: "실행 중",
},
Danger: {
Delete: "삭제하시겠습니까?",
},
GenerateParams: "파라미터 생성",
Detail: "상세",
},
};
export default ko;

View File

@@ -433,6 +433,17 @@ const no: PartialLocaleType = {
Title: "Egendefinert modellnavn",
SubTitle: "Legg til egendefinerte modellalternativer, skill med komma",
},
AI302: {
ApiKey: {
Title: "API-nøkkel",
SubTitle: "Bruk egendefinert 302.AI API-nøkkel",
Placeholder: "302.AI API-nøkkel",
},
Endpoint: {
Title: "API-adresse",
SubTitle: "Eksempel:",
},
},
Huawei: {
ApiKey: {
Title: "API-nøkkel",

View File

@@ -359,6 +359,17 @@ const pt: PartialLocaleType = {
SubTitle: "Verifique sua versão API do console Anthropic",
},
},
AI302: {
ApiKey: {
Title: "Chave API 302.AI",
SubTitle: "Use uma chave API 302.AI personalizada",
Placeholder: "302.AI API Key",
},
Endpoint: {
Title: "Endpoint Address",
SubTitle: "Exemplo: ",
},
},
CustomModel: {
Title: "Modelos Personalizados",
SubTitle: "Opções de modelo personalizado, separados por vírgula",

View File

@@ -426,6 +426,17 @@ const ru: PartialLocaleType = {
SubTitle: "Пример:",
},
},
AI302: {
ApiKey: {
Title: "Ключ интерфейса",
SubTitle: "Использовать пользовательский 302.AI API-ключ",
Placeholder: "302.AI API-ключ",
},
Endpoint: {
Title: "Адрес интерфейса",
SubTitle: "Пример:",
},
},
CustomModel: {
Title: "Название пользовательской модели",
SubTitle:

View File

@@ -397,6 +397,17 @@ const sk: PartialLocaleType = {
SubTitle: "Vyberte špecifickú verziu časti",
},
},
AI302: {
ApiKey: {
Title: "API kľúč",
SubTitle: "Použiť vlastný API kľúč 302.AI",
Placeholder: "302.AI API kľúč",
},
Endpoint: {
Title: "Adresa koncového bodu",
SubTitle: "Príklad:",
},
},
},
Model: "Model",

View File

@@ -426,6 +426,17 @@ const tr: PartialLocaleType = {
SubTitle: "Örnek:",
},
},
AI302: {
ApiKey: {
Title: "API Anahtarı",
SubTitle: "Özelleştirilmiş 302.AI API Anahtarı kullanın",
Placeholder: "302.AI API Anahtarı",
},
Endpoint: {
Title: "API Adresi",
SubTitle: "Örnek:",
},
},
CustomModel: {
Title: "Özelleştirilmiş Model Adı",
SubTitle:

View File

@@ -382,6 +382,17 @@ const tw = {
SubTitle: "選擇一個特定的 API 版本",
},
},
AI302: {
ApiKey: {
Title: "API 金鑰",
SubTitle: "使用自訂 302.AI API 金鑰",
Placeholder: "302.AI API 金鑰",
},
Endpoint: {
Title: "端點位址",
SubTitle: "範例:",
},
},
CustomModel: {
Title: "自訂模型名稱",
SubTitle: "增加自訂模型可選擇項目,使用英文逗號隔開",

View File

@@ -422,6 +422,17 @@ const vi: PartialLocaleType = {
SubTitle: "Ví dụ:",
},
},
AI302: {
ApiKey: {
Title: "Khóa API 302.AI",
SubTitle: "Sử dụng khóa API 302.AI tùy chỉnh",
Placeholder: "302.AI API Key",
},
Endpoint: {
Title: "Địa chỉ giao diện",
SubTitle: "Ví dụ:",
},
},
CustomModel: {
Title: "Tên mô hình tùy chỉnh",
SubTitle:

View File

@@ -18,6 +18,7 @@ import {
CHATGLM_BASE_URL,
SILICONFLOW_BASE_URL,
HUAWEI_BASE_URL,
AI302_BASE_URL,
} from "../constant";
import { getHeaders } from "../client/api";
import { getClientConfig } from "../config/client";
@@ -62,6 +63,8 @@ const DEFAULT_SILICONFLOW_URL = isApp
? SILICONFLOW_BASE_URL
: ApiPath.SiliconFlow;
const DEFAULT_AI302_URL = isApp ? AI302_BASE_URL : ApiPath["302.AI"];
const DEFAULT_ACCESS_STATE = {
accessCode: "",
useCustomConfig: false,
@@ -138,6 +141,10 @@ const DEFAULT_ACCESS_STATE = {
huaweiUrl: DEFAULT_HUAWEI_URL,
huaweiApiKey: "",
// 302.AI
ai302Url: DEFAULT_AI302_URL,
ai302ApiKey: "",
// server config
needCode: true,
hideUserApiKey: false,