fix judgement of app configure

This commit is contained in:
JzoNg 2024-03-19 09:33:18 +08:00
parent 3b4676d8e9
commit 9884466ef0
6 changed files with 10 additions and 10 deletions

View File

@ -92,7 +92,7 @@ const AdvancedPromptInput: FC<Props> = ({
},
})
}
const isChatApp = mode === AppType.chat
const isChatApp = mode !== AppType.completion
const [isCopied, setIsCopied] = React.useState(false)
const promptVariablesObj = (() => {

View File

@ -120,7 +120,7 @@ const Prompt: FC<ISimplePromptInput> = ({
})
setModelConfig(newModelConfig)
setPrevPromptConfig(modelConfig.configs)
if (mode === AppType.chat)
if (mode !== AppType.completion)
setIntroduction(res.opening_statement)
showAutomaticFalse()
eventEmitter?.emit({

View File

@ -186,7 +186,7 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
)
: ''}
{(mode === AppType.chat && res?.opening_statement) && (
{(mode !== AppType.completion && res?.opening_statement) && (
<div className='mt-7'>
<GroupName name={t('appDebug.feature.groupChat.title')} />
<OpeningStatement

View File

@ -59,7 +59,7 @@ const Config: FC = () => {
moderationConfig,
setModerationConfig,
} = useContext(ConfigContext)
const isChatApp = mode === AppType.chat
const isChatApp = mode !== AppType.completion
const { data: speech2textDefaultModel } = useDefaultModel(4)
const { data: text2speechDefaultModel } = useDefaultModel(5)
const { setShowModerationSettingModal } = useModalContext()

View File

@ -135,7 +135,7 @@ const Debug: FC<IDebug> = ({
const [completionFiles, setCompletionFiles] = useState<VisionFile[]>([])
const checkCanSend = useCallback(() => {
if (isAdvancedMode && mode === AppType.chat) {
if (isAdvancedMode && mode !== AppType.completion) {
if (modelModeType === ModelModeType.completion) {
if (!hasSetBlockStatus.history) {
notify({ type: 'error', message: t('appDebug.otherError.historyNoBeEmpty'), duration: 3000 })
@ -428,7 +428,7 @@ const Debug: FC<IDebug> = ({
!debugWithMultipleModel && (
<div className="flex flex-col grow">
{/* Chat */}
{mode === AppType.chat && (
{mode !== AppType.completion && (
<div className='grow h-0 overflow-hidden'>
<DebugWithSingleModel
ref={debugWithSingleModelRef}

View File

@ -346,7 +346,7 @@ const Configuration: FC = () => {
const appMode = mode
if (modeMode === ModelModeType.completion) {
if (appMode === AppType.chat) {
if (appMode !== AppType.completion) {
if (!completionPromptConfig.prompt.text || !completionPromptConfig.conversation_histories_role.assistant_prefix || !completionPromptConfig.conversation_histories_role.user_prefix)
await migrateToDefaultPrompt(true, ModelModeType.completion)
}
@ -511,7 +511,7 @@ const Configuration: FC = () => {
}, [appId])
const promptEmpty = (() => {
if (mode === AppType.chat)
if (mode !== AppType.completion)
return false
if (isAdvancedMode) {
@ -525,7 +525,7 @@ const Configuration: FC = () => {
else { return !modelConfig.configs.prompt_template }
})()
const cannotPublish = (() => {
if (mode === AppType.chat) {
if (mode !== AppType.completion) {
if (!isAdvancedMode)
return false
@ -550,7 +550,7 @@ const Configuration: FC = () => {
notify({ type: 'error', message: t('appDebug.otherError.promptNoBeEmpty'), duration: 3000 })
return
}
if (isAdvancedMode && mode === AppType.chat) {
if (isAdvancedMode && mode !== AppType.completion) {
if (modelModeType === ModelModeType.completion) {
if (!hasSetBlockStatus.history) {
notify({ type: 'error', message: t('appDebug.otherError.historyNoBeEmpty'), duration: 3000 })