Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/api/config/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const DANGER_CONFIG = {
disableFastLink: serverConfig.disableFastLink,
customModels: serverConfig.customModels,
defaultModel: serverConfig.defaultModel,
visionModels: serverConfig.visionModels,
};

declare global {
Expand Down
1 change: 0 additions & 1 deletion app/config/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const getBuildConfig = () => {
buildMode,
isApp,
template: process.env.DEFAULT_INPUT_TEMPLATE ?? DEFAULT_INPUT_TEMPLATE,
visionModels: process.env.VISION_MODELS || "",
};
};

Expand Down
3 changes: 3 additions & 0 deletions app/config/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ declare global {
DISABLE_FAST_LINK?: string; // disallow parse settings from url or not
CUSTOM_MODELS?: string; // to control custom models
DEFAULT_MODEL?: string; // to control default model in every new chat window
VISION_MODELS?: string; // to control vision models

// stability only
STABILITY_URL?: string;
Expand Down Expand Up @@ -128,6 +129,7 @@ export const getServerSideConfig = () => {
const disableGPT4 = !!process.env.DISABLE_GPT4;
let customModels = process.env.CUSTOM_MODELS ?? "";
let defaultModel = process.env.DEFAULT_MODEL ?? "";
let visionModels = process.env.VISION_MODELS ?? "";

if (disableGPT4) {
if (customModels) customModels += ",";
Expand Down Expand Up @@ -249,6 +251,7 @@ export const getServerSideConfig = () => {
disableFastLink: !!process.env.DISABLE_FAST_LINK,
customModels,
defaultModel,
visionModels,
allowedWebDavEndpoints,
};
};
6 changes: 5 additions & 1 deletion app/store/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const DEFAULT_ACCESS_STATE = {
disableFastLink: false,
customModels: "",
defaultModel: "",
visionModels: "",

// tts config
edgeTTSVoiceName: "zh-CN-YunxiNeural",
Expand All @@ -145,7 +146,10 @@ export const useAccessStore = createPersistStore(

return get().needCode;
},

getVisionModels() {
this.fetch();
return get().visionModels;
},
edgeVoiceName() {
this.fetch();

Expand Down
6 changes: 3 additions & 3 deletions app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ServiceProvider } from "./constant";
// import { fetch as tauriFetch, ResponseType } from "@tauri-apps/api/http";
import { fetch as tauriStreamFetch } from "./utils/stream";
import { VISION_MODEL_REGEXES, EXCLUDE_VISION_MODEL_REGEXES } from "./constant";
import { getClientConfig } from "./config/client";
import { useAccessStore } from "./store";
import { ModelSize } from "./typing";

export function trimTopic(topic: string) {
Expand Down Expand Up @@ -255,8 +255,8 @@ export function getMessageImages(message: RequestMessage): string[] {
}

export function isVisionModel(model: string) {
const clientConfig = getClientConfig();
const envVisionModels = clientConfig?.visionModels
const visionModels = useAccessStore.getState().visionModels;
const envVisionModels = visionModels
?.split(",")
.map((m) => m.trim());
if (envVisionModels?.includes(model)) {
Expand Down
Loading