feat: 完善 Prompt 管理与生成流程配置
This commit is contained in:
@@ -34,10 +34,6 @@ export function rollbackPromptVersion(promptTemplateId, promptVersionId) {
|
||||
})
|
||||
}
|
||||
|
||||
export function initializePromptV1() {
|
||||
return request({ url: '/generator/prompt/initialize-v1', method: 'post' })
|
||||
}
|
||||
|
||||
export function listPromptModels() {
|
||||
return request({ url: '/generator/prompt/models', method: 'get' })
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPermi="['generator:prompt:add']" type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增模板</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPermi="['generator:prompt:version']" type="primary" plain icon="el-icon-document-add" size="mini" @click="initializeV1">初始化 V1</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPermi="['generator:prompt:debug']" type="success" plain icon="el-icon-video-play" size="mini" @click="openDebugLab()">在线调试</el-button>
|
||||
</el-col>
|
||||
@@ -44,7 +41,7 @@
|
||||
<el-table-column label="当前发布" min-width="130">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.currentVersion" size="mini" type="success">{{ scope.row.currentVersion }}</el-tag>
|
||||
<span v-else class="muted">使用内置后备</span>
|
||||
<span v-else class="muted">未发布</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发布指纹" min-width="170">
|
||||
@@ -281,7 +278,6 @@ import {
|
||||
createPromptVersion,
|
||||
publishPromptVersion,
|
||||
rollbackPromptVersion,
|
||||
initializePromptV1,
|
||||
listPromptModels,
|
||||
debugPrompt,
|
||||
listPromptDebugRuns,
|
||||
@@ -318,7 +314,7 @@ export default {
|
||||
versionDrawerOpen: false,
|
||||
versionDrawerTitle: 'Prompt 版本',
|
||||
detailLoading: false,
|
||||
detail: { template: null, versions: [], builtinRelease: null },
|
||||
detail: { template: null, versions: [] },
|
||||
versionDialogOpen: false,
|
||||
versionDialogTitle: '',
|
||||
versionReadOnly: false,
|
||||
@@ -428,20 +424,21 @@ export default {
|
||||
})
|
||||
},
|
||||
clearDetail() {
|
||||
this.detail = { template: null, versions: [], builtinRelease: null }
|
||||
this.detail = { template: null, versions: [] }
|
||||
},
|
||||
openVersionDialog() {
|
||||
const template = this.detail.template
|
||||
const builtin = this.detail.builtinRelease || {}
|
||||
const versions = this.detail.versions || []
|
||||
const managed = versions.find(item => item.promptVersionId === template.currentVersionId) || versions[0] || {}
|
||||
this.versionReadOnly = false
|
||||
this.versionDialogTitle = '新建 Prompt 版本'
|
||||
this.versionForm = {
|
||||
version: '',
|
||||
providerCode: 'deepseek',
|
||||
model: '',
|
||||
userPromptContract: builtin.userPromptContract || 'legacy-builder:' + template.generateType + ':v1',
|
||||
userPromptTemplate: '{{input}}',
|
||||
systemPrompt: builtin.systemPrompt || '',
|
||||
providerCode: managed.providerCode || 'deepseek',
|
||||
model: managed.model || '',
|
||||
userPromptContract: managed.userPromptContract || '',
|
||||
userPromptTemplate: managed.userPromptTemplate || '{{input}}',
|
||||
systemPrompt: managed.systemPrompt || '',
|
||||
remark: ''
|
||||
}
|
||||
this.versionDialogOpen = true
|
||||
@@ -485,17 +482,6 @@ export default {
|
||||
this.getList()
|
||||
}).catch(() => {})
|
||||
},
|
||||
initializeV1() {
|
||||
this.$modal.confirm('将当前业务 Prompt 初始化为 V1 并立即发布;同时修复此前系统生成的同质化 V1,不覆盖人工版本。确认继续?').then(() => {
|
||||
return initializePromptV1()
|
||||
}).then(response => {
|
||||
this.$modal.msgSuccess(response.msg || 'V1 初始化完成')
|
||||
this.getList()
|
||||
if (this.versionDrawerOpen && this.detail.template) {
|
||||
this.loadDetail(this.detail.template.promptTemplateId)
|
||||
}
|
||||
}).catch(() => {})
|
||||
},
|
||||
loadModelGateways() {
|
||||
listPromptModels().then(response => {
|
||||
this.modelGateways = response.data || []
|
||||
|
||||
Reference in New Issue
Block a user