|  | @@ -18,7 +18,6 @@ import Config from '@/app/components/app/configuration/config'
 | 
	
		
			
				|  |  |  import Debug from '@/app/components/app/configuration/debug'
 | 
	
		
			
				|  |  |  import Confirm from '@/app/components/base/confirm'
 | 
	
		
			
				|  |  |  import { ProviderEnum } from '@/app/components/header/account-setting/model-page/declarations'
 | 
	
		
			
				|  |  | -import type { AppDetailResponse } from '@/models/app'
 | 
	
		
			
				|  |  |  import { ToastContext } from '@/app/components/base/toast'
 | 
	
		
			
				|  |  |  import { fetchAppDetail, updateAppModelConfig } from '@/service/apps'
 | 
	
		
			
				|  |  |  import { promptVariablesToUserInputsForm, userInputsFormToPromptVariables } from '@/utils/model-config'
 | 
	
	
		
			
				|  | @@ -27,6 +26,11 @@ import AccountSetting from '@/app/components/header/account-setting'
 | 
	
		
			
				|  |  |  import { useProviderContext } from '@/context/provider-context'
 | 
	
		
			
				|  |  |  import { AppType } from '@/types/app'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +type PublichConfig = {
 | 
	
		
			
				|  |  | +  modelConfig: ModelConfig
 | 
	
		
			
				|  |  | +  completionParams: CompletionParams
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  const Configuration: FC = () => {
 | 
	
		
			
				|  |  |    const { t } = useTranslation()
 | 
	
		
			
				|  |  |    const { notify } = useContext(ToastContext)
 | 
	
	
		
			
				|  | @@ -37,10 +41,7 @@ const Configuration: FC = () => {
 | 
	
		
			
				|  |  |    const matched = pathname.match(/\/app\/([^/]+)/)
 | 
	
		
			
				|  |  |    const appId = (matched?.length && matched[1]) ? matched[1] : ''
 | 
	
		
			
				|  |  |    const [mode, setMode] = useState('')
 | 
	
		
			
				|  |  | -  const [publishedConfig, setPublishedConfig] = useState<{
 | 
	
		
			
				|  |  | -    modelConfig: ModelConfig
 | 
	
		
			
				|  |  | -    completionParams: CompletionParams
 | 
	
		
			
				|  |  | -  } | null>(null)
 | 
	
		
			
				|  |  | +  const [publishedConfig, setPublishedConfig] = useState<PublichConfig | null>(null)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    const [conversationId, setConversationId] = useState<string | null>('')
 | 
	
		
			
				|  |  |    const [introduction, setIntroduction] = useState<string>('')
 | 
	
	
		
			
				|  | @@ -100,13 +101,13 @@ const Configuration: FC = () => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    const [dataSets, setDataSets] = useState<DataSet[]>([])
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const syncToPublishedConfig = (_publishedConfig: any) => {
 | 
	
		
			
				|  |  | +  const syncToPublishedConfig = (_publishedConfig: PublichConfig) => {
 | 
	
		
			
				|  |  |      const modelConfig = _publishedConfig.modelConfig
 | 
	
		
			
				|  |  |      setModelConfig(_publishedConfig.modelConfig)
 | 
	
		
			
				|  |  |      setCompletionParams(_publishedConfig.completionParams)
 | 
	
		
			
				|  |  |      setDataSets(modelConfig.dataSets || [])
 | 
	
		
			
				|  |  |      // feature
 | 
	
		
			
				|  |  | -    setIntroduction(modelConfig.opening_statement)
 | 
	
		
			
				|  |  | +    setIntroduction(modelConfig.opening_statement!)
 | 
	
		
			
				|  |  |      setMoreLikeThisConfig(modelConfig.more_like_this || {
 | 
	
		
			
				|  |  |        enabled: false,
 | 
	
		
			
				|  |  |      })
 | 
	
	
		
			
				|  | @@ -143,7 +144,7 @@ const Configuration: FC = () => {
 | 
	
		
			
				|  |  |    const [isShowSetAPIKey, { setTrue: showSetAPIKey, setFalse: hideSetAPIkey }] = useBoolean()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    useEffect(() => {
 | 
	
		
			
				|  |  | -    (fetchAppDetail({ url: '/apps', id: appId }) as any).then(async (res: AppDetailResponse) => {
 | 
	
		
			
				|  |  | +    fetchAppDetail({ url: '/apps', id: appId }).then(async (res) => {
 | 
	
		
			
				|  |  |        setMode(res.mode)
 | 
	
		
			
				|  |  |        const modelConfig = res.model_config
 | 
	
		
			
				|  |  |        const model = res.model_config.model
 | 
	
	
		
			
				|  | @@ -250,7 +251,7 @@ const Configuration: FC = () => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    const [showConfirm, setShowConfirm] = useState(false)
 | 
	
		
			
				|  |  |    const resetAppConfig = () => {
 | 
	
		
			
				|  |  | -    syncToPublishedConfig(publishedConfig)
 | 
	
		
			
				|  |  | +    syncToPublishedConfig(publishedConfig!)
 | 
	
		
			
				|  |  |      setShowConfirm(false)
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 |