|
|
@@ -1,12 +1,15 @@
|
|
|
<template>
|
|
|
<!--
|
|
|
- 项目标准弹框 BasicModal:右上角自带「放大/还原 + 关闭」(与其它弹框一致),
|
|
|
- ModalWrapper 按视口自动限高并在内部滚动 —— 内容再多也不会把弹框拉出屏幕。
|
|
|
+ 研判方案新建/编辑弹框:内容版式取自 docs/designs/新建方案页-设计稿(基本信息 + 工具组/技能卡片多选),
|
|
|
+ 默认全屏打开(defaultFullscreen,右上角可还原为窗口弹框)。BasicModal 右上角自带
|
|
|
+ 「还原/全屏 + 关闭」,ModalWrapper 按视口限高并在内部滚动 —— 内容再多也不会撑出屏幕。
|
|
|
-->
|
|
|
<BasicModal
|
|
|
:open="open"
|
|
|
- :title="isEdit ? '编辑专家' : '新建专家'"
|
|
|
- :width="640"
|
|
|
+ :title="isEdit ? '编辑研判方案' : '新建研判方案'"
|
|
|
+ :width="1100"
|
|
|
+ default-fullscreen
|
|
|
+ wrap-class-name="ae-agent-modal"
|
|
|
:confirm-loading="submitting"
|
|
|
:body-style="bodyStyle"
|
|
|
ok-text="保存"
|
|
|
@@ -14,135 +17,246 @@
|
|
|
@ok="submit"
|
|
|
@cancel="close"
|
|
|
>
|
|
|
- <a-form ref="formRef" class="ai-expert-form" :model="form" :rules="rules" layout="vertical">
|
|
|
- <a-form-item label="专家名称" name="name">
|
|
|
- <a-input v-model:value="form.name" placeholder="如:通话研判专家" :maxlength="100" />
|
|
|
- </a-form-item>
|
|
|
-
|
|
|
- <a-form-item label="描述" name="description">
|
|
|
- <a-input v-model:value="form.description" placeholder="一句话说明这个专家擅长什么(可选)" :maxlength="500" />
|
|
|
- </a-form-item>
|
|
|
-
|
|
|
- <a-form-item label="系统提示词(人设与分析规则)" name="sysPrompt">
|
|
|
- <a-textarea
|
|
|
- v-model:value="form.sysPrompt"
|
|
|
- :rows="8"
|
|
|
- :maxlength="30000"
|
|
|
- placeholder="定义专家的角色、分析口径与回答风格"
|
|
|
- />
|
|
|
- </a-form-item>
|
|
|
-
|
|
|
- <!-- 工具:组级启用。不勾 = 不限制(全部业务组可用);勾选 = 只启用所选组 -->
|
|
|
- <a-form-item label="可用工具组">
|
|
|
- <div class="ai-expert-form__hint"
|
|
|
- >不勾选 = 不限制(全部业务组可用,默认装备人员画像组);勾选后只启用所选组,未选组的工具对模型不可见。</div
|
|
|
- >
|
|
|
- <a-spin :spinning="toolsLoading" size="small">
|
|
|
- <div v-if="toolGroups.length" class="ai-expert-form__checks">
|
|
|
- <label v-for="g in toolGroups" :key="g.group" class="ai-expert-form__check">
|
|
|
- <a-checkbox v-model:checked="checkedGroups[g.group]">
|
|
|
- {{ g.label }}
|
|
|
- <span class="ai-expert-form__count">{{ g.count }} 个工具</span>
|
|
|
- </a-checkbox>
|
|
|
- <div class="ai-expert-form__check-desc">{{ g.description }}</div>
|
|
|
- </label>
|
|
|
+ <div class="ae-form">
|
|
|
+ <p class="ae-form__sub">组装提示词、工具组与技能,定义一个可参与研判的智能体。</p>
|
|
|
+
|
|
|
+ <a-form ref="formRef" class="ae-form__form" :model="form" :rules="rules" layout="vertical">
|
|
|
+ <!-- 基本信息(左标签 + 控件行) -->
|
|
|
+ <section class="ae-form__panel ae-form__panel--form">
|
|
|
+ <div class="ae-form__row">
|
|
|
+ <label class="ae-form__label"><i class="ae-form__req">*</i>研判方案名称</label>
|
|
|
+ <div class="ae-form__control">
|
|
|
+ <a-form-item name="name">
|
|
|
+ <a-input v-model:value="form.name" placeholder="如:夜间通话研判" :maxlength="100" />
|
|
|
+ </a-form-item>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="ae-form__row">
|
|
|
+ <label class="ae-form__label">描述</label>
|
|
|
+ <div class="ae-form__control">
|
|
|
+ <a-form-item name="description">
|
|
|
+ <a-input
|
|
|
+ v-model:value="form.description"
|
|
|
+ placeholder="一句话说明这个研判方案擅长什么(可选)"
|
|
|
+ :maxlength="500"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="ae-form__row">
|
|
|
+ <label class="ae-form__label"><i class="ae-form__req">*</i>系统提示词</label>
|
|
|
+ <div class="ae-form__control ae-form__control--full">
|
|
|
+ <div class="ae-form__textarea-wrap">
|
|
|
+ <a-form-item name="sysPrompt">
|
|
|
+ <a-textarea
|
|
|
+ v-model:value="form.sysPrompt"
|
|
|
+ :rows="8"
|
|
|
+ :maxlength="30000"
|
|
|
+ placeholder="定义研判方案的角色、分析口径与回答风格(人设与分析规则)"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <span class="ae-form__counter">{{ form.sysPrompt.length }} / 30000</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+
|
|
|
+ <!-- 可用工具组(卡片多选:不勾 = 不限制) -->
|
|
|
+ <section class="ae-form__panel">
|
|
|
+ <div class="ae-form__sec-head">
|
|
|
+ <span class="ae-form__sec-title">可用工具组</span>
|
|
|
+ <span class="ae-form__count">{{ pickedGroups.length ? `已选 ${pickedGroups.length}` : '不限制' }}</span>
|
|
|
+ <span class="ae-form__sp"></span>
|
|
|
+ </div>
|
|
|
+ <div class="ae-form__hint"
|
|
|
+ >不勾选 =
|
|
|
+ 不限制(全部业务组可用,默认装备人员画像组);勾选的工具组与工具包共同构成业务工具白名单,未选的工具对模型不可见。</div
|
|
|
+ >
|
|
|
+ <a-spin :spinning="toolsLoading">
|
|
|
+ <div v-if="toolGroups.length" class="ae-form__grid">
|
|
|
+ <div
|
|
|
+ v-for="g in toolGroups"
|
|
|
+ :key="g.group"
|
|
|
+ class="ae-form__card"
|
|
|
+ :class="{ 'is-on': checkedGroups[g.group] }"
|
|
|
+ role="checkbox"
|
|
|
+ :aria-checked="!!checkedGroups[g.group]"
|
|
|
+ @click="checkedGroups[g.group] = !checkedGroups[g.group]"
|
|
|
+ >
|
|
|
+ <span class="ae-form__ck"><Icon icon="mdi:check" :size="11" /></span>
|
|
|
+ <div class="ae-form__card-name">{{ g.label }}</div>
|
|
|
+ <div class="ae-form__card-desc">{{ g.description }}</div>
|
|
|
+ <div class="ae-form__chips"
|
|
|
+ ><span>{{ g.count }} 个工具</span></div
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else class="ae-form__hint">暂无可用工具组</div>
|
|
|
+ </a-spin>
|
|
|
+ <div v-if="pickedGroups.length" class="ae-form__selbar">
|
|
|
+ <span class="ae-form__sel-label">已选 {{ pickedGroups.length }} 组:</span>
|
|
|
+ <span v-for="g in pickedGroups" :key="g" class="ae-form__sel-chip">{{ toolGroupLabel(g) }}</span>
|
|
|
+ <span class="ae-form__sp"></span>
|
|
|
+ <button type="button" class="ae-form__clear" @click="clearGroups">清空</button>
|
|
|
</div>
|
|
|
- <div v-else class="ai-expert-form__hint">暂无可用工具组</div>
|
|
|
- </a-spin>
|
|
|
- </a-form-item>
|
|
|
-
|
|
|
- <!-- 技能:名称白名单 + 直接在弹窗里新建/修改技能(写入当前用户的技能目录) -->
|
|
|
- <a-form-item>
|
|
|
- <div class="ai-expert-form__sec-head">
|
|
|
- <span class="ai-expert-form__sec-title">可用技能</span>
|
|
|
- <a-button size="small" @click="openSkillEditor(null)">
|
|
|
- <template #icon><Icon icon="mdi:plus" :size="14" /></template>
|
|
|
- 添加技能
|
|
|
- </a-button>
|
|
|
- </div>
|
|
|
- <div class="ai-expert-form__hint"
|
|
|
- >不勾选 =
|
|
|
- 不限制(该账号安装的技能全部可用);勾选后该专家只能看到所选技能。技能可直接在这里新建、修改(保存即写入你的技能目录)。</div
|
|
|
- >
|
|
|
-
|
|
|
- <!-- 技能编辑器:新建/修改共用;修改时技能名锁定(目录名不可变) -->
|
|
|
- <div v-if="skillEditor.open" class="ai-expert-form__skill-editor">
|
|
|
- <div class="ai-expert-form__skill-editor-title">
|
|
|
- {{ skillEditor.editing ? `修改技能:${skillEditor.editing}` : '添加技能' }}
|
|
|
+ </section>
|
|
|
+
|
|
|
+ <!-- 可用工具包(用户自定义工具组合;与工具组并集构成业务工具白名单) -->
|
|
|
+ <section class="ae-form__panel">
|
|
|
+ <div class="ae-form__sec-head">
|
|
|
+ <span class="ae-form__sec-title">可用工具包</span>
|
|
|
+ <span class="ae-form__count">{{ pickedPackIds.length ? `已选 ${pickedPackIds.length}` : '不限制' }}</span>
|
|
|
+ <span class="ae-form__sp"></span>
|
|
|
</div>
|
|
|
- <a-input
|
|
|
- v-model:value="skillEditor.name"
|
|
|
- :disabled="!!skillEditor.editing"
|
|
|
- :maxlength="64"
|
|
|
- placeholder="技能名(中英文 / 数字 / ._-,最多 64 字符)"
|
|
|
- />
|
|
|
- <a-input
|
|
|
- v-model:value="skillEditor.description"
|
|
|
- :maxlength="500"
|
|
|
- placeholder="一句话描述(可选,会出现在模型可见的技能目录里)"
|
|
|
- />
|
|
|
- <a-textarea
|
|
|
- v-model:value="skillEditor.content"
|
|
|
- :rows="8"
|
|
|
- placeholder="技能正文(Markdown):适用场景、操作步骤、口径与注意事项"
|
|
|
- />
|
|
|
- <div class="ai-expert-form__skill-editor-ops">
|
|
|
- <a-button size="small" @click="closeSkillEditor">取消</a-button>
|
|
|
- <a-button size="small" type="primary" :loading="skillEditor.saving" @click="saveSkill">
|
|
|
- {{ skillEditor.editing ? '保存修改' : '创建技能' }}
|
|
|
- </a-button>
|
|
|
+ <div class="ae-form__hint"
|
|
|
+ >工具包在「插件与技能 → 工具包」维护;勾选的工具组与工具包共同构成业务工具白名单(只启用其中的工具),全不勾
|
|
|
+ = 不限制。</div
|
|
|
+ >
|
|
|
+ <a-spin :spinning="packsLoading">
|
|
|
+ <div v-if="packs.length" class="ae-form__grid">
|
|
|
+ <div
|
|
|
+ v-for="p in packs"
|
|
|
+ :key="p.id"
|
|
|
+ class="ae-form__card"
|
|
|
+ :class="{ 'is-on': checkedPacks[p.id] }"
|
|
|
+ role="checkbox"
|
|
|
+ :aria-checked="!!checkedPacks[p.id]"
|
|
|
+ @click="checkedPacks[p.id] = !checkedPacks[p.id]"
|
|
|
+ >
|
|
|
+ <span class="ae-form__ck"><Icon icon="mdi:check" :size="11" /></span>
|
|
|
+ <div class="ae-form__card-name" :title="p.name">{{ p.name }}</div>
|
|
|
+ <div class="ae-form__card-desc">{{ p.description || '(无描述)' }}</div>
|
|
|
+ <div class="ae-form__chips">
|
|
|
+ <span>{{ p.toolCount }} 个工具</span>
|
|
|
+ <span v-for="n in p.toolNames.slice(0, 2)" :key="n">{{ n }}</span>
|
|
|
+ <span v-if="p.toolNames.length > 2">+{{ p.toolNames.length - 2 }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else class="ae-form__hint">还没有工具包。到「插件与技能 → 工具包」新建后即可在这里勾选。</div>
|
|
|
+ </a-spin>
|
|
|
+ <div v-if="pickedPackIds.length" class="ae-form__selbar">
|
|
|
+ <span class="ae-form__sel-label">已选 {{ pickedPackIds.length }} 个:</span>
|
|
|
+ <span v-for="id in pickedPackIds" :key="id" class="ae-form__sel-chip">{{ packName(id) }}</span>
|
|
|
+ <span class="ae-form__sp"></span>
|
|
|
+ <button type="button" class="ae-form__clear" @click="clearPacks">清空</button>
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <a-spin :spinning="skillsLoading" size="small">
|
|
|
- <div v-if="skills.length" class="ai-expert-form__checks">
|
|
|
- <div v-for="s in skills" :key="s.name" class="ai-expert-form__skill-row">
|
|
|
- <label class="ai-expert-form__check">
|
|
|
- <a-checkbox v-model:checked="checkedSkills[s.name]">
|
|
|
- {{ s.name }}
|
|
|
- </a-checkbox>
|
|
|
- <div class="ai-expert-form__check-desc">{{ s.description || '(无描述)' }}</div>
|
|
|
- </label>
|
|
|
- <button type="button" class="ai-expert-form__skill-edit" title="修改技能" @click="openSkillEditor(s)">
|
|
|
- <Icon icon="mdi:pencil-outline" :size="14" />
|
|
|
- </button>
|
|
|
+ </section>
|
|
|
+
|
|
|
+ <!-- 可用技能 -->
|
|
|
+ <section class="ae-form__panel">
|
|
|
+ <div class="ae-form__sec-head">
|
|
|
+ <span class="ae-form__sec-title">可用技能</span>
|
|
|
+ <span class="ae-form__count">{{ pickedSkills.length ? `已选 ${pickedSkills.length}` : '不限制' }}</span>
|
|
|
+ <span class="ae-form__sp"></span>
|
|
|
+ <label class="ae-form__search">
|
|
|
+ <Icon icon="mdi:magnify" :size="14" />
|
|
|
+ <input v-model="skillKeyword" type="text" placeholder="搜索技能名称" />
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ <div class="ae-form__hint"
|
|
|
+ >不勾选 =
|
|
|
+ 不限制(该账号安装的技能全部可用);勾选后该研判方案只能看到所选技能。技能可直接在这里修改(保存即写入你的技能目录)。</div
|
|
|
+ >
|
|
|
+
|
|
|
+ <!-- 技能编辑器(修改技能):技能名锁定(目录名不可变) -->
|
|
|
+ <div v-if="skillEditor.open" class="ae-form__seditor">
|
|
|
+ <div class="ae-form__seditor-title">
|
|
|
+ {{ `修改技能:${skillEditor.editing}` }}
|
|
|
+ </div>
|
|
|
+ <a-input
|
|
|
+ v-model:value="skillEditor.name"
|
|
|
+ :disabled="!!skillEditor.editing"
|
|
|
+ :maxlength="64"
|
|
|
+ placeholder="技能名(中英文 / 数字 / ._-,最多 64 字符)"
|
|
|
+ />
|
|
|
+ <a-input
|
|
|
+ v-model:value="skillEditor.description"
|
|
|
+ :maxlength="500"
|
|
|
+ placeholder="一句话描述(可选,会出现在模型可见的技能目录里)"
|
|
|
+ />
|
|
|
+ <a-textarea
|
|
|
+ v-model:value="skillEditor.content"
|
|
|
+ :rows="8"
|
|
|
+ placeholder="技能正文(Markdown):适用场景、操作步骤、口径与注意事项"
|
|
|
+ />
|
|
|
+ <div class="ae-form__seditor-ops">
|
|
|
+ <a-button @click="closeSkillEditor">取消</a-button>
|
|
|
+ <a-button type="primary" :loading="skillEditor.saving" @click="saveSkill">
|
|
|
+ {{ skillEditor.editing ? '保存修改' : '创建技能' }}
|
|
|
+ </a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div v-else class="ai-expert-form__hint">
|
|
|
- 还没有技能。点上方「添加技能」新建第一个(也可到「插件与技能」页上传 zip 安装)。
|
|
|
+
|
|
|
+ <a-spin :spinning="skillsLoading">
|
|
|
+ <div v-if="filteredSkills.length" class="ae-form__grid">
|
|
|
+ <div
|
|
|
+ v-for="s in filteredSkills"
|
|
|
+ :key="s.name"
|
|
|
+ class="ae-form__card"
|
|
|
+ :class="{ 'is-on': checkedSkills[s.name] }"
|
|
|
+ role="checkbox"
|
|
|
+ :aria-checked="!!checkedSkills[s.name]"
|
|
|
+ @click="checkedSkills[s.name] = !checkedSkills[s.name]"
|
|
|
+ >
|
|
|
+ <span class="ae-form__ck"><Icon icon="mdi:check" :size="11" /></span>
|
|
|
+ <div class="ae-form__card-name" :title="s.name">{{ s.name }}</div>
|
|
|
+ <div class="ae-form__card-desc">{{ s.description || '(无描述)' }}</div>
|
|
|
+ <div class="ae-form__card-ops">
|
|
|
+ <span class="ae-form__sp"></span>
|
|
|
+ <button type="button" class="ae-form__iconbtn" title="修改技能" @click.stop="openSkillEditor(s)">
|
|
|
+ <Icon icon="mdi:pencil-outline" :size="14" />
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="skills.length" class="ae-form__hint"> 没有匹配「{{ skillKeyword.trim() }}」的技能。 </div>
|
|
|
+ <div v-else class="ae-form__hint"> 还没有技能。到「插件与技能」页上传 zip 安装后再回来勾选。 </div>
|
|
|
+ </a-spin>
|
|
|
+ <div v-if="pickedSkills.length" class="ae-form__selbar">
|
|
|
+ <span class="ae-form__sel-label">已选 {{ pickedSkills.length }} 个:</span>
|
|
|
+ <span v-for="n in pickedSkills" :key="n" class="ae-form__sel-chip">{{ n }}</span>
|
|
|
+ <span class="ae-form__sp"></span>
|
|
|
+ <button type="button" class="ae-form__clear" @click="clearSkills">清空</button>
|
|
|
</div>
|
|
|
- </a-spin>
|
|
|
- </a-form-item>
|
|
|
- </a-form>
|
|
|
+ </section>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
</BasicModal>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
/**
|
|
|
- * 专家新建/编辑弹窗。
|
|
|
+ * 研判方案新建/编辑弹框:内容版式取自新建方案页设计稿(纯页面版试过被否,回弹框 + 默认全屏)。
|
|
|
*
|
|
|
- * 工具与技能的勾选语义与后端一致:**不勾 = 不限制**(tools_allow_json/skills_allow_json
|
|
|
- * 落 null,走默认口径),勾选若干 = 只启用所选(后端按白名单注册/过滤,未选的对模型不可见)。
|
|
|
+ * 逻辑与历史弹框版完全一致:
|
|
|
+ * - 工具/技能/工具包的勾选语义:**不勾 = 不限制**(tools_allow_json/skills_allow_json/tool_packs_json 落 null 走默认口径),
|
|
|
+ * 勾选若干 = 只启用所选(工具组与工具包并集构成业务工具白名单,未选的对模型不可见);
|
|
|
+ * - 候选数据:工具组从 capabilityApi.listTools() 按 groupCode 聚合(与「插件与技能」页同一数据源),
|
|
|
+ * 技能取当前账号已安装的技能(listSkills),repo 来源的只读技能不参与勾选;
|
|
|
+ * - 技能编辑器:修改直接写当前用户的技能目录(新建技能在「插件与技能」页进行),与研判方案是否保存无关;
|
|
|
+ * - 校验与保存走 a-form rules + agentApi.createExpert/updateExpert。
|
|
|
*
|
|
|
- * 候选数据:工具组从 capabilityApi.listTools() 按 groupCode 聚合(与「插件与技能」页同一份数据源),
|
|
|
- * 技能取当前账号已安装的技能(listSkills),repo 来源的只读技能不出现在勾选里
|
|
|
- * —— 白名单只对用户技能目录生效(SkillStore 按 userId 隔离)。
|
|
|
+ * 新增的纯前端能力(不影响保存语义):技能名称过滤、分组已选摘要条与「清空」。
|
|
|
*/
|
|
|
import { computed, reactive, ref, watch } from 'vue';
|
|
|
- import { Checkbox, Form, FormItem, Input, Spin, Textarea } from 'ant-design-vue';
|
|
|
+ import { Button, Form, FormItem, Input, Spin, Textarea } from 'ant-design-vue';
|
|
|
import { BasicModal } from '@/core/components/Modal';
|
|
|
import Icon from '@/core/components/Icon/src/Icon.vue';
|
|
|
import { useMessage } from '@/core/hooks/web/useMessage';
|
|
|
import * as agentApi from '../api/agentApi';
|
|
|
import * as capabilityApi from '../api/capabilityApi';
|
|
|
- import type { AiExpert, SaveExpertParams, SaveSkillParams, Skill } from '../api/types';
|
|
|
+ import * as toolPackApi from '../api/toolPackApi';
|
|
|
+ import type { AiExpert, SaveExpertParams, SaveSkillParams, Skill, ToolPack } from '../api/types';
|
|
|
import { TOOL_GROUP_LABELS, TOOL_GROUP_KEYS, toolGroupLabel } from '../utils/constants';
|
|
|
|
|
|
+ const AButton = Button;
|
|
|
const AForm = Form;
|
|
|
const AFormItem = FormItem;
|
|
|
const AInput = Input;
|
|
|
const ATextarea = Textarea;
|
|
|
- const ACheckbox = Checkbox;
|
|
|
const ASpin = Spin;
|
|
|
|
|
|
const props = defineProps<{
|
|
|
@@ -179,7 +293,7 @@
|
|
|
});
|
|
|
|
|
|
const rules: Record<string, any> = {
|
|
|
- name: [{ required: true, message: '请输入专家名称', trigger: 'blur' }],
|
|
|
+ name: [{ required: true, message: '请输入研判方案名称', trigger: 'blur' }],
|
|
|
sysPrompt: [{ required: true, message: '请输入系统提示词', trigger: 'blur' }],
|
|
|
};
|
|
|
|
|
|
@@ -192,28 +306,50 @@
|
|
|
|
|
|
const toolGroups = ref<ToolGroupOption[]>([]);
|
|
|
const skills = ref<Skill[]>([]);
|
|
|
+ const packs = ref<ToolPack[]>([]);
|
|
|
+ const packsLoading = ref(false);
|
|
|
/** 勾选态(key → checked);未出现的 key 视为不勾 */
|
|
|
const checkedGroups = reactive<Record<string, boolean>>({});
|
|
|
const checkedSkills = reactive<Record<string, boolean>>({});
|
|
|
+ const checkedPacks = reactive<Record<string, boolean>>({});
|
|
|
+
|
|
|
+ /** 技能名称过滤(纯前端展示,不参与保存语义) */
|
|
|
+ const skillKeyword = ref('');
|
|
|
+ const filteredSkills = computed(() => {
|
|
|
+ const k = skillKeyword.value.trim().toLowerCase();
|
|
|
+ if (!k) return skills.value;
|
|
|
+ return skills.value.filter(
|
|
|
+ (s) =>
|
|
|
+ s.name.toLowerCase().includes(k) ||
|
|
|
+ String(s.description || '')
|
|
|
+ .toLowerCase()
|
|
|
+ .includes(k),
|
|
|
+ );
|
|
|
+ });
|
|
|
|
|
|
function resetChecks() {
|
|
|
Object.keys(checkedGroups).forEach((k) => delete checkedGroups[k]);
|
|
|
+ Object.keys(checkedPacks).forEach((k) => delete checkedPacks[k]);
|
|
|
Object.keys(checkedSkills).forEach((k) => delete checkedSkills[k]);
|
|
|
// 不勾 = 不限制(与后端 null 口径一致)
|
|
|
const groups = props.record?.toolGroups || [];
|
|
|
groups.forEach((g) => (checkedGroups[g] = true));
|
|
|
const names = props.record?.skillNames || [];
|
|
|
names.forEach((n) => (checkedSkills[n] = true));
|
|
|
+ const packIds = props.record?.toolPackIds || [];
|
|
|
+ packIds.forEach((id) => (checkedPacks[id] = true));
|
|
|
}
|
|
|
|
|
|
/** 从工具清单聚合业务组(保持 TOOL_GROUP_KEYS 顺序,缺失的组用静态标签兜底) */
|
|
|
async function loadOptions() {
|
|
|
toolsLoading.value = true;
|
|
|
skillsLoading.value = true;
|
|
|
+ packsLoading.value = true;
|
|
|
try {
|
|
|
- const [tools, skillList] = await Promise.all([
|
|
|
+ const [tools, skillList, packList] = await Promise.all([
|
|
|
capabilityApi.listTools().catch(() => [] as any[]),
|
|
|
capabilityApi.listSkills().catch(() => [] as Skill[]),
|
|
|
+ toolPackApi.listToolPacks().catch(() => [] as ToolPack[]),
|
|
|
]);
|
|
|
const countBy = new Map<string, { count: number; desc: string }>();
|
|
|
for (const t of tools || []) {
|
|
|
@@ -232,9 +368,11 @@
|
|
|
}));
|
|
|
// 白名单只对用户技能目录生效:repo 来源是只读技能,不参与勾选
|
|
|
skills.value = (skillList || []).filter((s) => s.source === 'user');
|
|
|
+ packs.value = packList || [];
|
|
|
} finally {
|
|
|
toolsLoading.value = false;
|
|
|
skillsLoading.value = false;
|
|
|
+ packsLoading.value = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -248,21 +386,41 @@
|
|
|
sysPrompt: props.record?.sysPrompt || '',
|
|
|
});
|
|
|
resetChecks();
|
|
|
+ skillKeyword.value = '';
|
|
|
formRef.value?.clearValidate?.();
|
|
|
void loadOptions();
|
|
|
},
|
|
|
);
|
|
|
|
|
|
const pickedGroups = computed(() => TOOL_GROUP_KEYS.filter((g) => checkedGroups[g]));
|
|
|
+ const pickedPackIds = computed(() => packs.value.map((p) => p.id).filter((id) => checkedPacks[id]));
|
|
|
+
|
|
|
+ /** 摘要条 chip 显示工具包名(id → 名) */
|
|
|
+ function packName(id: string) {
|
|
|
+ return packs.value.find((p) => p.id === id)?.name || id;
|
|
|
+ }
|
|
|
+
|
|
|
+ function clearPacks() {
|
|
|
+ pickedPackIds.value.forEach((id) => delete checkedPacks[id]);
|
|
|
+ }
|
|
|
const pickedSkills = computed(() => skills.value.map((s) => s.name).filter((n) => checkedSkills[n]));
|
|
|
|
|
|
+ /** 摘要条「清空」:取消该区全部勾选(回到不限制),与逐个取消完全等价 */
|
|
|
+ function clearGroups() {
|
|
|
+ pickedGroups.value.forEach((g) => delete checkedGroups[g]);
|
|
|
+ }
|
|
|
+
|
|
|
+ function clearSkills() {
|
|
|
+ pickedSkills.value.forEach((n) => delete checkedSkills[n]);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
- * 技能编辑器(弹窗内的「添加技能 / 修改技能」子面板)。
|
|
|
- * 新建/修改都直接写当前用户的技能目录,与专家是否保存无关。
|
|
|
+ * 技能编辑器(「修改技能」子面板;新建技能在「插件与技能」页进行)。
|
|
|
+ * 修改直接写当前用户的技能目录,与研判方案是否保存无关。
|
|
|
*/
|
|
|
const skillEditor = reactive({
|
|
|
open: false,
|
|
|
- /** 正在修改的技能名;null = 新建 */
|
|
|
+ /** 正在修改的技能名 */
|
|
|
editing: null as string | null,
|
|
|
name: '',
|
|
|
description: '',
|
|
|
@@ -273,13 +431,13 @@
|
|
|
/** 与后端 SkillStore.NAME_PATTERN 对齐:中英文/数字/._-,1~64 */
|
|
|
const SKILL_NAME_RE = /^[一-龥A-Za-z0-9._-]{1,64}$/;
|
|
|
|
|
|
- function openSkillEditor(skill: Skill | null) {
|
|
|
+ function openSkillEditor(skill: Skill) {
|
|
|
skillEditor.open = true;
|
|
|
- skillEditor.editing = skill?.name || null;
|
|
|
- skillEditor.name = skill?.name || '';
|
|
|
- skillEditor.description = skill?.description || '';
|
|
|
+ skillEditor.editing = skill.name;
|
|
|
+ skillEditor.name = skill.name;
|
|
|
+ skillEditor.description = skill.description || '';
|
|
|
skillEditor.content = '';
|
|
|
- if (skill) void prefillSkill(skill.name);
|
|
|
+ void prefillSkill(skill.name);
|
|
|
}
|
|
|
|
|
|
function closeSkillEditor() {
|
|
|
@@ -374,6 +532,7 @@
|
|
|
sysPrompt: form.sysPrompt.trim(),
|
|
|
toolGroups: pickedGroups.value,
|
|
|
skillNames: pickedSkills.value,
|
|
|
+ toolPackIds: pickedPackIds.value,
|
|
|
};
|
|
|
submitting.value = true;
|
|
|
try {
|
|
|
@@ -394,116 +553,392 @@
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
- .ai-expert-form {
|
|
|
- &__hint {
|
|
|
- margin-bottom: 8px;
|
|
|
- font-size: 12px;
|
|
|
- line-height: 1.7;
|
|
|
+ .ae-form {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: var(--ai-sp-3);
|
|
|
+
|
|
|
+ &__sub {
|
|
|
+ margin: 0;
|
|
|
+ font-size: 12.5px;
|
|
|
color: var(--ai-text-2);
|
|
|
}
|
|
|
|
|
|
- &__checks {
|
|
|
+ &__form {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
- gap: 8px;
|
|
|
- max-height: 220px;
|
|
|
- overflow-y: auto;
|
|
|
- padding: 2px;
|
|
|
+ gap: var(--ai-sp-3);
|
|
|
+ min-height: 0;
|
|
|
}
|
|
|
|
|
|
- &__check {
|
|
|
- padding: 6px 8px;
|
|
|
+ /* ── 面板(白卡) ── */
|
|
|
+ &__panel {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: var(--ai-sp-3);
|
|
|
+ padding: 16px 20px 20px;
|
|
|
+ background: var(--ai-bg-card, #fff);
|
|
|
border: 1px solid var(--ai-border);
|
|
|
- border-radius: 8px;
|
|
|
- cursor: pointer;
|
|
|
+ border-radius: var(--ai-radius-lg);
|
|
|
+ flex: 0 0 auto;
|
|
|
+ }
|
|
|
|
|
|
- &:hover {
|
|
|
- background: var(--ai-bg-hover);
|
|
|
+ /* 基本信息:左标签 + 控件行(行距 12 gap + 8 margin = 20) */
|
|
|
+ &__row {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-start;
|
|
|
+ gap: 16px;
|
|
|
+
|
|
|
+ & + .ae-form__row {
|
|
|
+ margin-top: 8px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- &__count {
|
|
|
- margin-left: 6px;
|
|
|
- font-size: 11px;
|
|
|
- color: var(--ai-text-2);
|
|
|
+ &__label {
|
|
|
+ flex: 0 0 auto;
|
|
|
+ width: 96px;
|
|
|
+ padding-top: 8px;
|
|
|
+ font-size: 13px;
|
|
|
+ font-weight: 500;
|
|
|
+ color: var(--ai-text);
|
|
|
+ text-align: right;
|
|
|
}
|
|
|
|
|
|
- &__check-desc {
|
|
|
- margin-top: 2px;
|
|
|
- padding-left: 22px;
|
|
|
- font-size: 11.5px;
|
|
|
- line-height: 1.6;
|
|
|
- color: var(--ai-text-2);
|
|
|
+ &__req {
|
|
|
+ margin-right: 3px;
|
|
|
+ font-style: normal;
|
|
|
+ color: #cf222e;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__control {
|
|
|
+ flex: 1 1 auto;
|
|
|
+ min-width: 0;
|
|
|
+ max-width: 380px;
|
|
|
+
|
|
|
+ &--full {
|
|
|
+ max-width: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ant-input:focus,
|
|
|
+ .ant-input-focused {
|
|
|
+ border-color: var(--ai-primary);
|
|
|
+ box-shadow: 0 0 0 3px var(--ai-primary-soft);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ &__textarea-wrap {
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .ant-textarea {
|
|
|
+ padding-bottom: 24px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ant-input:focus,
|
|
|
+ .ant-textarea-focused {
|
|
|
+ border-color: var(--ai-primary);
|
|
|
+ box-shadow: 0 0 0 3px var(--ai-primary-soft);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ &__counter {
|
|
|
+ position: absolute;
|
|
|
+ right: 12px;
|
|
|
+ bottom: 8px;
|
|
|
+ font-size: 11px;
|
|
|
+ color: var(--ai-text-3, #9aa1ac);
|
|
|
+ pointer-events: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* ── 区块头 ── */
|
|
|
&__sec-head {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- margin-bottom: 4px;
|
|
|
+ gap: var(--ai-sp-3);
|
|
|
+ flex: 0 0 auto;
|
|
|
}
|
|
|
|
|
|
&__sec-title {
|
|
|
- font-size: 14px;
|
|
|
- font-weight: 600;
|
|
|
+ font-size: 15px;
|
|
|
+ font-weight: 700;
|
|
|
+ letter-spacing: 0.01em;
|
|
|
color: var(--ai-text);
|
|
|
}
|
|
|
|
|
|
- &__skill-row {
|
|
|
+ &__count {
|
|
|
+ padding: 2px 10px;
|
|
|
+ font-size: 11.5px;
|
|
|
+ font-weight: 500;
|
|
|
+ color: var(--ai-text-2);
|
|
|
+ background: var(--ai-bg-subtle);
|
|
|
+ border-radius: 99px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__hint {
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 1.7;
|
|
|
+ color: var(--ai-text-2);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 技能名称搜索 */
|
|
|
+ &__search {
|
|
|
display: flex;
|
|
|
- align-items: flex-start;
|
|
|
- gap: 6px;
|
|
|
+ align-items: center;
|
|
|
+ gap: 8px;
|
|
|
+ width: 240px;
|
|
|
+ height: 32px;
|
|
|
+ padding: 0 11px;
|
|
|
+ color: var(--ai-text-3, #9aa1ac);
|
|
|
+ background: var(--ai-bg-card, #fff);
|
|
|
+ border: 1px solid var(--ai-border-strong, #d0d7de);
|
|
|
+ border-radius: var(--ai-radius);
|
|
|
+ cursor: text;
|
|
|
+ transition:
|
|
|
+ border-color 0.15s ease,
|
|
|
+ box-shadow 0.15s ease;
|
|
|
+
|
|
|
+ &:focus-within {
|
|
|
+ border-color: var(--ai-primary);
|
|
|
+ box-shadow: 0 0 0 3px var(--ai-primary-soft);
|
|
|
+ }
|
|
|
|
|
|
- .ai-expert-form__check {
|
|
|
+ input {
|
|
|
flex: 1;
|
|
|
min-width: 0;
|
|
|
+ font-size: 12.5px;
|
|
|
+ font-family: inherit;
|
|
|
+ color: var(--ai-text);
|
|
|
+ background: transparent;
|
|
|
+ border: none;
|
|
|
+ outline: none;
|
|
|
+
|
|
|
+ &::placeholder {
|
|
|
+ color: var(--ai-text-3, #9aa1ac);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- &__skill-edit {
|
|
|
- flex: 0 0 auto;
|
|
|
+ /* ── 可选卡片网格 ── */
|
|
|
+ &__grid {
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
|
+ gap: var(--ai-sp-3);
|
|
|
+ }
|
|
|
+
|
|
|
+ &__card {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: 8px;
|
|
|
+ padding: 14px;
|
|
|
+ background: var(--ai-bg-card, #fff);
|
|
|
+ border: 1px solid var(--ai-border);
|
|
|
+ border-radius: var(--ai-radius);
|
|
|
+ cursor: pointer;
|
|
|
+ transition:
|
|
|
+ box-shadow 0.15s ease,
|
|
|
+ transform 0.15s ease,
|
|
|
+ border-color 0.15s ease,
|
|
|
+ background 0.15s ease;
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ box-shadow: var(--ai-shadow, 0 2px 8px rgba(27, 31, 36, 0.08));
|
|
|
+ transform: translateY(-1px);
|
|
|
+ }
|
|
|
+
|
|
|
+ &.is-on {
|
|
|
+ border-color: var(--ai-primary);
|
|
|
+ background: fade(@primary-color, 3%);
|
|
|
+
|
|
|
+ .ae-form__ck {
|
|
|
+ color: #fff;
|
|
|
+ background: var(--ai-primary);
|
|
|
+ border-color: var(--ai-primary);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 右上角勾选圈 */
|
|
|
+ &__ck {
|
|
|
+ position: absolute;
|
|
|
+ top: 12px;
|
|
|
+ right: 12px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
+ color: transparent;
|
|
|
+ background: var(--ai-bg-card, #fff);
|
|
|
+ border: 1.5px solid var(--ai-border-strong, #d0d7de);
|
|
|
+ border-radius: 50%;
|
|
|
+ transition:
|
|
|
+ background 0.15s ease,
|
|
|
+ border-color 0.15s ease;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__card-name {
|
|
|
+ overflow: hidden;
|
|
|
+ padding-right: 24px;
|
|
|
+ font-size: 13.5px;
|
|
|
+ font-weight: 700;
|
|
|
+ letter-spacing: 0.01em;
|
|
|
+ color: var(--ai-text);
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__card-desc {
|
|
|
+ margin: 0;
|
|
|
+ min-height: 34px;
|
|
|
+ font-size: 12.25px;
|
|
|
+ line-height: 1.6;
|
|
|
+ color: var(--ai-text-2);
|
|
|
+ display: -webkit-box;
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__chips {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ gap: 6px;
|
|
|
+
|
|
|
+ span {
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 1px 8px;
|
|
|
+ font-size: 11px;
|
|
|
+ color: var(--ai-text-2);
|
|
|
+ background: var(--ai-bg-subtle);
|
|
|
+ border-radius: 99px;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ &__card-ops {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: var(--ai-sp-1);
|
|
|
+ padding-top: 8px;
|
|
|
+ margin-top: auto;
|
|
|
+ border-top: 1px solid var(--ai-border);
|
|
|
+ }
|
|
|
+
|
|
|
+ &__iconbtn {
|
|
|
display: inline-flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
width: 26px;
|
|
|
height: 26px;
|
|
|
- margin-top: 4px;
|
|
|
padding: 0;
|
|
|
- border: 1px solid transparent;
|
|
|
- border-radius: 6px;
|
|
|
- background: transparent;
|
|
|
color: var(--ai-text-2);
|
|
|
+ background: transparent;
|
|
|
+ border: none;
|
|
|
+ border-radius: 6px;
|
|
|
cursor: pointer;
|
|
|
- transition: all 0.15s;
|
|
|
+ transition:
|
|
|
+ color 0.15s ease,
|
|
|
+ background 0.15s ease;
|
|
|
|
|
|
&:hover {
|
|
|
- border-color: var(--ai-border);
|
|
|
- background: var(--ai-bg-hover);
|
|
|
color: var(--ai-primary);
|
|
|
+ background: var(--ai-bg-subtle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /* ── 已选摘要条 ── */
|
|
|
+ &__selbar {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ gap: 6px;
|
|
|
+ padding-top: 12px;
|
|
|
+ border-top: 1px solid var(--ai-border);
|
|
|
+ }
|
|
|
+
|
|
|
+ &__sel-label {
|
|
|
+ font-size: 12.5px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: var(--ai-text);
|
|
|
+ }
|
|
|
+
|
|
|
+ &__sel-chip {
|
|
|
+ padding: 1px 10px;
|
|
|
+ font-size: 11.5px;
|
|
|
+ font-weight: 500;
|
|
|
+ color: var(--ai-primary);
|
|
|
+ background: var(--ai-primary-soft);
|
|
|
+ border-radius: 99px;
|
|
|
+ max-width: 240px;
|
|
|
+ overflow: hidden;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__clear {
|
|
|
+ padding: 4px 8px;
|
|
|
+ font-size: 12px;
|
|
|
+ font-family: inherit;
|
|
|
+ color: var(--ai-text-2);
|
|
|
+ background: none;
|
|
|
+ border: none;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ color: #cf222e;
|
|
|
+ background: rgba(207, 34, 46, 0.06);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- &__skill-editor {
|
|
|
+ /* ── 技能编辑器子面板 ── */
|
|
|
+ &__seditor {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
gap: 8px;
|
|
|
- margin-bottom: 10px;
|
|
|
- padding: 10px;
|
|
|
+ padding: 12px;
|
|
|
+ background: var(--ai-bg-subtle);
|
|
|
border: 1px solid var(--ai-primary);
|
|
|
- border-radius: 8px;
|
|
|
- background: var(--ai-bg-hover);
|
|
|
+ border-radius: var(--ai-radius);
|
|
|
}
|
|
|
|
|
|
- &__skill-editor-title {
|
|
|
+ &__seditor-title {
|
|
|
font-size: 12.5px;
|
|
|
font-weight: 600;
|
|
|
color: var(--ai-text);
|
|
|
}
|
|
|
|
|
|
- &__skill-editor-ops {
|
|
|
+ &__seditor-ops {
|
|
|
display: flex;
|
|
|
justify-content: flex-end;
|
|
|
gap: 8px;
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+ /*
|
|
|
+ * 全屏态补齐(弹框挂到 body 下,只能用全局样式):
|
|
|
+ * antd 弹框是 position:relative,BasicModal 的 fullscreen 规则里 top/bottom 拉不开高度,
|
|
|
+ * 内容矮于视口时底部会露一条遮罩 —— 这里在「专属类名 + 全屏态」下显式补高度,
|
|
|
+ * 正文区改 flex 占满并内部滚动;组件内 bodyStyle 的限高只在还原为窗口态时生效。
|
|
|
+ */
|
|
|
+ .ae-agent-modal.fullscreen-modal .ant-modal {
|
|
|
+ height: 100% !important;
|
|
|
+ margin: 0 !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ae-agent-modal.fullscreen-modal .ant-modal-content {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ae-agent-modal.fullscreen-modal .ant-modal-body {
|
|
|
+ flex: 1 1 auto;
|
|
|
+ min-height: 0;
|
|
|
+ max-height: none !important;
|
|
|
+ overflow-y: auto !important;
|
|
|
+ }
|
|
|
+</style>
|