diff --git a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx index 972cbf62fabe97..eac8303b312b60 100644 --- a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx @@ -18,6 +18,7 @@ import PromptEditor from '@/app/components/base/prompt-editor' import ConfigContext from '@/context/debug-configuration' import { getNewVar, getVars } from '@/utils/var' import { AppType } from '@/types/app' +import { AlertCircle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback' type Props = { type: PromptRole @@ -28,6 +29,8 @@ type Props = { canDelete: boolean onDelete: () => void promptVariables: PromptVariable[] + isContextMissing: boolean + onHideContextMissingTip: () => void } const AdvancedPromptInput: FC = ({ @@ -39,6 +42,8 @@ const AdvancedPromptInput: FC = ({ canDelete, onDelete, promptVariables, + isContextMissing, + onHideContextMissingTip, }) => { const { t } = useTranslation() @@ -91,45 +96,65 @@ const AdvancedPromptInput: FC = ({ } const editorHeight = isChatMode ? 'h-[200px]' : 'h-[508px]' - + const contextMissing = ( +
+
+ +
{t('appDebug.promptMode.contextMissing')}
+
+
{t('common.operation.ok')}
+
+ ) return ( -
+
-
- {isChatMode - ? ( - - ) - : ( -
+ {isContextMissing + ? contextMissing + : ( +
+ {isChatMode + ? ( + + ) + : ( +
-
{t('appDebug.pageTitle.line1')} -
- - {t('appDebug.promptTip')} -
} - selector='config-prompt-tooltip'> - - -
)} -
- {canDelete && ( - - )} - {!isCopied - ? ( - { - copy(value) - setIsCopied(true) - }} /> - ) - : ( - - )} +
{t('appDebug.pageTitle.line1')} +
+ + {t('appDebug.promptTip')} +
} + selector='config-prompt-tooltip'> + + +
)} +
+ {canDelete && ( + + )} + {!isCopied + ? ( + { + copy(value) + setIsCopied(true) + }} /> + ) + : ( + + )} +
+
+ )} -
-
= ({ currentAdvancedPrompt, setCurrentAdvancedPrompt, modelModeType, + dataSets, + hasSetBlockStatus, } = useContext(ConfigContext) const handleMessageTypeChange = (index: number, role: PromptRole) => { @@ -84,6 +86,9 @@ const Prompt: FC = ({ setCurrentAdvancedPrompt(newPrompt) } + const isContextMissing = dataSets.length > 0 && !hasSetBlockStatus.context + const [isHideContextMissTip, setIsHideContextMissTip] = React.useState(false) + if (!isAdvancedMode) { return ( = ({ onDelete={() => handlePromptDelete(index)} onChange={value => handleValueChange(value, index)} promptVariables={promptVariables} + isContextMissing={isContextMissing && !isHideContextMissTip} + onHideContextMissingTip={() => setIsHideContextMissTip(true)} /> )) ) @@ -125,6 +132,8 @@ const Prompt: FC = ({ onDelete={() => handlePromptDelete(0)} onChange={value => handleValueChange(value)} promptVariables={promptVariables} + isContextMissing={isContextMissing && !isHideContextMissTip} + onHideContextMissingTip={() => setIsHideContextMissTip(true)} /> ) } diff --git a/web/app/components/app/configuration/config-prompt/style.module.css b/web/app/components/app/configuration/config-prompt/style.module.css index 2c9f0022ae0083..66785620b33d26 100644 --- a/web/app/components/app/configuration/config-prompt/style.module.css +++ b/web/app/components/app/configuration/config-prompt/style.module.css @@ -14,6 +14,11 @@ box-sizing: border-box; } +.warningBorder { + border: 2px solid #F79009; + border-radius: 12px; +} + .optionWrap { display: none; } diff --git a/web/i18n/lang/app-debug.en.ts b/web/i18n/lang/app-debug.en.ts index ac88c32175d87c..63c8d769174acd 100644 --- a/web/i18n/lang/app-debug.en.ts +++ b/web/i18n/lang/app-debug.en.ts @@ -16,6 +16,7 @@ const translation = { operation: { addMessage: 'Add Message', }, + contextMissing: 'Context component missed, the effectiveness of the prompt may not be good.', }, operation: { applyConfig: 'Publish', diff --git a/web/i18n/lang/app-debug.zh.ts b/web/i18n/lang/app-debug.zh.ts index 31bad3d7a7f66a..2f6ea41f07c196 100644 --- a/web/i18n/lang/app-debug.zh.ts +++ b/web/i18n/lang/app-debug.zh.ts @@ -16,6 +16,7 @@ const translation = { operation: { addMessage: '添加消息', }, + contextMissing: '上下文内容块缺失,提示词的有效性可能不好。', }, operation: { applyConfig: '发布',