|
|
@@ -125,23 +125,23 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- Categories Tab -->
|
|
|
+ <!-- 知识分类 Tab -->
|
|
|
<div v-if="activeTab === 'categories'" class="section">
|
|
|
<div class="category-grid">
|
|
|
- <div v-for="category in filteredCategories" :key="category.id"
|
|
|
+ <div v-for="category in categories" :key="category.id"
|
|
|
class="category-card"
|
|
|
@click="openCategory(category)">
|
|
|
- <div class="category-header">
|
|
|
+ <!-- <div class="category-header">
|
|
|
<div class="category-icon" :style="{ background: category.iconBg }">{{ category.icon }}</div>
|
|
|
<div class="category-badge" v-if="category.trending">
|
|
|
<i class="fas fa-fire"></i> 热门
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<div class="category-name">{{ category.name }}</div>
|
|
|
<div class="category-desc">{{ category.description }}</div>
|
|
|
<div class="category-stats">
|
|
|
<div class="category-stat">
|
|
|
- <span class="stat-value">{{ category.count }}</span>
|
|
|
+ <span class="stat-value">{{ category.document_count }}</span>
|
|
|
<span class="stat-label">知识点</span>
|
|
|
</div>
|
|
|
<div class="category-stat">
|
|
|
@@ -154,31 +154,31 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="category-footer">
|
|
|
- <span class="update-time">更新于 {{ category.updatedAt }}</span>
|
|
|
+ <span class="update-time">更新于 {{ category.timeip }}</span>
|
|
|
<i class="fas fa-chevron-right"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- All Knowledge Tab -->
|
|
|
+ <!-- 全部知识 Tab -->
|
|
|
<div v-if="activeTab === 'all'" class="section">
|
|
|
<div class="knowledge-list">
|
|
|
- <div v-for="item in filteredKnowledge" :key="item.id"
|
|
|
+ <div v-for="item in knowledgeList" :key="item.id"
|
|
|
class="knowledge-card"
|
|
|
@click="showKnowledgeDetail(item)">
|
|
|
- <div class="knowledge-icon" :style="{ background: item.iconBg }">{{ item.icon }}</div>
|
|
|
+ <!-- <div class="knowledge-icon" :style="{ background: item.iconBg }">{{ item.icon }}</div> -->
|
|
|
<div class="knowledge-content">
|
|
|
<div class="knowledge-header">
|
|
|
- <div class="knowledge-question">{{ item.question }}</div>
|
|
|
- <span class="knowledge-category" :style="{ background: item.iconBg }">{{ item.categoryName }}</span>
|
|
|
+ <div class="knowledge-question">{{ item.name }}</div>
|
|
|
+ <!-- <span class="knowledge-category" :style="{ background: item.iconBg }">{{ item.categoryName }}</span> -->
|
|
|
</div>
|
|
|
- <div class="knowledge-answer">{{ item.answer }}</div>
|
|
|
+ <!-- <div class="knowledge-answer">{{ item.answer }}</div>
|
|
|
<div class="knowledge-meta">
|
|
|
<span><i class="fas fa-eye"></i> {{ item.views }}次查看</span>
|
|
|
<span><i class="fas fa-thumbs-up"></i> {{ item.likes }}次好评</span>
|
|
|
<span><i class="fas fa-clock"></i> {{ item.time }}</span>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</div>
|
|
|
<div class="knowledge-actions" @click.stop>
|
|
|
<button class="btn btn-secondary btn-sm" @click="editKnowledge(item)">
|
|
|
@@ -192,7 +192,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- Q&A Records Tab -->
|
|
|
+ <!-- 问答记录 Tab -->
|
|
|
<div v-if="activeTab === 'qa'" class="section">
|
|
|
<div class="qa-section">
|
|
|
<div class="qa-header">
|
|
|
@@ -241,7 +241,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- Training Tab -->
|
|
|
+ <!-- AI训练 Tab -->
|
|
|
<div v-if="activeTab === 'training'" class="section">
|
|
|
<div class="training-section">
|
|
|
<div class="training-header">
|
|
|
@@ -283,7 +283,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- Settings Tab -->
|
|
|
+ <!-- 设置 Tab -->
|
|
|
<div v-if="activeTab === 'settings'" class="section">
|
|
|
<div class="settings-section">
|
|
|
<div class="settings-card">
|
|
|
@@ -441,7 +441,7 @@
|
|
|
</div>
|
|
|
<div class="detail-stat">
|
|
|
<i class="fas fa-clock"></i>
|
|
|
- <span>更新于 {{ selectedKnowledge.time }}</span>
|
|
|
+ <span>更新于 {{ selectedKnowledge.timeip }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -499,6 +499,8 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, computed } from 'vue'
|
|
|
+import { knowledgeDatasets,knowledgeDocuments } from '../api/knowledge'
|
|
|
+import { formatTimeAgo } from '@/utils/time'
|
|
|
|
|
|
const showAddModal = ref(false)
|
|
|
const showDetailModal = ref(false)
|
|
|
@@ -529,13 +531,13 @@ const syncStatus = {
|
|
|
lastSync: '2天前'
|
|
|
}
|
|
|
|
|
|
-const tabs = [
|
|
|
- { key: 'categories', label: '知识分类', count: 12, icon: 'fas fa-folder' },
|
|
|
- { key: 'all', label: '全部知识', count: 1247, icon: 'fas fa-book' },
|
|
|
- { key: 'qa', label: '问答记录', count: 356, icon: 'fas fa-comments' },
|
|
|
- { key: 'training', label: 'AI 训练', count: 3, icon: 'fas fa-dumbbell' },
|
|
|
+const tabs = ref([
|
|
|
+ { key: 'categories', label: '知识分类', count: 0, icon: 'fas fa-folder' },
|
|
|
+ { key: 'all', label: '全部知识', count: 0, icon: 'fas fa-book' },
|
|
|
+ { key: 'qa', label: '问答记录', count: 0, icon: 'fas fa-comments' },
|
|
|
+ { key: 'training', label: 'AI 训练', count: 0, icon: 'fas fa-dumbbell' },
|
|
|
{ key: 'settings', label: '设置', count: 0, icon: 'fas fa-cog' }
|
|
|
-]
|
|
|
+])
|
|
|
|
|
|
const newKnowledge = ref({
|
|
|
question: '',
|
|
|
@@ -545,25 +547,25 @@ const newKnowledge = ref({
|
|
|
relatedQuestions: ''
|
|
|
})
|
|
|
|
|
|
-const categories = ref([
|
|
|
- { id: 1, icon: '📦', iconBg: 'rgba(99, 102, 241, 0.2)', name: '产品知识', description: '产品规格、型号、功能特性', count: 234, queries: 1256, accuracy: 96, trending: true, updatedAt: '2小时前' },
|
|
|
- { id: 2, icon: '💰', iconBg: 'rgba(16, 185, 129, 0.2)', name: '价格政策', description: '价格体系、折扣规则、付款条件', count: 156, queries: 892, accuracy: 98, trending: false, updatedAt: '昨天' },
|
|
|
- { id: 3, icon: '🚚', iconBg: 'rgba(245, 158, 11, 0.2)', name: '物流信息', description: '交期、运费、物流方式', count: 89, queries: 567, accuracy: 92, trending: false, updatedAt: '3天前' },
|
|
|
- { id: 4, icon: '📋', iconBg: 'rgba(139, 92, 246, 0.2)', name: '商务条款', description: '合同条款、质保政策、售后服务', count: 178, queries: 445, accuracy: 94, trending: false, updatedAt: '昨天' },
|
|
|
- { id: 5, icon: '🏭', iconBg: 'rgba(6, 182, 212, 0.2)', name: '行业知识', description: '行业趋势、技术标准、认证信息', count: 245, queries: 334, accuracy: 88, trending: true, updatedAt: '1周前' },
|
|
|
- { id: 6, icon: '🌍', iconBg: 'rgba(236, 72, 153, 0.2)', name: '市场信息', description: '市场行情、竞争对手、客户案例', count: 167, queries: 289, accuracy: 85, trending: false, updatedAt: '5天前' },
|
|
|
- { id: 7, icon: '🔧', iconBg: 'rgba(59, 130, 246, 0.2)', name: '技术参数', description: '技术规格、性能指标、兼容性', count: 98, queries: 456, accuracy: 97, trending: false, updatedAt: '2天前' },
|
|
|
- { id: 8, icon: '❓', iconBg: 'rgba(148, 163, 184, 0.2)', name: '常见问题', description: '客户高频问题及标准回答', count: 80, queries: 1234, accuracy: 95, trending: true, updatedAt: '今天' }
|
|
|
-])
|
|
|
-
|
|
|
-const knowledgeList = ref([
|
|
|
- { id: 1, icon: '📦', iconBg: 'rgba(99, 102, 241, 0.2)', categoryName: '产品知识', question: 'MOQ最小起订量是多少?', answer: '标准产品MOQ为50件,定制产品MOQ为100件,具体视产品类型而定。', extendedAnswer: '对于常规库存产品,我们接受最低50件起订。定制产品由于需要单独开模和生产准备,最低起订量为100件。大客户可享受更灵活的起订量政策,请联系销售经理协商。', tags: ['MOQ', '起订量', '订单'], relatedQuestions: ['可以降低起订量吗?', '首单有优惠吗?'], views: 1234, likes: 89, time: '2小时前' },
|
|
|
- { id: 2, icon: '🚚', iconBg: 'rgba(245, 158, 11, 0.2)', categoryName: '物流信息', question: '交期一般是多久?', answer: '常规产品15-20天,定制产品30-45天,加急订单可缩短至7天。', extendedAnswer: '标准产品通常有库存,交期15-20个工作日。定制产品需要根据复杂程度评估,一般为30-45天。如有紧急需求,我们提供加急服务,最快可7天交货,但需收取10-20%的加急费用。', tags: ['交期', '发货', '物流'], relatedQuestions: ['可以加急吗?', '运费谁承担?'], views: 987, likes: 67, time: '昨天' },
|
|
|
- { id: 3, icon: '💰', iconBg: 'rgba(16, 185, 129, 0.2)', categoryName: '价格政策', question: '付款方式有哪些?', answer: '支持T/T、L/C、PayPal等多种付款方式,新客户首单建议30%预付款。', extendedAnswer: '我们接受电汇(T/T)、信用证(L/C)、PayPal、西联汇款等付款方式。对于老客户可提供月结30天账期。新客户首单建议预付30%,发货前付清尾款。大额订单可协商分期付款。', tags: ['付款', 'T/T', '信用证'], relatedQuestions: ['可以月结吗?', '支持什么货币?'], views: 876, likes: 54, time: '2天前' },
|
|
|
- { id: 4, icon: '🔧', iconBg: 'rgba(59, 130, 246, 0.2)', categoryName: '技术参数', question: 'SSD的使用寿命是多久?', answer: '企业级SSD设计寿命为5-10年,写入寿命(TBW)根据容量不同。', extendedAnswer: '我们的企业级SSD采用高耐久性NAND闪存,设计寿命5-10年。1TB型号TBW为600TB,2TB型号为1200TB。在正常工作负载下,可稳定运行超过200万小时(MTBF)。', tags: ['SSD', '寿命', 'TBW'], relatedQuestions: ['如何查看剩余寿命?', '保修期多久?'], views: 654, likes: 45, time: '3天前' },
|
|
|
- { id: 5, icon: '📋', iconBg: 'rgba(139, 92, 246, 0.2)', categoryName: '商务条款', question: '质保期是多久?', answer: '标准产品提供3年质保,企业级产品提供5年质保。', extendedAnswer: '消费级产品提供3年有限质保,企业级产品提供5年质保服务。质保期内非人为损坏可免费更换。我们提供全球联保服务,无论在哪购买均可享受本地化售后服务。', tags: ['质保', '售后', '保修'], relatedQuestions: ['质保包括哪些?', '如何申请保修?'], views: 543, likes: 38, time: '4天前' },
|
|
|
- { id: 6, icon: '🏭', iconBg: 'rgba(6, 182, 212, 0.2)', categoryName: '行业知识', question: 'NVMe和SATA有什么区别?', answer: 'NVMe采用PCIe通道,速度更快延迟更低,适合高性能应用。', extendedAnswer: 'NVMe SSD通过PCIe总线直接与CPU通信,理论带宽可达32GB/s,延迟极低。SATA SSD受限于SATA接口,最大速度约600MB/s。对于需要高IOPS的应用场景,NVMe是更好的选择。', tags: ['NVMe', 'SATA', '技术'], relatedQuestions: ['如何选择接口?', '兼容性如何?'], views: 432, likes: 34, time: '5天前' }
|
|
|
-])
|
|
|
+// const categories = ref([
|
|
|
+// { id: 1, icon: '📦', iconBg: 'rgba(99, 102, 241, 0.2)', name: '产品知识', description: '产品规格、型号、功能特性', count: 234, queries: 1256, accuracy: 96, trending: true, updatedAt: '2小时前' },
|
|
|
+// { id: 2, icon: '💰', iconBg: 'rgba(16, 185, 129, 0.2)', name: '价格政策', description: '价格体系、折扣规则、付款条件', count: 156, queries: 892, accuracy: 98, trending: false, updatedAt: '昨天' },
|
|
|
+// { id: 3, icon: '🚚', iconBg: 'rgba(245, 158, 11, 0.2)', name: '物流信息', description: '交期、运费、物流方式', count: 89, queries: 567, accuracy: 92, trending: false, updatedAt: '3天前' },
|
|
|
+// { id: 4, icon: '📋', iconBg: 'rgba(139, 92, 246, 0.2)', name: '商务条款', description: '合同条款、质保政策、售后服务', count: 178, queries: 445, accuracy: 94, trending: false, updatedAt: '昨天' },
|
|
|
+// { id: 5, icon: '🏭', iconBg: 'rgba(6, 182, 212, 0.2)', name: '行业知识', description: '行业趋势、技术标准、认证信息', count: 245, queries: 334, accuracy: 88, trending: true, updatedAt: '1周前' },
|
|
|
+// { id: 6, icon: '🌍', iconBg: 'rgba(236, 72, 153, 0.2)', name: '市场信息', description: '市场行情、竞争对手、客户案例', count: 167, queries: 289, accuracy: 85, trending: false, updatedAt: '5天前' },
|
|
|
+// { id: 7, icon: '🔧', iconBg: 'rgba(59, 130, 246, 0.2)', name: '技术参数', description: '技术规格、性能指标、兼容性', count: 98, queries: 456, accuracy: 97, trending: false, updatedAt: '2天前' },
|
|
|
+// { id: 8, icon: '❓', iconBg: 'rgba(148, 163, 184, 0.2)', name: '常见问题', description: '客户高频问题及标准回答', count: 80, queries: 1234, accuracy: 95, trending: true, updatedAt: '今天' }
|
|
|
+// ])
|
|
|
+
|
|
|
+// const knowledgeList = ref([
|
|
|
+// { id: 1, icon: '📦', iconBg: 'rgba(99, 102, 241, 0.2)', categoryName: '产品知识', question: 'MOQ最小起订量是多少?', answer: '标准产品MOQ为50件,定制产品MOQ为100件,具体视产品类型而定。', extendedAnswer: '对于常规库存产品,我们接受最低50件起订。定制产品由于需要单独开模和生产准备,最低起订量为100件。大客户可享受更灵活的起订量政策,请联系销售经理协商。', tags: ['MOQ', '起订量', '订单'], relatedQuestions: ['可以降低起订量吗?', '首单有优惠吗?'], views: 1234, likes: 89, time: '2小时前' },
|
|
|
+// { id: 2, icon: '🚚', iconBg: 'rgba(245, 158, 11, 0.2)', categoryName: '物流信息', question: '交期一般是多久?', answer: '常规产品15-20天,定制产品30-45天,加急订单可缩短至7天。', extendedAnswer: '标准产品通常有库存,交期15-20个工作日。定制产品需要根据复杂程度评估,一般为30-45天。如有紧急需求,我们提供加急服务,最快可7天交货,但需收取10-20%的加急费用。', tags: ['交期', '发货', '物流'], relatedQuestions: ['可以加急吗?', '运费谁承担?'], views: 987, likes: 67, time: '昨天' },
|
|
|
+// { id: 3, icon: '💰', iconBg: 'rgba(16, 185, 129, 0.2)', categoryName: '价格政策', question: '付款方式有哪些?', answer: '支持T/T、L/C、PayPal等多种付款方式,新客户首单建议30%预付款。', extendedAnswer: '我们接受电汇(T/T)、信用证(L/C)、PayPal、西联汇款等付款方式。对于老客户可提供月结30天账期。新客户首单建议预付30%,发货前付清尾款。大额订单可协商分期付款。', tags: ['付款', 'T/T', '信用证'], relatedQuestions: ['可以月结吗?', '支持什么货币?'], views: 876, likes: 54, time: '2天前' },
|
|
|
+// { id: 4, icon: '🔧', iconBg: 'rgba(59, 130, 246, 0.2)', categoryName: '技术参数', question: 'SSD的使用寿命是多久?', answer: '企业级SSD设计寿命为5-10年,写入寿命(TBW)根据容量不同。', extendedAnswer: '我们的企业级SSD采用高耐久性NAND闪存,设计寿命5-10年。1TB型号TBW为600TB,2TB型号为1200TB。在正常工作负载下,可稳定运行超过200万小时(MTBF)。', tags: ['SSD', '寿命', 'TBW'], relatedQuestions: ['如何查看剩余寿命?', '保修期多久?'], views: 654, likes: 45, time: '3天前' },
|
|
|
+// { id: 5, icon: '📋', iconBg: 'rgba(139, 92, 246, 0.2)', categoryName: '商务条款', question: '质保期是多久?', answer: '标准产品提供3年质保,企业级产品提供5年质保。', extendedAnswer: '消费级产品提供3年有限质保,企业级产品提供5年质保服务。质保期内非人为损坏可免费更换。我们提供全球联保服务,无论在哪购买均可享受本地化售后服务。', tags: ['质保', '售后', '保修'], relatedQuestions: ['质保包括哪些?', '如何申请保修?'], views: 543, likes: 38, time: '4天前' },
|
|
|
+// { id: 6, icon: '🏭', iconBg: 'rgba(6, 182, 212, 0.2)', categoryName: '行业知识', question: 'NVMe和SATA有什么区别?', answer: 'NVMe采用PCIe通道,速度更快延迟更低,适合高性能应用。', extendedAnswer: 'NVMe SSD通过PCIe总线直接与CPU通信,理论带宽可达32GB/s,延迟极低。SATA SSD受限于SATA接口,最大速度约600MB/s。对于需要高IOPS的应用场景,NVMe是更好的选择。', tags: ['NVMe', 'SATA', '技术'], relatedQuestions: ['如何选择接口?', '兼容性如何?'], views: 432, likes: 34, time: '5天前' }
|
|
|
+// ])
|
|
|
|
|
|
const qaRecords = ref([
|
|
|
{ id: 1, sourceType: 'customer', sourceLabel: '客户问答', question: '你们的NVMe SSD支持哪些接口?', answer: '我们提供M.2 2280、M.2 2242和U.2三种接口规格,支持PCIe 4.0 x4总线,向下兼容PCIe 3.0。', time: '10分钟前', rating: 'positive' },
|
|
|
@@ -579,19 +581,53 @@ const trainingTasks = ref([
|
|
|
{ id: 3, name: '客户问答优化', description: '基于历史问答记录优化回复准确性', status: 'paused', progress: 35, documents: 234, learned: 82 }
|
|
|
])
|
|
|
|
|
|
-const filteredCategories = computed(() => {
|
|
|
- if (!searchQuery.value) return categories.value
|
|
|
- return categories.value.filter(c => c.name.includes(searchQuery.value) || c.description.includes(searchQuery.value))
|
|
|
-})
|
|
|
+const categories = ref([])
|
|
|
+// 获取知识分类
|
|
|
+const getKnowledgeDatasets = () => {
|
|
|
+ knowledgeDatasets({ pageIndex: 1, pageSize: 10 }).then(res => {
|
|
|
+ categories.value = res.result.data
|
|
|
+ res.result.data.forEach(el => {
|
|
|
+ el.timeip = formatTimeAgo(el.updated_at)
|
|
|
+ });
|
|
|
+ tabs.value[0].count = res.result.total
|
|
|
+ console.log('res :>> ', res);
|
|
|
+ })
|
|
|
+}
|
|
|
+getKnowledgeDatasets()
|
|
|
|
|
|
-const filteredKnowledge = computed(() => {
|
|
|
- if (!searchQuery.value) return knowledgeList.value
|
|
|
- return knowledgeList.value.filter(k =>
|
|
|
- k.question.includes(searchQuery.value) ||
|
|
|
- k.answer.includes(searchQuery.value) ||
|
|
|
- k.tags.some(t => t.includes(searchQuery.value))
|
|
|
- )
|
|
|
-})
|
|
|
+const knowledgeList = ref([])
|
|
|
+// 获取知识分类下的知识
|
|
|
+const documentsParams = ref({})
|
|
|
+const openCategory = (category) => {
|
|
|
+ activeTab.value = 'all'
|
|
|
+ searchQuery.value = category.name
|
|
|
+ showToastMessage(`正在加载 ${category.name} 分类...`, 'success')
|
|
|
+ documentsParams.value = {
|
|
|
+ pageIndex:1,
|
|
|
+ pageSize:10,
|
|
|
+ dataset_id:category.id
|
|
|
+ }
|
|
|
+ knowledgeDocuments(documentsParams.value).then(res => {
|
|
|
+ console.log(res.result.data)
|
|
|
+ knowledgeList.value = res.result.data
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// const filteredCategories = computed(() => {
|
|
|
+// if (!searchQuery.value) return categories.value
|
|
|
+// return categories.value.filter(c => c.name.includes(searchQuery.value) || c.description.includes(searchQuery.value))
|
|
|
+// })
|
|
|
+
|
|
|
+// const filteredKnowledge = computed(() => {
|
|
|
+// if (!searchQuery.value) return knowledgeList.value
|
|
|
+// return knowledgeList.value.filter(k =>
|
|
|
+// k.question.includes(searchQuery.value) ||
|
|
|
+// k.answer.includes(searchQuery.value) ||
|
|
|
+// k.tags.some(t => t.includes(searchQuery.value))
|
|
|
+// )
|
|
|
+// })
|
|
|
|
|
|
const filteredQA = computed(() => {
|
|
|
let result = qaRecords.value
|
|
|
@@ -608,11 +644,7 @@ const formatNumber = (num) => num.toLocaleString()
|
|
|
|
|
|
const getTaskStatusLabel = (status) => ({ running: '训练中', completed: '已完成', paused: '已暂停' }[status] || status)
|
|
|
|
|
|
-const openCategory = (category) => {
|
|
|
- activeTab.value = 'all'
|
|
|
- searchQuery.value = category.name
|
|
|
- showToastMessage(`正在加载 ${category.name} 分类...`, 'success')
|
|
|
-}
|
|
|
+
|
|
|
|
|
|
const showKnowledgeDetail = (item) => {
|
|
|
selectedKnowledge.value = item
|