mirror of https://github.com/langgenius/dify.git
fix(trigger): appmode type
This commit is contained in:
parent
3f34f38635
commit
bc95678c5e
|
|
@ -10,7 +10,7 @@ import { fetchPromptTemplate } from '@/service/debug'
|
|||
import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
||||
|
||||
type Param = {
|
||||
appMode: AppModeEnum
|
||||
appMode?: AppModeEnum
|
||||
modelModeType: ModelModeType
|
||||
modelName: string
|
||||
promptMode: PromptMode
|
||||
|
|
@ -104,6 +104,9 @@ const useAdvancedPromptConfig = ({
|
|||
const migrateToDefaultPrompt = async (isMigrateToCompetition?: boolean, toModelModeType?: ModelModeType) => {
|
||||
const mode = modelModeType
|
||||
const toReplacePrePrompt = prePrompt || ''
|
||||
if (!appMode)
|
||||
return
|
||||
|
||||
if (!isAdvancedPrompt) {
|
||||
const { chat_prompt_config, completion_prompt_config, stop } = await fetchPromptTemplate({
|
||||
appMode,
|
||||
|
|
@ -122,7 +125,6 @@ const useAdvancedPromptConfig = ({
|
|||
})
|
||||
setChatPromptConfig(newPromptConfig)
|
||||
}
|
||||
|
||||
else {
|
||||
const newPromptConfig = produce(completion_prompt_config, (draft) => {
|
||||
draft.prompt.text = draft.prompt.text.replace(PRE_PROMPT_PLACEHOLDER_TEXT, toReplacePrePrompt)
|
||||
|
|
|
|||
|
|
@ -982,7 +982,6 @@ const Configuration: FC = () => {
|
|||
<>
|
||||
<ModelParameterModal
|
||||
isAdvancedMode={isAdvancedMode}
|
||||
mode={mode}
|
||||
provider={modelConfig.provider}
|
||||
completionParams={completionParams}
|
||||
modelId={modelConfig.model_id}
|
||||
|
|
|
|||
|
|
@ -31,13 +31,11 @@ import Loading from '@/app/components/base/loading'
|
|||
import { useProviderContext } from '@/context/provider-context'
|
||||
import { PROVIDER_WITH_PRESET_TONE, STOP_PARAMETER_RULE, TONE_LIST } from '@/config'
|
||||
import { ArrowNarrowLeft } from '@/app/components/base/icons/src/vender/line/arrows'
|
||||
import type { ModelModeType } from '@/types/app'
|
||||
|
||||
export type ModelParameterModalProps = {
|
||||
popupClassName?: string
|
||||
portalToFollowElemContentClassName?: string
|
||||
isAdvancedMode: boolean
|
||||
mode: ModelModeType
|
||||
modelId: string
|
||||
provider: string
|
||||
setModel: (model: { modelId: string; provider: string; mode?: string; features?: string[] }) => void
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import { get, post, ssePost } from './base'
|
||||
import type { IOnCompleted, IOnData, IOnError, IOnFile, IOnMessageEnd, IOnMessageReplace, IOnThought } from './base'
|
||||
import type { ChatPromptConfig, CompletionPromptConfig } from '@/models/debug'
|
||||
import type { ModelModeType } from '@/types/app'
|
||||
import type { AppModeEnum, ModelModeType } from '@/types/app'
|
||||
import type { ModelParameterRule } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
||||
|
||||
export type BasicAppFirstRes = {
|
||||
prompt: string
|
||||
variables: string[]
|
||||
|
|
@ -105,7 +106,7 @@ export const fetchPromptTemplate = ({
|
|||
mode,
|
||||
modelName,
|
||||
hasSetDataSet,
|
||||
}: { appMode: string; mode: ModelModeType; modelName: string; hasSetDataSet: boolean }) => {
|
||||
}: { appMode: AppModeEnum; mode: ModelModeType; modelName: string; hasSetDataSet: boolean }) => {
|
||||
return get<Promise<{ chat_prompt_config: ChatPromptConfig; completion_prompt_config: CompletionPromptConfig; stop: [] }>>('/app/prompt-templates', {
|
||||
params: {
|
||||
app_mode: appMode,
|
||||
|
|
|
|||
Loading…
Reference in New Issue