From e8f30a127524afc28d31cbb30b31456d3bee49e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Mon, 10 Aug 2026 15:51:04 +0800 Subject: [PATCH] =?UTF-8?q?AI=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=B7=A5?= =?UTF-8?q?=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/code-generation/api/index.ts | 29 + .../code-generation/components/ai-prompt.vue | 755 +++++++++++++----- .../components/database-select.vue | 403 +++++----- .../components/json-import.vue | 83 +- .../components/manual-form.vue | 13 +- .../components/mode-selector.vue | 2 +- .../src/views/code-generation/config/form.ts | 5 +- .../src/views/code-generation/index.vue | 9 +- .../code-generation/utils/data-transformer.ts | 41 +- .../code-generation/utils/json-example.ts | 85 ++ .../src/views/system/config/api/index.ts | 70 ++ .../config/components/AiGenerationLog.vue | 355 ++++++++ .../system/config/components/AiKeyManage.vue | 715 +++++++++++++++++ .../system/config/components/AiManage.vue | 70 ++ .../config/components/AiRuntimeSelect.vue | 494 ++++++++++++ .../src/views/system/config/index.vue | 258 ++++++ .../system/database/components/ChangeLog.vue | 332 +++++--- .../system/database/components/TableData.vue | 112 ++- 18 files changed, 3273 insertions(+), 558 deletions(-) create mode 100644 apps/web-antd/src/views/code-generation/utils/json-example.ts create mode 100644 apps/web-antd/src/views/system/config/api/index.ts create mode 100644 apps/web-antd/src/views/system/config/components/AiGenerationLog.vue create mode 100644 apps/web-antd/src/views/system/config/components/AiKeyManage.vue create mode 100644 apps/web-antd/src/views/system/config/components/AiManage.vue create mode 100644 apps/web-antd/src/views/system/config/components/AiRuntimeSelect.vue create mode 100644 apps/web-antd/src/views/system/config/index.vue diff --git a/apps/web-antd/src/views/code-generation/api/index.ts b/apps/web-antd/src/views/code-generation/api/index.ts index f4470fe9..e0a94224 100644 --- a/apps/web-antd/src/views/code-generation/api/index.ts +++ b/apps/web-antd/src/views/code-generation/api/index.ts @@ -83,3 +83,32 @@ export async function getTableStructureApi(tableName: string) { export async function generateFromTableApi(data: Record) { return requestClient.post(`${prefix}generate-from-table`, data); } + +/** + * AI 提示词生成代码结构(自动填写表单) + */ +export async function aiGenerateApi(data: { + module_name: string; + description: string; + pid?: number; +}) { + return requestClient.post(`${prefix}ai-generate`, data); +} + +/** + * 根据模块名生成 / 优化需求概览与代码生成提示词 + * mode: generate=仅模块名生成;optimize=优化已有描述;不传则后端自动判断 + */ +export async function aiRequirementPromptApi(data: { + module_name: string; + description?: string; + mode?: 'generate' | 'optimize'; +}) { + return requestClient.post<{ + text: string; + prompt: string; + overview: string; + mode: string; + module_name: string; + }>(`${prefix}ai-requirement-prompt`, data); +} diff --git a/apps/web-antd/src/views/code-generation/components/ai-prompt.vue b/apps/web-antd/src/views/code-generation/components/ai-prompt.vue index 67ef6099..05583f2e 100644 --- a/apps/web-antd/src/views/code-generation/components/ai-prompt.vue +++ b/apps/web-antd/src/views/code-generation/components/ai-prompt.vue @@ -1,12 +1,35 @@ + + + + diff --git a/apps/web-antd/src/views/system/config/components/AiKeyManage.vue b/apps/web-antd/src/views/system/config/components/AiKeyManage.vue new file mode 100644 index 00000000..322f9cff --- /dev/null +++ b/apps/web-antd/src/views/system/config/components/AiKeyManage.vue @@ -0,0 +1,715 @@ + + + + + diff --git a/apps/web-antd/src/views/system/config/components/AiManage.vue b/apps/web-antd/src/views/system/config/components/AiManage.vue new file mode 100644 index 00000000..c5fd5b76 --- /dev/null +++ b/apps/web-antd/src/views/system/config/components/AiManage.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/apps/web-antd/src/views/system/config/components/AiRuntimeSelect.vue b/apps/web-antd/src/views/system/config/components/AiRuntimeSelect.vue new file mode 100644 index 00000000..7bd0efd1 --- /dev/null +++ b/apps/web-antd/src/views/system/config/components/AiRuntimeSelect.vue @@ -0,0 +1,494 @@ + + + + + diff --git a/apps/web-antd/src/views/system/config/index.vue b/apps/web-antd/src/views/system/config/index.vue new file mode 100644 index 00000000..3cafc8fc --- /dev/null +++ b/apps/web-antd/src/views/system/config/index.vue @@ -0,0 +1,258 @@ + + + + + diff --git a/apps/web-antd/src/views/system/database/components/ChangeLog.vue b/apps/web-antd/src/views/system/database/components/ChangeLog.vue index 3b18bd19..34c64738 100644 --- a/apps/web-antd/src/views/system/database/components/ChangeLog.vue +++ b/apps/web-antd/src/views/system/database/components/ChangeLog.vue @@ -1,7 +1,21 @@