mirror of
https://github.com/basketikun/infinite-canvas.git
synced 2026-08-05 17:04:27 +08:00
feat(api): add support for 火山方舟 protocol and enhance video reference validation
This commit is contained in:
@@ -3,7 +3,7 @@ import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { nanoid } from "nanoid";
|
||||
|
||||
export type ApiCallFormat = "openai" | "gemini";
|
||||
export type ApiCallFormat = "openai" | "gemini" | "ark";
|
||||
export type ModelCapability = "image" | "video" | "text" | "audio";
|
||||
|
||||
export type ChannelModel = {
|
||||
@@ -62,6 +62,7 @@ export const CONFIG_STORE_KEY = "infinite-canvas:ai_config_store";
|
||||
const CHANNEL_MODEL_SEPARATOR = "::";
|
||||
const OPENAI_BASE_URL = "https://api.openai.com";
|
||||
const GEMINI_BASE_URL = "https://generativelanguage.googleapis.com";
|
||||
const ARK_BASE_URL = "https://ark.cn-beijing.volces.com/api/v3";
|
||||
|
||||
export const defaultConfig: AiConfig = {
|
||||
channelMode: "local",
|
||||
@@ -356,11 +357,13 @@ function normalizeChannels(config: AiConfig) {
|
||||
}
|
||||
|
||||
export function defaultBaseUrlForApiFormat(apiFormat: ApiCallFormat) {
|
||||
return apiFormat === "gemini" ? GEMINI_BASE_URL : OPENAI_BASE_URL;
|
||||
if (apiFormat === "gemini") return GEMINI_BASE_URL;
|
||||
if (apiFormat === "ark") return ARK_BASE_URL;
|
||||
return OPENAI_BASE_URL;
|
||||
}
|
||||
|
||||
function normalizeApiFormat(apiFormat: unknown): ApiCallFormat {
|
||||
return apiFormat === "gemini" ? "gemini" : "openai";
|
||||
return apiFormat === "gemini" || apiFormat === "ark" ? apiFormat : "openai";
|
||||
}
|
||||
|
||||
function uniqueModelOptions(models: string[]) {
|
||||
|
||||
Reference in New Issue
Block a user