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