Skip to content

Commit

Permalink
Fix: prompt of expert mode (langgenius#3168)
Browse files Browse the repository at this point in the history
  • Loading branch information
JzoNgKVO committed Apr 8, 2024
1 parent d2259f2 commit d8db728
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion web/app/components/app/configuration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,10 @@ const Configuration: FC = () => {
const promptMode = modelConfig.prompt_type === PromptMode.advanced ? PromptMode.advanced : PromptMode.simple
doSetPromptMode(promptMode)
if (promptMode === PromptMode.advanced) {
setChatPromptConfig(modelConfig.chat_prompt_config || clone(DEFAULT_CHAT_PROMPT_CONFIG) as any)
if (modelConfig.chat_prompt_config && modelConfig.chat_prompt_config.prompt.length > 0)
setChatPromptConfig(modelConfig.chat_prompt_config)
else
setChatPromptConfig(clone(DEFAULT_CHAT_PROMPT_CONFIG) as any)
setCompletionPromptConfig(modelConfig.completion_prompt_config || clone(DEFAULT_COMPLETION_PROMPT_CONFIG) as any)
setCanReturnToSimpleMode(false)
}
Expand Down
8 changes: 7 additions & 1 deletion web/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable import/no-mutable-exports */
import { InputVarType } from '@/app/components/workflow/types'
import { AgentStrategy } from '@/types/app'
import { PromptRole } from '@/models/debug'

export let apiPrefix = ''
export let publicApiPrefix = ''
Expand Down Expand Up @@ -70,7 +71,12 @@ export const TONE_LIST = [
]

export const DEFAULT_CHAT_PROMPT_CONFIG = {
prompt: [],
prompt: [
{
role: PromptRole.system,
text: '',
},
],
}

export const DEFAULT_COMPLETION_PROMPT_CONFIG = {
Expand Down

0 comments on commit d8db728

Please sign in to comment.