fix: upload btn not sync right

This commit is contained in:
Joel 2025-10-15 15:51:18 +08:00
parent db9e5665c2
commit 9e3dd69277
2 changed files with 7 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import Config from '@/app/components/app/configuration/config'
import Debug from '@/app/components/app/configuration/debug'
import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { ModelModeType, Resolution, TransferMethod } from '@/types/app'
import type { ModelConfig } from '@/models/debug'
import { PromptMode } from '@/models/debug'
import { ANNOTATION_DEFAULT, DEFAULT_AGENT_SETTING, DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
@ -82,7 +83,7 @@ const Configuration: FC<Props> = ({
const dataSets = dataSetData?.data || []
const isLoading = isLoadingAppDetail || isLoadingDatasets
const modelConfig = ((modelConfig?: BackendModelConfig) => {
const modelConfig: ModelConfig = ((modelConfig?: BackendModelConfig) => {
if(isLoading || !modelConfig)
return defaultModelConfig
@ -139,7 +140,7 @@ const Configuration: FC<Props> = ({
tools: [],
} : DEFAULT_AGENT_SETTING,
}
return newModelConfig
return (newModelConfig as any)
})(appDetail?.model_config)
const mode = appDetail?.mode
// const isChatApp = ['chat', 'advanced-chat', 'agent-chat'].includes(mode!)
@ -211,7 +212,7 @@ const Configuration: FC<Props> = ({
number_limits: modelConfig.file_upload?.image?.number_limits || 3,
transfer_methods: modelConfig.file_upload?.image?.transfer_methods || ['local_file', 'remote_url'],
},
enabled: true,
enabled: !!(modelConfig.file_upload?.enabled || modelConfig.file_upload?.image?.enabled),
allowed_file_types: modelConfig.file_upload?.allowed_file_types || [],
allowed_file_extensions: modelConfig.file_upload?.allowed_file_extensions || [...FILE_EXTS[SupportUploadFileTypes.image], ...FILE_EXTS[SupportUploadFileTypes.video]].map(ext => `.${ext}`),
allowed_file_upload_methods: modelConfig.file_upload?.allowed_file_upload_methods || modelConfig.file_upload?.image?.transfer_methods || ['local_file', 'remote_url'],

View File

@ -132,6 +132,9 @@ export type ModelConfig = {
provider: string // LLM Provider: for example "OPENAI"
model_id: string
mode: ModelModeType
prompt_type: PromptMode
chat_prompt_config: ChatPromptConfig | null
completion_prompt_config: CompletionPromptConfig | null
configs: PromptConfig
opening_statement: string | null
more_like_this: MoreLikeThisConfig | null