From 3c35a3a8e403eb93298d5cf0b77308f3cf48b314 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Sun, 28 Sep 2025 15:14:57 +0800 Subject: [PATCH] feat(prompt): add prompt --- frontend/src/api/prompt.ts | 11 + frontend/src/components/layout/Menu.vue | 1 + frontend/src/i18n/en.json | 16 + frontend/src/i18n/zh-CN.json | 16 + frontend/src/router/index.ts | 7 + frontend/src/views/system/prompt/index.vue | 864 +++++++++++++++++++++ 6 files changed, 915 insertions(+) create mode 100644 frontend/src/api/prompt.ts create mode 100644 frontend/src/views/system/prompt/index.vue diff --git a/frontend/src/api/prompt.ts b/frontend/src/api/prompt.ts new file mode 100644 index 00000000..01d73488 --- /dev/null +++ b/frontend/src/api/prompt.ts @@ -0,0 +1,11 @@ +import { request } from '@/utils/request' + +export const promptApi = { + getList: (pageNum: any, pageSize: any, type: any, params: any) => + request.get(`/system/custom_prompt/${type}/page/${pageNum}/${pageSize}`, { + params, + }), + updateEmbedded: (data: any) => request.put(`/system/custom_prompt`, data), + deleteEmbedded: (params: any) => request.delete('/system/custom_prompt', { data: params }), + getOne: (id: any) => request.get(`/system/custom_prompt/${id}`), +} diff --git a/frontend/src/components/layout/Menu.vue b/frontend/src/components/layout/Menu.vue index 24143e95..0cd0425e 100644 --- a/frontend/src/components/layout/Menu.vue +++ b/frontend/src/components/layout/Menu.vue @@ -51,6 +51,7 @@ const routerList = computed(() => { !route.path.includes('member') && !route.path.includes('professional') && !route.path.includes('training') && + !route.path.includes('prompt') && !route.path.includes('permission') && !route.path.includes('preview') && route.path !== '/login' && diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 7c6a2df9..5c6847a3 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -6,6 +6,22 @@ "Dashboard": "Dashboard", "AI Model Configuration": "AI Model Configuration" }, + "prompt": { + "no_prompt_words": "No prompt words", + "customize_prompt_words": "Customize prompt words", + "ask_sql": "Ask SQL", + "data_analysis": "Data Analysis", + "data_prediction": "Data Prediction", + "add_prompt_word": "Add prompt word", + "prompt_word_name": "Prompt word name", + "prompt_word_content": "Prompt word content", + "training_data_details": "Training data details", + "selected_prompt_words": "Do you want to delete the {msg} selected prompt words?", + "replaced_with": "Please enter a prompt word. Example: When returning names, only the last name will be displayed, and the first name will be replaced with *.", + "loss_exercise_caution": "Entering high-risk operations such as deleting a database or table or modifying the table structure may result in permanent data loss. Exercise caution!", + "edit_prompt_word": "Edit prompt word", + "prompt_word_name_de": "Do you want to delete the prompt word: {msg}?" + }, "training": { "effective_data_sources": "Effective data sources", "all_data_sources": "All data sources", diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index dc77bf27..8511a3f3 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -6,6 +6,22 @@ "Dashboard": "仪表盘", "AI Model Configuration": "模型配置" }, + "prompt": { + "no_prompt_words": "暂无提示词", + "customize_prompt_words": "自定义提示词", + "ask_sql": "问数 SQL", + "data_analysis": "数据分析", + "data_prediction": "数据预测", + "add_prompt_word": "添加提示词", + "prompt_word_name": "提示词名称", + "prompt_word_content": "提示词内容", + "training_data_details": "训练数据详情", + "selected_prompt_words": "是否删除选中的 {msg} 条提示词?", + "replaced_with": "请输入提示词,示例:返回姓名时,只显示姓氏,名字用*代替", + "loss_exercise_caution": "若输入删除数据库、数据表或修改表结构等高风险的操作指令,可能导致数据永久丢失,请务必谨慎!", + "edit_prompt_word": "编辑提示词", + "prompt_word_name_de": "是否删除提示词:{msg}?" + }, "training": { "effective_data_sources": "生效数据源", "all_data_sources": "所有数据源", diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 00fad166..84e29859 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -17,6 +17,7 @@ import EmbeddedPage from '@/views/embedded/page.vue' import Member from '@/views/system/member/index.vue' import Professional from '@/views/system/professional/index.vue' import Training from '@/views/system/training/index.vue' +import Prompt from '@/views/system/prompt/index.vue' import Appearance from '@/views/system/appearance/index.vue' import Permission from '@/views/system/permission/index.vue' import User from '@/views/system/user/User.vue' @@ -120,6 +121,12 @@ export const routes = [ component: Training, meta: { title: t('training.data_training') }, }, + { + path: '/set/prompt', + name: 'prompt', + component: Prompt, + meta: { title: t('prompt.customize_prompt_words') }, + }, ], }, { diff --git a/frontend/src/views/system/prompt/index.vue b/frontend/src/views/system/prompt/index.vue new file mode 100644 index 00000000..1e3d39ce --- /dev/null +++ b/frontend/src/views/system/prompt/index.vue @@ -0,0 +1,864 @@ + + + + + +