diff --git a/web/src/api/prompt.ts b/web/src/api/prompt.ts
new file mode 100644
index 00000000..77ea1271
--- /dev/null
+++ b/web/src/api/prompt.ts
@@ -0,0 +1,12 @@
+import { request } from '@/utils/request'
+import type { AiPromptForm } from '@/views/ApplicationConfig/types'
+
+export const createPromptSessions = () => {
+ return request.post(`/prompt/sessions`)
+}
+export const getPrompt = (session_id: string) => {
+ return request.get(`/prompt/sessions/${session_id}`)
+}
+export const updatePromptMessages = (session_id: string, data: AiPromptForm) => {
+ return request.post(`/prompt/sessions/${session_id}/messages`, data)
+}
\ No newline at end of file
diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts
index 585a191a..eacf0437 100644
--- a/web/src/i18n/en.ts
+++ b/web/src/i18n/en.ts
@@ -990,6 +990,15 @@ export const en = {
apiKeyDeleteContent: 'Once deleted, it cannot be recovered, and applications using this Key will not be able to access the API',
currentValue: 'Current Value',
qpsLimitUnit: 'times/second',
+ addVariable: 'Insert Variable',
+ defineVariableName: 'Custom Variable Name',
+ defineVariableNamePlaceholder: 'Enter variable name, e.g.: user_name',
+ defineVariableNameExtra: 'Format: Variable name will be automatically wrapped with {{}}',
+ you: 'You',
+ ai: 'AI Assistant',
+ promptChatPlaceholder: 'Describe the prompt you need, e.g.: I need a customer service assistant',
+ promptChatEmpty: 'No conversation content available',
+ promptEmpty: 'Describe your use case on the left, and the orchestration preview will be displayed here.',
},
userMemory: {
userMemory: 'User Memory',
diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts
index be429b84..43388b55 100644
--- a/web/src/i18n/zh.ts
+++ b/web/src/i18n/zh.ts
@@ -505,6 +505,15 @@ export const zh = {
apiKeyDeleteContent: '删除后将无法恢复,使用此Key的应用将无法访问 API',
currentValue: '当前值',
qpsLimitUnit: '次/秒',
+ addVariable: '插入变量',
+ defineVariableName: '自定义变量名',
+ defineVariableNamePlaceholder: '输入变量名,例如:user_name',
+ defineVariableNameExtra: '格式:变量名会自动添加{{}}包裹',
+ you: '你',
+ ai: 'AI 助手',
+ promptChatPlaceholder: '描述你需要的提示词,例如:我需要一个客服助手',
+ promptChatEmpty: '目前没有对话内容',
+ promptEmpty: '在左侧描述您的用例,编排预览将在此处显示。',
},
// 角色管理相关翻译
role: {
diff --git a/web/src/views/ApplicationConfig/Agent.tsx b/web/src/views/ApplicationConfig/Agent.tsx
index 2e032d84..d4206fbd 100644
--- a/web/src/views/ApplicationConfig/Agent.tsx
+++ b/web/src/views/ApplicationConfig/Agent.tsx
@@ -17,6 +17,7 @@ import type {
KnowledgeConfig,
Variable,
MemoryConfig,
+ AiPromptModalRef
} from './types'
import type { Model } from '@/views/ModelManagement/types'
import { getModelList } from '@/api/models';
@@ -27,19 +28,19 @@ import { getApplicationConfig } from '@/api/application'
import { getKnowledgeBaseList } from '@/api/knowledgeBase'
import { memoryConfigListUrl } from '@/api/memory'
import CustomSelect from '@/components/CustomSelect'
-
-
+import aiPrompt from '@/assets/images/application/aiPrompt.png'
+import AiPromptModal from './components/AiPromptModal'
const DescWrapper: FC<{desc: string, className?: string}> = ({desc, className}) => {
return (
-
+
{desc}
)
}
const LabelWrapper: FC<{title: string, className?: string; children?: ReactNode}> = ({title, className, children}) => {
return (
-
+
{title}
{children}
@@ -50,12 +51,12 @@ const SwitchWrapper: FC<{ title: string, desc: string, name: string }> = ({ titl
return (
-
+
@@ -66,11 +67,11 @@ const SelectWrapper: FC<{ title: string, desc: string, name: string, url: string
const { t } = useTranslation();
return (
<>
-
+
-
+
>
)
}
@@ -336,15 +337,22 @@ const Agent = forwardRef((_props, ref) => {
handleSave
}))
+ const aiPromptModalRef = useRef(null)
+ const handlePrompt = () => {
+ aiPromptModalRef.current?.handleOpen()
+ }
+ const updatePrompt = (value: string) => {
+ form.setFieldValue('system_prompt', value)
+ }
return (
<>
{loading && }
-
+