2025-08-05 18:00:45 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="query-section" :class="{ collapsed: !visible }" :style="style">
|
2025-11-06 19:47:22 +08:00
|
|
|
|
<div class="query-section-layout">
|
|
|
|
|
|
<!-- 主内容区域 -->
|
|
|
|
|
|
<div class="query-main">
|
|
|
|
|
|
<div class="query-input-container">
|
2025-11-06 21:59:48 +08:00
|
|
|
|
<div class="search-input-wrapper">
|
|
|
|
|
|
<a-textarea
|
|
|
|
|
|
v-model:value="queryText"
|
|
|
|
|
|
placeholder="输入查询内容..."
|
|
|
|
|
|
:auto-size="{ minRows: 2, maxRows: 6 }"
|
|
|
|
|
|
class="search-textarea"
|
|
|
|
|
|
@press-enter.prevent="onQuery"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<div class="search-actions">
|
2025-11-15 12:18:31 +08:00
|
|
|
|
<div class="query-examples-compact">
|
|
|
|
|
|
<span class="examples-label">示例:</span>
|
|
|
|
|
|
<div class="examples-container">
|
|
|
|
|
|
<!-- 加载中或生成中 -->
|
|
|
|
|
|
<div v-if="loadingQuestions || generatingQuestions" class="loading-text">
|
|
|
|
|
|
<a-spin size="small" />
|
|
|
|
|
|
<span>{{ generatingQuestions ? 'AI生成中...' : '加载中...' }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 示例轮播 -->
|
|
|
|
|
|
<transition v-else-if="queryExamples.length > 0" name="fade" mode="out-in">
|
|
|
|
|
|
<a-button
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
:key="currentExampleIndex"
|
|
|
|
|
|
@click="useQueryExample(queryExamples[currentExampleIndex])"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
class="example-btn"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ queryExamples[currentExampleIndex] }}
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 空状态 - 添加文件后会自动生成 -->
|
2025-11-23 01:39:44 +08:00
|
|
|
|
<span v-else style="color: var(--gray-500); font-size: 12px;">添加文件后自动生成</span>
|
2025-11-15 12:18:31 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style="display: flex; gap: 12px; align-items: center;">
|
|
|
|
|
|
<a-switch
|
|
|
|
|
|
v-model:checked="showRawData"
|
|
|
|
|
|
checked-children="格式化"
|
|
|
|
|
|
un-checked-children="原始"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<a-button
|
|
|
|
|
|
@click="onQuery"
|
|
|
|
|
|
:loading="searchLoading"
|
|
|
|
|
|
class="search-button"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
:disabled="!queryText.trim()"
|
|
|
|
|
|
:icon=h(SearchOutlined)
|
|
|
|
|
|
shape="circle"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-11-06 19:47:22 +08:00
|
|
|
|
<div class="query-results" v-if="queryResult">
|
|
|
|
|
|
<!-- 原始数据显示 -->
|
2025-11-06 21:59:48 +08:00
|
|
|
|
<div v-if="!showRawData" class="result-raw">
|
2025-11-06 19:47:22 +08:00
|
|
|
|
<pre>{{ JSON.stringify(queryResult, null, 2) }}</pre>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 格式化显示 -->
|
|
|
|
|
|
<div v-else>
|
|
|
|
|
|
<!-- LightRAG 返回字符串格式 -->
|
|
|
|
|
|
<div v-if="typeof queryResult === 'string'" class="result-text">
|
|
|
|
|
|
{{ queryResult }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Chroma/Milvus 返回列表格式 -->
|
|
|
|
|
|
<div v-else-if="Array.isArray(queryResult)" class="result-list">
|
|
|
|
|
|
<div v-if="queryResult.length === 0" class="no-results">
|
|
|
|
|
|
<p>未找到相关结果</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else>
|
|
|
|
|
|
<div class="result-summary">
|
|
|
|
|
|
<strong>检索到 {{ queryResult.length }} 个相关文档块:</strong>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="(chunk, index) in queryResult"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
class="result-item"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="result-header">
|
|
|
|
|
|
<span class="result-index">#{{ index + 1 }}</span>
|
|
|
|
|
|
<span v-if="chunk.score" class="result-score">
|
|
|
|
|
|
相似度: {{ (chunk.score * 100).toFixed(2) }}%
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span v-if="chunk.rerank_score" class="result-rerank-score">
|
|
|
|
|
|
重排序分数: {{ (chunk.rerank_score * 100).toFixed(2) }}%
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="result-content">
|
|
|
|
|
|
{{ chunk.content }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="result-metadata">
|
|
|
|
|
|
<span v-if="chunk.metadata?.source" class="metadata-item">
|
|
|
|
|
|
<strong>来源:</strong> {{ chunk.metadata.source }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span v-if="chunk.metadata?.file_id" class="metadata-item">
|
|
|
|
|
|
<strong>文件ID:</strong> {{ chunk.metadata.file_id }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span v-if="chunk.metadata?.chunk_index !== undefined" class="metadata-item">
|
|
|
|
|
|
<strong>块索引:</strong> {{ chunk.metadata.chunk_index }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span v-if="chunk.distance !== undefined" class="metadata-item">
|
|
|
|
|
|
<strong>距离:</strong> {{ chunk.distance.toFixed(4) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 其他格式(降级处理) -->
|
|
|
|
|
|
<div v-else class="result-unknown">
|
|
|
|
|
|
<pre>{{ JSON.stringify(queryResult, null, 2) }}</pre>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div> <!-- 关闭格式化显示的div -->
|
|
|
|
|
|
</div>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-11-15 12:18:31 +08:00
|
|
|
|
import { ref, computed, onMounted, onUnmounted, watch, h } from 'vue';
|
2025-08-05 18:00:45 +08:00
|
|
|
|
import { useDatabaseStore } from '@/stores/database';
|
|
|
|
|
|
import { message } from 'ant-design-vue';
|
2025-08-05 22:58:30 +08:00
|
|
|
|
import { queryApi } from '@/apis/knowledge_api';
|
2025-08-05 18:00:45 +08:00
|
|
|
|
import {
|
|
|
|
|
|
SearchOutlined,
|
|
|
|
|
|
} from '@ant-design/icons-vue';
|
|
|
|
|
|
|
|
|
|
|
|
const store = useDatabaseStore();
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
|
visible: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: true
|
|
|
|
|
|
},
|
|
|
|
|
|
style: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => ({})
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const searchLoading = computed(() => store.state.searchLoading);
|
2025-08-05 22:58:30 +08:00
|
|
|
|
const queryResult = ref('');
|
2025-11-06 21:59:48 +08:00
|
|
|
|
const showRawData = ref(true);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 查询测试
|
|
|
|
|
|
const queryText = ref('');
|
|
|
|
|
|
|
2025-11-15 12:18:31 +08:00
|
|
|
|
// 示例问题相关
|
|
|
|
|
|
const queryExamples = ref([]);
|
|
|
|
|
|
const currentExampleIndex = ref(0);
|
|
|
|
|
|
const loadingQuestions = ref(false);
|
|
|
|
|
|
const generatingQuestions = ref(false);
|
|
|
|
|
|
|
|
|
|
|
|
// 示例轮播相关
|
|
|
|
|
|
let exampleCarouselInterval = null;
|
|
|
|
|
|
|
|
|
|
|
|
// 加载示例问题
|
|
|
|
|
|
const loadSampleQuestions = async () => {
|
|
|
|
|
|
if (!store.database?.db_id) return;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
loadingQuestions.value = true;
|
|
|
|
|
|
const data = await queryApi.getSampleQuestions(store.database.db_id);
|
|
|
|
|
|
if (data.questions && data.questions.length > 0) {
|
|
|
|
|
|
queryExamples.value = data.questions;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 如果没有问题,清空列表
|
|
|
|
|
|
queryExamples.value = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
// 404表示还没有生成问题,清空问题列表
|
|
|
|
|
|
if (error.status === 404 || error?.message?.includes('404') || error?.message?.includes('还没有生成')) {
|
|
|
|
|
|
queryExamples.value = [];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.error('加载示例问题失败:', error);
|
|
|
|
|
|
}
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
loadingQuestions.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 清空问题列表
|
|
|
|
|
|
const clearQuestions = () => {
|
|
|
|
|
|
queryExamples.value = [];
|
|
|
|
|
|
currentExampleIndex.value = 0;
|
|
|
|
|
|
stopExampleCarousel();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 生成示例问题
|
|
|
|
|
|
const generateSampleQuestions = async (silent = false) => {
|
|
|
|
|
|
if (!store.database?.db_id) return;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
generatingQuestions.value = true;
|
|
|
|
|
|
const data = await queryApi.generateSampleQuestions(store.database.db_id, 10);
|
|
|
|
|
|
if (data.questions && data.questions.length > 0) {
|
|
|
|
|
|
queryExamples.value = data.questions;
|
|
|
|
|
|
if (!silent) {
|
|
|
|
|
|
message.success(`成功生成 ${data.questions.length} 个测试问题`);
|
|
|
|
|
|
}
|
|
|
|
|
|
// 开始轮播
|
|
|
|
|
|
if (!exampleCarouselInterval) {
|
|
|
|
|
|
startExampleCarousel();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('生成示例问题失败:', error);
|
|
|
|
|
|
// 静默模式下不显示错误消息(自动生成时)
|
|
|
|
|
|
if (!silent) {
|
|
|
|
|
|
// 提取详细错误信息
|
|
|
|
|
|
let errorMsg = '未知错误';
|
|
|
|
|
|
if (error.response?.data?.detail) {
|
|
|
|
|
|
errorMsg = error.response.data.detail;
|
|
|
|
|
|
} else if (error.detail) {
|
|
|
|
|
|
errorMsg = error.detail;
|
|
|
|
|
|
} else if (error.message) {
|
|
|
|
|
|
errorMsg = error.message;
|
|
|
|
|
|
} else if (typeof error === 'string') {
|
|
|
|
|
|
errorMsg = error;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
errorMsg = JSON.stringify(error);
|
|
|
|
|
|
}
|
|
|
|
|
|
message.error('生成失败: ' + errorMsg);
|
|
|
|
|
|
}
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
generatingQuestions.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const useQueryExample = (example) => {
|
|
|
|
|
|
queryText.value = example;
|
|
|
|
|
|
onQuery();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const startExampleCarousel = () => {
|
|
|
|
|
|
if (exampleCarouselInterval) return;
|
|
|
|
|
|
|
|
|
|
|
|
exampleCarouselInterval = setInterval(() => {
|
|
|
|
|
|
currentExampleIndex.value = (currentExampleIndex.value + 1) % queryExamples.value.length;
|
|
|
|
|
|
}, 10000); // 每10秒切换一次
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const stopExampleCarousel = () => {
|
|
|
|
|
|
if (exampleCarouselInterval) {
|
|
|
|
|
|
clearInterval(exampleCarouselInterval);
|
|
|
|
|
|
exampleCarouselInterval = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 监听知识库ID变化,切换知识库时重新加载问题
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => store.database?.db_id,
|
|
|
|
|
|
async (newDbId, oldDbId) => {
|
|
|
|
|
|
// 如果知识库ID发生变化
|
|
|
|
|
|
if (newDbId && newDbId !== oldDbId) {
|
|
|
|
|
|
// 停止当前轮播
|
|
|
|
|
|
stopExampleCarousel();
|
|
|
|
|
|
// 清空当前问题列表
|
|
|
|
|
|
queryExamples.value = [];
|
|
|
|
|
|
currentExampleIndex.value = 0;
|
|
|
|
|
|
// 重新加载新知识库的问题
|
|
|
|
|
|
await loadSampleQuestions();
|
|
|
|
|
|
// 如果有问题,启动轮播
|
|
|
|
|
|
if (queryExamples.value.length > 0) {
|
|
|
|
|
|
startExampleCarousel();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{ immediate: false }
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-08-05 22:58:30 +08:00
|
|
|
|
const onQuery = async () => {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
if (!queryText.value.trim()) {
|
|
|
|
|
|
message.error('请输入查询内容');
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-08-05 22:58:30 +08:00
|
|
|
|
|
|
|
|
|
|
store.state.searchLoading = true;
|
|
|
|
|
|
|
2025-11-06 19:47:22 +08:00
|
|
|
|
// 从store中获取配置参数
|
|
|
|
|
|
const queryMeta = { ...store.meta };
|
2025-08-05 22:58:30 +08:00
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
const data = await queryApi.queryTest(store.database.db_id, queryText.value.trim(), queryMeta);
|
|
|
|
|
|
queryResult.value = data;
|
2025-11-06 19:47:22 +08:00
|
|
|
|
|
2025-08-05 22:58:30 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error(error);
|
|
|
|
|
|
message.error(error.message);
|
|
|
|
|
|
queryResult.value = '';
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
store.state.searchLoading = false;
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-11-15 12:18:31 +08:00
|
|
|
|
// 组件挂载时启动示例轮播
|
|
|
|
|
|
onMounted(async () => {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
// 加载查询参数
|
|
|
|
|
|
store.loadQueryParams();
|
2025-11-15 12:18:31 +08:00
|
|
|
|
|
|
|
|
|
|
// 加载示例问题
|
|
|
|
|
|
await loadSampleQuestions();
|
|
|
|
|
|
|
|
|
|
|
|
// 如果有示例问题,启动轮播
|
|
|
|
|
|
if (queryExamples.value.length > 0) {
|
|
|
|
|
|
startExampleCarousel();
|
|
|
|
|
|
}
|
|
|
|
|
|
// 不自动生成,只在创建知识库和添加文件时由 DataBaseInfoView 触发生成
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 组件卸载时停止示例轮播
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
|
// 停止示例轮播
|
|
|
|
|
|
stopExampleCarousel();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否已有问题
|
|
|
|
|
|
const hasQuestions = () => {
|
|
|
|
|
|
return queryExamples.value.length > 0;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 暴露给父组件的方法和属性
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
|
generateSampleQuestions,
|
|
|
|
|
|
loadSampleQuestions,
|
|
|
|
|
|
hasQuestions,
|
|
|
|
|
|
clearQuestions,
|
|
|
|
|
|
queryExamples
|
2025-08-05 18:00:45 +08:00
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
|
|
|
.query-section {
|
2025-11-06 19:47:22 +08:00
|
|
|
|
height: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-11-06 19:47:22 +08:00
|
|
|
|
.query-section-layout {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-11-06 19:47:22 +08:00
|
|
|
|
// 主内容区域
|
|
|
|
|
|
.query-main {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
min-width: 0;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
max-height: 100%;
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-11-06 19:47:22 +08:00
|
|
|
|
.query-input-container {
|
|
|
|
|
|
padding: 16px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
gap: 12px;
|
|
|
|
|
|
background-color: var(--gray-0);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.search-input-wrapper {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
padding: 12px 16px 8px;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
border: 1px solid var(--gray-200);
|
|
|
|
|
|
background-color: var(--gray-0);
|
2025-11-23 01:39:44 +08:00
|
|
|
|
box-shadow: 0 1px 3px var(--shadow-1);
|
2025-11-06 21:59:48 +08:00
|
|
|
|
transition: border-color 0.5s ease, box-shadow 0.5s ease;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
border-color: var(--main-400);
|
2025-11-23 01:39:44 +08:00
|
|
|
|
box-shadow: 0 4px 12px var(--shadow-2);
|
2025-11-06 21:59:48 +08:00
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
:deep(.ant-input) {
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
background-color: var(--gray-0);
|
|
|
|
|
|
color: var(--gray-1000);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
outline: none;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
border: none;
|
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
transition: border-color 0.3s ease, box-shadow 0.3s ease;
|
|
|
|
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
|
|
outline: none;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&::placeholder {
|
|
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.search-actions {
|
2025-11-06 19:47:22 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
gap: 12px;
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-11-06 19:47:22 +08:00
|
|
|
|
.search-button {
|
2025-11-06 21:59:48 +08:00
|
|
|
|
background-color: var(--main-color);
|
|
|
|
|
|
border-color: var(--main-color);
|
2025-11-23 01:39:44 +08:00
|
|
|
|
box-shadow: 0 2px 4px var(--shadow-3);
|
2025-11-06 21:59:48 +08:00
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover:not(:disabled) {
|
|
|
|
|
|
background-color: var(--main-bright);
|
|
|
|
|
|
border-color: var(--main-bright);
|
|
|
|
|
|
box-shadow: 0 4px 8px rgba(1, 136, 166, 0.25);
|
|
|
|
|
|
transform: translateY(-1px);
|
|
|
|
|
|
}
|
2025-11-06 19:47:22 +08:00
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
&:disabled {
|
|
|
|
|
|
opacity: 0.5;
|
|
|
|
|
|
color: var(--gray-0);
|
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
|
transform: none;
|
|
|
|
|
|
}
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.query-results {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
overflow-y: auto;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
padding: 16px;
|
|
|
|
|
|
background-color: var(--gray-25);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
min-height: 0;
|
|
|
|
|
|
|
|
|
|
|
|
.result-raw {
|
2025-11-06 21:59:48 +08:00
|
|
|
|
background-color: var(--gray-50);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
border: 1px solid var(--gray-200);
|
|
|
|
|
|
border-radius: 6px;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
padding: 16px;
|
2025-11-06 19:47:22 +08:00
|
|
|
|
overflow-x: auto;
|
|
|
|
|
|
|
|
|
|
|
|
pre {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
line-height: 1.5;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
color: var(--gray-1000);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
white-space: pre-wrap;
|
|
|
|
|
|
word-break: break-word;
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 19:47:22 +08:00
|
|
|
|
.result-text {
|
|
|
|
|
|
white-space: pre-wrap;
|
|
|
|
|
|
word-break: break-word;
|
|
|
|
|
|
line-height: 1.6;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
color: var(--gray-1000);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 19:47:22 +08:00
|
|
|
|
.result-list {
|
|
|
|
|
|
.no-results {
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
padding: 32px;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
color: var(--gray-500);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.result-summary {
|
|
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
|
padding: 8px 12px;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
background-color: var(--main-50);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
border-left: 3px solid var(--main-color);
|
|
|
|
|
|
border-radius: 2px;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
color: var(--gray-800);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.result-item {
|
2025-11-06 21:59:48 +08:00
|
|
|
|
background-color: var(--gray-0);
|
|
|
|
|
|
border: 1px solid var(--gray-200);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
padding: 12px;
|
|
|
|
|
|
margin-bottom: 12px;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
transition: all 0.2s ease;
|
2025-11-06 19:47:22 +08:00
|
|
|
|
|
|
|
|
|
|
&:hover {
|
2025-11-06 21:59:48 +08:00
|
|
|
|
border-color: var(--main-300);
|
|
|
|
|
|
box-shadow: 0 2px 8px rgba(1, 97, 121, 0.08);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.result-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
|
padding-bottom: 8px;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
border-bottom: 1px solid var(--gray-150);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
|
|
|
|
|
|
.result-index {
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: var(--main-color);
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.result-score,
|
|
|
|
|
|
.result-rerank-score {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
padding: 2px 8px;
|
|
|
|
|
|
border-radius: 12px;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
background-color: var(--gray-100);
|
|
|
|
|
|
color: var(--gray-700);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.result-rerank-score {
|
2025-11-06 21:59:48 +08:00
|
|
|
|
background-color: var(--stats-warning-bg);
|
|
|
|
|
|
color: var(--stats-warning-color);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.result-content {
|
|
|
|
|
|
padding: 8px 0;
|
|
|
|
|
|
line-height: 1.6;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
color: var(--gray-900);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
white-space: pre-wrap;
|
|
|
|
|
|
word-break: break-word;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.result-metadata {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
|
padding-top: 8px;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
border-top: 1px solid var(--gray-150);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
|
|
|
|
|
|
.metadata-item {
|
|
|
|
|
|
font-size: 12px;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
color: var(--gray-700);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
|
|
|
|
|
|
strong {
|
2025-11-06 21:59:48 +08:00
|
|
|
|
color: var(--gray-500);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
margin-right: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 19:47:22 +08:00
|
|
|
|
.result-unknown {
|
|
|
|
|
|
pre {
|
2025-11-06 21:59:48 +08:00
|
|
|
|
background-color: var(--gray-0);
|
|
|
|
|
|
border: 1px solid var(--gray-200);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
padding: 12px;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
overflow-x: auto;
|
|
|
|
|
|
font-size: 12px;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
color: var(--gray-1000);
|
2025-11-06 19:47:22 +08:00
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-11-06 19:47:22 +08:00
|
|
|
|
|
2025-11-15 12:18:31 +08:00
|
|
|
|
.query-examples-compact {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.examples-label {
|
|
|
|
|
|
font-size: 12px;
|
2025-11-23 01:39:44 +08:00
|
|
|
|
color: var(--gray-500);
|
2025-11-15 12:18:31 +08:00
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.examples-container {
|
|
|
|
|
|
min-height: 24px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.loading-text {
|
|
|
|
|
|
font-size: 12px;
|
2025-11-23 01:39:44 +08:00
|
|
|
|
color: var(--gray-400);
|
2025-11-15 12:18:31 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 6px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.example-btn {
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
white-space: normal;
|
|
|
|
|
|
height: auto;
|
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.fade-enter-active,
|
|
|
|
|
|
.fade-leave-active {
|
|
|
|
|
|
transition: opacity 0.3s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.fade-enter-from,
|
|
|
|
|
|
.fade-leave-to {
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
</style>
|