feat: AI问答限定只答本站功能
- 前端发送全站工具清单(按分类,实时), 后端系统提示限定只答站内功能 - 范围外问题礼貌拒绝并引导站内工具 - About功能介绍同步 验证: 站内OCR问题正常答; 站外写代码被拒并引导 ✓ CHANGELOG记录
This commit is contained in:
1 parent
baa17ec08b
commit
e9a7dcac15
4 files changed
+37
-2
No files matched your search
@@ -1,12 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onUnmounted, ref } from 'vue';
|
||||
import { useHead } from '@vueuse/head';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { getMachineId, licenseHeaders } from '@/tools/license/license';
|
||||
import { useGenHistory } from '@/tools/gen-history/gen-history';
|
||||
import { useToolStore } from '@/tools/tools.store';
|
||||
|
||||
useHead({ title: 'AI 问答 - IT-TOOLS-PRO' });
|
||||
const genHist = useGenHistory('ai-chat');
|
||||
|
||||
// 站点功能清单:随请求发给后端,AI 只围绕本站功能作答(实时、随工具增减自动更新)
|
||||
const toolStore = useToolStore();
|
||||
const { toolsByCategory } = storeToRefs(toolStore);
|
||||
const toolCatalog = computed(() =>
|
||||
toolsByCategory.value
|
||||
.map(c => `${c.name}:${c.components.map(t => t.name).join('、')}`)
|
||||
.join('\n'),
|
||||
);
|
||||
|
||||
interface ChatMsg {
|
||||
role: 'user' | 'assistant';
|
||||
content: string;
|
||||
@@ -147,6 +158,7 @@ async function send(text?: string) {
|
||||
prompt: content,
|
||||
model: model.value,
|
||||
history: conv.messages.slice(0, -1).slice(-8),
|
||||
tools: toolCatalog.value,
|
||||
}),
|
||||
});
|
||||
const j = await res.json().catch(() => ({}));
|
||||
|
||||
Reference in new issue
Block a user