File tree Expand file tree Collapse file tree 5 files changed +12
-5
lines changed
Expand file tree Collapse file tree 5 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const DANGER_CONFIG = {
1414 disableFastLink : serverConfig . disableFastLink ,
1515 customModels : serverConfig . customModels ,
1616 defaultModel : serverConfig . defaultModel ,
17+ visionModels : serverConfig . visionModels ,
1718} ;
1819
1920declare global {
Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ export const getBuildConfig = () => {
4040 buildMode,
4141 isApp,
4242 template : process . env . DEFAULT_INPUT_TEMPLATE ?? DEFAULT_INPUT_TEMPLATE ,
43- visionModels : process . env . VISION_MODELS || "" ,
4443 } ;
4544} ;
4645
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ declare global {
2323 DISABLE_FAST_LINK ?: string ; // disallow parse settings from url or not
2424 CUSTOM_MODELS ?: string ; // to control custom models
2525 DEFAULT_MODEL ?: string ; // to control default model in every new chat window
26+ VISION_MODELS ?: string ; // to control vision models
2627
2728 // stability only
2829 STABILITY_URL ?: string ;
@@ -128,6 +129,7 @@ export const getServerSideConfig = () => {
128129 const disableGPT4 = ! ! process . env . DISABLE_GPT4 ;
129130 let customModels = process . env . CUSTOM_MODELS ?? "" ;
130131 let defaultModel = process . env . DEFAULT_MODEL ?? "" ;
132+ let visionModels = process . env . VISION_MODELS ?? "" ;
131133
132134 if ( disableGPT4 ) {
133135 if ( customModels ) customModels += "," ;
@@ -249,6 +251,7 @@ export const getServerSideConfig = () => {
249251 disableFastLink : ! ! process . env . DISABLE_FAST_LINK ,
250252 customModels,
251253 defaultModel,
254+ visionModels,
252255 allowedWebDavEndpoints,
253256 } ;
254257} ;
Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ const DEFAULT_ACCESS_STATE = {
131131 disableFastLink : false ,
132132 customModels : "" ,
133133 defaultModel : "" ,
134+ visionModels : "" ,
134135
135136 // tts config
136137 edgeTTSVoiceName : "zh-CN-YunxiNeural" ,
@@ -145,7 +146,10 @@ export const useAccessStore = createPersistStore(
145146
146147 return get ( ) . needCode ;
147148 } ,
148-
149+ getVisionModels ( ) {
150+ this . fetch ( ) ;
151+ return get ( ) . visionModels ;
152+ } ,
149153 edgeVoiceName ( ) {
150154 this . fetch ( ) ;
151155
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { ServiceProvider } from "./constant";
66// import { fetch as tauriFetch, ResponseType } from "@tauri-apps/api/http";
77import { fetch as tauriStreamFetch } from "./utils/stream" ;
88import { VISION_MODEL_REGEXES , EXCLUDE_VISION_MODEL_REGEXES } from "./constant" ;
9- import { getClientConfig } from "./config/client " ;
9+ import { useAccessStore } from "./store " ;
1010import { ModelSize } from "./typing" ;
1111
1212export function trimTopic ( topic : string ) {
@@ -255,8 +255,8 @@ export function getMessageImages(message: RequestMessage): string[] {
255255}
256256
257257export function isVisionModel ( model : string ) {
258- const clientConfig = getClientConfig ( ) ;
259- const envVisionModels = clientConfig ?. visionModels
258+ const visionModels = useAccessStore . getState ( ) . visionModels ;
259+ const envVisionModels = visionModels
260260 ?. split ( "," )
261261 . map ( ( m ) => m . trim ( ) ) ;
262262 if ( envVisionModels ?. includes ( model ) ) {
You can’t perform that action at this time.
0 commit comments