feat: Integrate Swiper library and enhance chat functionality
- Added Swiper library to package dependencies for improved UI components. - Updated chat API to include summary model ID in message handling, allowing for more flexible model selection. - Enhanced InputField component to manage model selection and state more effectively. - Improved event handling in chat components to support new model features and ensure accurate message processing. - Refactored SVG assets for better visual consistency and updated styles for improved user experience.
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<div class="popup-content">
|
||||
<div class="popup-content-wrapper">
|
||||
<div v-if="content" class="full-content" :class="{ 'html-content': isHtml }">
|
||||
<div v-if="isHtml" v-html="processedContent"></div>
|
||||
<template v-else>{{ content }}</template>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="hasInfo" class="info-section">
|
||||
<div v-if="chunkId" class="info-field">
|
||||
<span class="field-label">片段ID:</span>
|
||||
<span class="field-value"><code>{{ chunkId }}</code></span>
|
||||
</div>
|
||||
<div v-if="knowledgeId" class="info-field">
|
||||
<span class="field-label">文档ID:</span>
|
||||
<span class="field-value"><code>{{ knowledgeId }}</code></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { sanitizeHTML } from '@/utils/security';
|
||||
|
||||
interface Props {
|
||||
content?: string;
|
||||
chunkId?: string;
|
||||
knowledgeId?: string;
|
||||
isHtml?: boolean; // 是否以 HTML 格式显示内容
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const hasInfo = computed(() => {
|
||||
return !!(props.chunkId || props.knowledgeId);
|
||||
});
|
||||
|
||||
// 处理 HTML 内容
|
||||
const processedContent = computed(() => {
|
||||
if (!props.content) return '';
|
||||
if (props.isHtml) {
|
||||
return sanitizeHTML(props.content);
|
||||
}
|
||||
return props.content;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.popup-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 400px;
|
||||
max-width: 500px;
|
||||
border: 1px solid #07C05F;
|
||||
border-radius: 4px;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
overflow: hidden;
|
||||
|
||||
.popup-content-wrapper {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding: 12px;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.full-content {
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
line-height: 1.8;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
|
||||
&.html-content {
|
||||
white-space: normal;
|
||||
|
||||
:deep(p) {
|
||||
margin: 8px 0;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
:deep(br) {
|
||||
line-height: 1.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.info-section {
|
||||
flex-shrink: 0;
|
||||
padding: 8px 12px;
|
||||
border-top: 1px solid #e7e7e7;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.info-field {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 4px;
|
||||
font-size: 11px;
|
||||
|
||||
.field-label {
|
||||
color: #8b8b8b;
|
||||
min-width: 60px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.field-value {
|
||||
color: #666;
|
||||
flex: 1;
|
||||
|
||||
code {
|
||||
font-family: 'Monaco', 'Courier New', monospace;
|
||||
font-size: 10px;
|
||||
background: #f0f0f0;
|
||||
padding: 1px 4px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,25 +1,20 @@
|
||||
<template>
|
||||
<div class="plan-display">
|
||||
<div v-if="data.task" class="plan-task">
|
||||
<strong>任务:</strong> {{ data.task }}
|
||||
</div>
|
||||
|
||||
<div v-if="data.steps && data.steps.length > 0" class="plan-steps">
|
||||
<div class="steps-header">计划步骤 (共 {{ data.total_steps || data.steps.length }} 步):</div>
|
||||
<div v-for="(step, index) in data.steps" :key="step.id || index" class="step-item">
|
||||
<div class="step-header">
|
||||
<span class="step-number">{{ index + 1 }}.</span>
|
||||
<span class="step-status" :class="`status-${step.status}`">
|
||||
{{ getStatusEmoji(step.status) }}
|
||||
</span>
|
||||
<span class="step-status-text" :class="`status-${step.status}`">
|
||||
[{{ getStatusText(step.status) }}]
|
||||
</span>
|
||||
<span class="step-description">{{ step.description }}</span>
|
||||
</div>
|
||||
<div v-if="step.tools_to_use" class="step-tools">
|
||||
<span class="tools-label">工具:</span> {{ step.tools_to_use }}
|
||||
<div v-for="(step, index) in data.steps" :key="step.id || index" class="step-item" :class="`status-${step.status}`">
|
||||
<div class="step-checkbox" :class="{ 'checked': step.status === 'completed', 'in-progress': step.status === 'in_progress' }">
|
||||
<svg v-if="step.status === 'completed'" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
||||
<rect x="2" y="2" width="12" height="12" rx="2" fill="#07C05F"/>
|
||||
<path d="M5 8L7 10L11 6" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<svg v-else width="16" height="16" viewBox="0 0 16 16" fill="none">
|
||||
<rect x="2" y="2" width="12" height="12" rx="2" stroke="#d1d5db" stroke-width="1.5" fill="none"/>
|
||||
</svg>
|
||||
</div>
|
||||
<span class="step-description" :class="{ 'completed': step.status === 'completed' }">
|
||||
{{ step.description }}
|
||||
<span v-if="step.status === 'in_progress'" class="sparkle">✨</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +25,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import type { PlanData } from '@/types/tool-results';
|
||||
|
||||
interface Props {
|
||||
@@ -38,139 +32,95 @@ interface Props {
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const getStatusEmoji = (status: string): string => {
|
||||
const emojiMap: Record<string, string> = {
|
||||
pending: '⏳',
|
||||
in_progress: '🔄',
|
||||
completed: '✅',
|
||||
skipped: '⏭️'
|
||||
};
|
||||
return emojiMap[status] || '⏳';
|
||||
};
|
||||
|
||||
const getStatusText = (status: string): string => {
|
||||
const textMap: Record<string, string> = {
|
||||
pending: '待处理',
|
||||
in_progress: '进行中',
|
||||
completed: '已完成',
|
||||
skipped: '已跳过'
|
||||
};
|
||||
return textMap[status] || status;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.plan-display {
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
background: #f9fafb;
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.plan-task {
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
border-left: 3px solid #3b82f6;
|
||||
|
||||
strong {
|
||||
color: #1f2937;
|
||||
font-weight: 600;
|
||||
}
|
||||
color: #666;
|
||||
background: transparent;
|
||||
padding: 8px 0 8px 12px;
|
||||
margin: 0;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.plan-steps {
|
||||
.steps-header {
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
}
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.step-item {
|
||||
margin-bottom: 12px;
|
||||
padding: 10px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #e5e7eb;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
padding: 2px 0;
|
||||
transition: all 0.2s;
|
||||
|
||||
&:hover {
|
||||
border-color: #d1d5db;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.step-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.step-number {
|
||||
font-weight: 600;
|
||||
color: #6b7280;
|
||||
min-width: 20px;
|
||||
}
|
||||
|
||||
.step-status {
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.step-status-text {
|
||||
font-weight: 500;
|
||||
font-size: 12px;
|
||||
|
||||
&.status-pending {
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
&.status-in_progress {
|
||||
color: #3b82f6;
|
||||
.step-description {
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.step-checkbox {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
flex-shrink: 0;
|
||||
margin-top: 1px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&.checked {
|
||||
svg {
|
||||
rect {
|
||||
fill: #07C05F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.status-completed {
|
||||
color: #10b981;
|
||||
}
|
||||
|
||||
&.status-skipped {
|
||||
color: #9ca3af;
|
||||
&.in-progress {
|
||||
svg {
|
||||
rect {
|
||||
stroke: #07C05F;
|
||||
stroke-width: 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.step-description {
|
||||
flex: 1;
|
||||
color: #1f2937;
|
||||
color: #666;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.step-tools {
|
||||
margin-top: 6px;
|
||||
padding-left: 26px;
|
||||
font-size: 12px;
|
||||
color: #6b7280;
|
||||
font-size: 13px;
|
||||
|
||||
.tools-label {
|
||||
font-weight: 500;
|
||||
&.completed {
|
||||
text-decoration: line-through;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.sparkle {
|
||||
margin-left: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.no-steps {
|
||||
padding: 16px;
|
||||
padding: 8px 12px;
|
||||
text-align: center;
|
||||
color: #9ca3af;
|
||||
font-style: italic;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,46 +1,32 @@
|
||||
<template>
|
||||
<div class="related-chunks">
|
||||
<div class="info-section">
|
||||
<div class="info-field">
|
||||
<span class="field-label">参考片段:</span>
|
||||
<span class="field-value"><code>{{ data.chunk_id }}</code></span>
|
||||
</div>
|
||||
<div class="info-field">
|
||||
<span class="field-label">关系类型:</span>
|
||||
<span class="field-value">{{ relationTypeLabel }}</span>
|
||||
</div>
|
||||
<div class="info-field">
|
||||
<span class="field-label">相关片段数:</span>
|
||||
<span class="field-value">{{ data.count }} 个</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="data.chunks && data.chunks.length > 0" class="chunks-list">
|
||||
<div
|
||||
v-for="chunk in data.chunks"
|
||||
:key="chunk.chunk_id"
|
||||
class="result-card"
|
||||
class="result-item"
|
||||
>
|
||||
<div class="result-header" @click="toggleChunk(chunk.chunk_id)">
|
||||
<div class="result-title">
|
||||
<span class="chunk-index">片段 #{{ chunk.index }}</span>
|
||||
<span class="chunk-position">(位置: {{ chunk.chunk_index }})</span>
|
||||
<t-popup
|
||||
:overlayClassName="`chunk-popup-${chunk.chunk_id}`"
|
||||
placement="bottom-left"
|
||||
width="400"
|
||||
:showArrow="false"
|
||||
trigger="click"
|
||||
destroy-on-close
|
||||
>
|
||||
<template #content>
|
||||
<ContentPopup
|
||||
:content="chunk.content"
|
||||
:chunk-id="chunk.chunk_id"
|
||||
/>
|
||||
</template>
|
||||
<div class="result-header">
|
||||
<div class="result-title">
|
||||
<span class="chunk-index">片段 #{{ chunk.index }}</span>
|
||||
<span class="chunk-position">(位置: {{ chunk.chunk_index }})</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="expand-icon" :class="{ expanded: expandedChunks.includes(chunk.chunk_id) }">
|
||||
▶
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="result-content" :class="{ expanded: expandedChunks.includes(chunk.chunk_id) }">
|
||||
<div class="info-field">
|
||||
<span class="field-label">片段ID:</span>
|
||||
<span class="field-value"><code>{{ chunk.chunk_id }}</code></span>
|
||||
</div>
|
||||
<div class="info-section">
|
||||
<div class="info-section-title">内容</div>
|
||||
<div class="full-content">{{ chunk.content }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</t-popup>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -53,29 +39,12 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, defineProps, computed } from 'vue';
|
||||
import type { RelatedChunksData } from '@/types/tool-results';
|
||||
import ContentPopup from './ContentPopup.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
data: RelatedChunksData;
|
||||
}>();
|
||||
|
||||
const expandedChunks = ref<string[]>([]);
|
||||
|
||||
const relationTypeLabel = computed(() => {
|
||||
const labels: Record<string, string> = {
|
||||
'sequential': '顺序相关',
|
||||
'semantic': '语义相关',
|
||||
};
|
||||
return labels[props.data.relation_type] || props.data.relation_type;
|
||||
});
|
||||
|
||||
const toggleChunk = (chunkId: string) => {
|
||||
const index = expandedChunks.value.indexOf(chunkId);
|
||||
if (index > -1) {
|
||||
expandedChunks.value.splice(index, 1);
|
||||
} else {
|
||||
expandedChunks.value.push(chunkId);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@@ -84,26 +53,96 @@ const toggleChunk = (chunkId: string) => {
|
||||
.related-chunks {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
gap: 8px;
|
||||
padding: 0 0 0 12px;
|
||||
|
||||
.info-section {
|
||||
margin-bottom: 8px;
|
||||
padding: 0;
|
||||
|
||||
.info-field {
|
||||
font-size: 11px;
|
||||
margin-bottom: 4px;
|
||||
|
||||
.field-label {
|
||||
font-size: 11px;
|
||||
color: #8b8b8b;
|
||||
min-width: 70px;
|
||||
}
|
||||
|
||||
.field-value {
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.chunks-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.result-item {
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.result-header {
|
||||
padding: 4px 0;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
|
||||
&:hover {
|
||||
color: #07c05f;
|
||||
}
|
||||
}
|
||||
|
||||
.result-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.chunk-index {
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.chunk-position {
|
||||
font-size: 12px;
|
||||
font-size: 11px;
|
||||
color: #8b8b8b;
|
||||
}
|
||||
|
||||
|
||||
// Popup overlay styles
|
||||
:deep([class*="chunk-popup-"]) {
|
||||
.t-popup__content {
|
||||
max-height: 400px;
|
||||
max-width: 500px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding: 0;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: 'Monaco', 'Courier New', monospace;
|
||||
font-size: 11px;
|
||||
|
||||
@@ -1,59 +1,37 @@
|
||||
<template>
|
||||
<div class="search-results">
|
||||
<!-- Knowledge Base Statistics Card -->
|
||||
<div v-if="kbCounts && Object.keys(kbCounts).length > 0" class="stats-card">
|
||||
<div class="stats-title">知识库覆盖</div>
|
||||
<div class="stats-list">
|
||||
<div v-for="(count, kbId) in kbCounts" :key="kbId" class="stats-item">
|
||||
<span>{{ kbId }}</span>
|
||||
<span>{{ count }} 条结果</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Search Results List -->
|
||||
<div v-if="results && results.length > 0" class="results-list">
|
||||
<div
|
||||
v-for="result in results"
|
||||
:key="result.chunk_id"
|
||||
class="result-card"
|
||||
class="result-item"
|
||||
>
|
||||
<div class="result-header" @click="toggleResult(result.chunk_id)">
|
||||
<div class="result-title">
|
||||
<span class="result-index">#{{ result.result_index }}</span>
|
||||
<span class="relevance-badge" :class="getRelevanceClass(result.relevance_level)">
|
||||
{{ result.relevance_level }}
|
||||
</span>
|
||||
<span class="knowledge-title">{{ result.knowledge_title }}</span>
|
||||
</div>
|
||||
<div class="result-meta">
|
||||
<span class="match-type-badge">
|
||||
{{ getMatchTypeIcon(result.match_type) }} {{ result.match_type }}
|
||||
</span>
|
||||
<span class="score">{{ (result.score * 100).toFixed(0) }}%</span>
|
||||
<span class="expand-icon" :class="{ expanded: expandedResults.includes(result.chunk_id) }">
|
||||
▶
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="result-content" :class="{ expanded: expandedResults.includes(result.chunk_id) }">
|
||||
<div class="info-section">
|
||||
<div class="info-section-title">内容</div>
|
||||
<div class="full-content">{{ result.content }}</div>
|
||||
</div>
|
||||
|
||||
<div class="info-section">
|
||||
<div class="info-field">
|
||||
<span class="field-label">片段ID:</span>
|
||||
<span class="field-value"><code>{{ result.chunk_id }}</code></span>
|
||||
</div>
|
||||
<div class="info-field">
|
||||
<span class="field-label">文档ID:</span>
|
||||
<span class="field-value"><code>{{ result.knowledge_id }}</code></span>
|
||||
<t-popup
|
||||
:overlayClassName="`result-popup-${result.chunk_id}`"
|
||||
placement="bottom-left"
|
||||
width="400"
|
||||
:showArrow="false"
|
||||
trigger="click"
|
||||
destroy-on-close
|
||||
>
|
||||
<template #content>
|
||||
<ContentPopup
|
||||
:content="result.content"
|
||||
:chunk-id="result.chunk_id"
|
||||
:knowledge-id="result.knowledge_id"
|
||||
/>
|
||||
</template>
|
||||
<div class="result-header">
|
||||
<div class="result-title">
|
||||
<span class="result-index">#{{ result.result_index }}</span>
|
||||
<span class="relevance-badge" :class="getRelevanceClass(result.relevance_level)">
|
||||
{{ result.relevance_level }}
|
||||
</span>
|
||||
<span class="knowledge-title">{{ result.knowledge_title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t-popup>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -68,24 +46,55 @@
|
||||
import { ref, defineProps, computed } from 'vue';
|
||||
import type { SearchResultsData, SearchResultItem, RelevanceLevel } from '@/types/tool-results';
|
||||
import { getMatchTypeIcon } from '@/utils/tool-icons';
|
||||
import ContentPopup from './ContentPopup.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
data: SearchResultsData;
|
||||
arguments?: Record<string, any> | string;
|
||||
}>();
|
||||
|
||||
const expandedResults = ref<string[]>([]);
|
||||
|
||||
const results = computed(() => props.data.results || []);
|
||||
const kbCounts = computed(() => props.data.kb_counts);
|
||||
|
||||
const toggleResult = (chunkId: string) => {
|
||||
const index = expandedResults.value.indexOf(chunkId);
|
||||
if (index > -1) {
|
||||
expandedResults.value.splice(index, 1);
|
||||
} else {
|
||||
expandedResults.value.push(chunkId);
|
||||
// Parse arguments if it's a string
|
||||
const parsedArguments = computed(() => {
|
||||
const args = props.arguments;
|
||||
if (!args) return null;
|
||||
|
||||
// If it's already an object, return it
|
||||
if (typeof args === 'object' && !Array.isArray(args)) {
|
||||
return args;
|
||||
}
|
||||
};
|
||||
|
||||
// If it's a string, try to parse it
|
||||
if (typeof args === 'string') {
|
||||
try {
|
||||
return JSON.parse(args);
|
||||
} catch (e) {
|
||||
console.warn('Failed to parse arguments:', e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
// Check if there are search parameters to display (excluding query parameters which are in title)
|
||||
const hasSearchParams = computed(() => {
|
||||
const args = parsedArguments.value;
|
||||
if (!args || typeof args !== 'object') return false;
|
||||
|
||||
return !!(
|
||||
(Array.isArray(args.knowledge_base_ids) && args.knowledge_base_ids.length > 0) ||
|
||||
args.top_k || args.vector_threshold || args.keyword_threshold || args.min_score);
|
||||
});
|
||||
|
||||
const hasOtherParams = computed(() => {
|
||||
const args = parsedArguments.value;
|
||||
if (!args || typeof args !== 'object') return false;
|
||||
return !!(args.top_k || args.vector_threshold || args.keyword_threshold || args.min_score);
|
||||
});
|
||||
|
||||
|
||||
const getRelevanceClass = (level: RelevanceLevel): string => {
|
||||
const classMap: Record<RelevanceLevel, string> = {
|
||||
@@ -104,7 +113,85 @@ const getRelevanceClass = (level: RelevanceLevel): string => {
|
||||
.search-results {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 0 0 0 12px;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.search-params {
|
||||
padding: 10px 12px;
|
||||
background: #f8f9fa;
|
||||
border: 1px solid #e7e7e7;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
|
||||
.params-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.param-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
|
||||
.param-label {
|
||||
font-weight: 600;
|
||||
color: #666;
|
||||
min-width: 75px;
|
||||
flex-shrink: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.param-value {
|
||||
color: #333;
|
||||
flex: 1;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
.params-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
padding-top: 6px;
|
||||
border-top: 1px solid #e7e7e7;
|
||||
|
||||
.param-meta-item {
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
background: #ffffff;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #e7e7e7;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.stats-card {
|
||||
padding: 8px 12px;
|
||||
background: #f8f9fa;
|
||||
border: 1px solid #e7e7e7;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
|
||||
.stats-label {
|
||||
font-weight: 600;
|
||||
color: #666;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.stats-item-inline {
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.results-list {
|
||||
@@ -113,30 +200,115 @@ const getRelevanceClass = (level: RelevanceLevel): string => {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.result-item {
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.result-header {
|
||||
padding: 4px 0;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
|
||||
&:hover {
|
||||
color: #07c05f;
|
||||
}
|
||||
}
|
||||
|
||||
.result-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.result-index {
|
||||
font-size: 13px;
|
||||
font-size: 11px;
|
||||
color: #8b8b8b;
|
||||
font-weight: 600;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.relevance-badge {
|
||||
flex-shrink: 0;
|
||||
font-size: 11px;
|
||||
padding: 2px 6px;
|
||||
}
|
||||
|
||||
.knowledge-title {
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
font-weight: 500;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.score {
|
||||
font-size: 12px;
|
||||
color: #8b8b8b;
|
||||
font-weight: 500;
|
||||
|
||||
// Popup overlay styles
|
||||
:deep([class*="result-popup-"]) {
|
||||
.t-popup__content {
|
||||
max-height: 400px;
|
||||
max-width: 500px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding: 0;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
.info-section {
|
||||
margin-top: 8px;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.full-content {
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
line-height: 1.8;
|
||||
padding: 12px;
|
||||
background: #ffffff;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #e7e7e7;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.info-field {
|
||||
font-size: 11px;
|
||||
margin-bottom: 3px;
|
||||
|
||||
.field-label {
|
||||
min-width: 60px;
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: 'Monaco', 'Courier New', monospace;
|
||||
font-size: 11px;
|
||||
font-size: 10px;
|
||||
background: #f0f0f0;
|
||||
padding: 2px 4px;
|
||||
border-radius: 3px;
|
||||
padding: 1px 4px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
@@ -70,16 +70,17 @@
|
||||
|
||||
// Result card
|
||||
.result-card {
|
||||
background: @card-bg;
|
||||
background: #ffffff;
|
||||
border: 1px solid @card-border;
|
||||
border-radius: @card-radius;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 0;
|
||||
overflow: hidden;
|
||||
transition: all @transition-time ease;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
|
||||
|
||||
&:hover {
|
||||
border-color: @card-hover-border;
|
||||
box-shadow: @card-shadow-hover;
|
||||
box-shadow: 0 2px 8px rgba(7, 192, 95, 0.12);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,10 +92,16 @@
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
&:hover {
|
||||
background: rgba(7, 192, 95, 0.05);
|
||||
}
|
||||
|
||||
* {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.result-title {
|
||||
|
||||
Reference in New Issue
Block a user