mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-10 03:16:51 +08:00
Fix App logs page modal show different model icon. (#1224)
This commit is contained in:
@@ -38,9 +38,9 @@ const CardView: FC<ICardViewProps> = ({ appId }) => {
|
||||
|
||||
message ||= (type === 'success' ? 'modifiedSuccessfully' : 'modifiedUnsuccessfully')
|
||||
|
||||
if (type === 'success') {
|
||||
if (type === 'success')
|
||||
mutate(detailParams)
|
||||
}
|
||||
|
||||
notify({
|
||||
type,
|
||||
message: t(`common.actionMsg.${message}`),
|
||||
@@ -79,7 +79,7 @@ const CardView: FC<ICardViewProps> = ({ appId }) => {
|
||||
if (!err)
|
||||
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
|
||||
|
||||
handleCallbackResult(err)
|
||||
handleCallbackResult(err)
|
||||
}
|
||||
|
||||
const onGenerateCode = async () => {
|
||||
|
||||
@@ -64,8 +64,8 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
|
||||
|
||||
const getAppDetail = async () => {
|
||||
setDetailState({ loading: true })
|
||||
const [err, res] = await asyncRunSafe<App>(
|
||||
fetchAppDetail({ url: '/apps', id: app.id }) as Promise<App>,
|
||||
const [err, res] = await asyncRunSafe(
|
||||
fetchAppDetail({ url: '/apps', id: app.id }),
|
||||
)
|
||||
if (!err) {
|
||||
setDetailState({ loading: false, detail: res })
|
||||
@@ -76,11 +76,11 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
|
||||
|
||||
const onSaveSiteConfig = useCallback(
|
||||
async (params: ConfigParams) => {
|
||||
const [err] = await asyncRunSafe<App>(
|
||||
const [err] = await asyncRunSafe(
|
||||
updateAppSiteConfig({
|
||||
url: `/apps/${app.id}/site`,
|
||||
body: params,
|
||||
}) as Promise<App>,
|
||||
}),
|
||||
)
|
||||
if (!err) {
|
||||
notify({
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user