|
@@ -12,7 +12,11 @@
|
|
|
:offset-top="110"
|
|
|
v-show="!showDoc"
|
|
|
>
|
|
|
- <markdown-toc :no-data="activeTab === 'original'" :toc="tocs" :class="`markdown-toc-${askType}`" />
|
|
|
+ <markdown-toc
|
|
|
+ :no-data="activeTab === 'original'"
|
|
|
+ :toc="tocs"
|
|
|
+ :class="`markdown-toc-${askType}`"
|
|
|
+ />
|
|
|
</a-affix>
|
|
|
<div :class="`search-detail search-detail-${askType}`" ref="searchRef">
|
|
|
<div
|
|
@@ -121,10 +125,10 @@
|
|
|
<a-radio value="2">研究</a-radio>
|
|
|
</a-radio-group>
|
|
|
<div class="ds-box">
|
|
|
- <div @click="onChange('1')" :class="{active: dsChecked === true}">
|
|
|
+ <div @click="onChange('1')" :class="{ active: dsChecked === true }">
|
|
|
<i class="iconfont icon-deepsee"></i>
|
|
|
</div>
|
|
|
- <div @click="onChange('0')" :class="{active: dsChecked === false}">
|
|
|
+ <div @click="onChange('0')" :class="{ active: dsChecked === false }">
|
|
|
<i class="iconfont icon-tongyi"></i>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -311,9 +315,12 @@
|
|
|
class="ma"
|
|
|
style="font-weight: bolder; color: #000000; margin-right: 10px"
|
|
|
>出处 [{{ i + 1 }}] </span
|
|
|
- ><span class="doc-link" @click="openDoc(doc, i)">{{ doc.doc }}</span>
|
|
|
+ ><span class="doc-link" @click="openDoc(doc, i)">
|
|
|
+ {{ doc && doc.doc ? doc.doc : '' }}</span
|
|
|
+ >
|
|
|
</p>
|
|
|
<div
|
|
|
+ v-if="doc"
|
|
|
:class="`doc-icon${
|
|
|
!doc.showContent ? ' doc-icon-show' : ' doc-icon-hide'
|
|
|
}`"
|
|
@@ -321,7 +328,7 @@
|
|
|
></div>
|
|
|
</div>
|
|
|
|
|
|
- <div :class="`content${doc.showContent ? '' : ' content-hide'}`">
|
|
|
+ <div v-if="doc" :class="`content${doc.showContent ? '' : ' content-hide'}`">
|
|
|
<p>{{ doc.content }}</p>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -332,14 +339,14 @@
|
|
|
:key="'doc-' + i"
|
|
|
>
|
|
|
<div class="doc">
|
|
|
- <p>
|
|
|
+ <p v-if="doc">
|
|
|
<span class="doc-link" @click="openUrl(doc.link)">{{ doc.title }}</span>
|
|
|
</p>
|
|
|
</div>
|
|
|
<div class="bottom">
|
|
|
<div class="title-icon">
|
|
|
<div class="icon"></div>
|
|
|
- <div class="title">{{ doc.doc }}</div>
|
|
|
+ <div class="title">{{ doc && doc.doc ? doc.doc : '' }}</div>
|
|
|
</div>
|
|
|
<div class="index">{{ i + 1 }}</div>
|
|
|
</div>
|
|
@@ -557,7 +564,7 @@ watch(props.searchType, (val) => {
|
|
|
const question = ref('国有土地的使用方式有哪些?');
|
|
|
const followQuestion = ref('');
|
|
|
const statusText = ref('检索中');
|
|
|
-const activeIndex = ref(0);
|
|
|
+const activeIndex = ref(3);
|
|
|
const activeTab = ref(props.searchType);
|
|
|
let ctr = null;
|
|
|
const aiTextAreaRef = ref(null);
|
|
@@ -648,7 +655,7 @@ const streamToAnswer = () => {
|
|
|
const tabs = [
|
|
|
{ key: 'knowledge', name: '知识库' },
|
|
|
{ key: 'net', name: '全网' },
|
|
|
- { key: 'original', name: '原生' },
|
|
|
+ { key: 'original', name: '原生' }
|
|
|
];
|
|
|
|
|
|
const steps = ref([
|
|
@@ -752,7 +759,7 @@ const search = (q, type = 'zcfg') => {
|
|
|
const graph = ref(false);
|
|
|
|
|
|
const questLandMark = async () => {
|
|
|
- activeIndex.value = 0;
|
|
|
+ activeIndex.value = 3;
|
|
|
tocs.value = [];
|
|
|
steps.value = [
|
|
|
{
|
|
@@ -790,7 +797,7 @@ const questLandMark = async () => {
|
|
|
msgFinished: false,
|
|
|
hasChart: false
|
|
|
};
|
|
|
- await getQuestionKeyWords();
|
|
|
+ // await getQuestionKeyWords();
|
|
|
ctr = new AbortController();
|
|
|
await fetchEventSource(window.AppGlobalConfig.landMarketUrl, {
|
|
|
method: 'POST',
|
|
@@ -974,9 +981,9 @@ const changeTab = (tab) => {
|
|
|
timers.value = [];
|
|
|
if (tab === 'net') {
|
|
|
questionUrl = '/chat/bing_chat';
|
|
|
- } else if(tab === 'knowledge'){
|
|
|
+ } else if (tab === 'knowledge') {
|
|
|
questionUrl = '/chat/kb_chat';
|
|
|
- }else if(tab === 'original') {
|
|
|
+ } else if (tab === 'original') {
|
|
|
questionUrl = '/chat/chat';
|
|
|
}
|
|
|
|
|
@@ -997,7 +1004,7 @@ const onChange = (type) => {
|
|
|
//ds绑定用户改变
|
|
|
const dsChange = (type) => {
|
|
|
dsChecked.value = type === '0' ? false : true;
|
|
|
- localStorage.setItem("_isDeepSeek", type);
|
|
|
+ localStorage.setItem('_isDeepSeek', type);
|
|
|
if (timers.value) {
|
|
|
timers.value.forEach((t) => {
|
|
|
clearTimeout(t);
|
|
@@ -1038,7 +1045,7 @@ const quest = async (isFllow) => {
|
|
|
tocs.value = [];
|
|
|
question.value = (isFllow ? '追问: ' : '') + question.value;
|
|
|
evaluate.value = null;
|
|
|
- activeIndex.value = 0;
|
|
|
+ activeIndex.value = 3;
|
|
|
steps.value = [
|
|
|
{
|
|
|
key: 0,
|
|
@@ -1097,14 +1104,14 @@ const quest = async (isFllow) => {
|
|
|
streamMsg: '',
|
|
|
docs: []
|
|
|
};
|
|
|
- activeIndex.value = 0;
|
|
|
- getQuestionKeyWords();
|
|
|
+ activeIndex.value = 3;
|
|
|
+ // getQuestionKeyWords();
|
|
|
if (activeTab.value === 'net') {
|
|
|
questionUrl = '/chat/bing_chat';
|
|
|
- } else if(activeTab.value === 'knowledge'){
|
|
|
+ } else if (activeTab.value === 'knowledge') {
|
|
|
questionUrl = '/chat/kb_chat';
|
|
|
- }else if(activeTab.value === 'original') {
|
|
|
- questionUrl = '/chat/chat';
|
|
|
+ } else if (activeTab.value === 'original') {
|
|
|
+ questionUrl = '/chat/common_chat';
|
|
|
}
|
|
|
const topKs = window?.AppGlobalConfig?.topKs || {
|
|
|
0: 5,
|
|
@@ -1112,19 +1119,22 @@ const quest = async (isFllow) => {
|
|
|
2: 15
|
|
|
};
|
|
|
|
|
|
- let body = null
|
|
|
+ let body = null;
|
|
|
if (activeTab.value === 'net') {
|
|
|
body = {
|
|
|
query: question.value,
|
|
|
stream: true,
|
|
|
model: dsChecked.value ? 'deepseek-r1' : '',
|
|
|
search_type: answerType.value
|
|
|
- }
|
|
|
- } else if(activeTab.value === 'knowledge'){
|
|
|
+ };
|
|
|
+ } else if (activeTab.value === 'knowledge') {
|
|
|
body = {
|
|
|
query: question.value,
|
|
|
mode: 'local_kb',
|
|
|
- kb_name: activeTab.value === 'paper' ? 'compose_paper_material_total' : window?.AppGlobalConfig?.llm?.kb_name,
|
|
|
+ kb_name:
|
|
|
+ activeTab.value === 'paper'
|
|
|
+ ? 'compose_paper_material_total'
|
|
|
+ : window?.AppGlobalConfig?.llm?.kb_name,
|
|
|
top_k: topKs[answerType.value],
|
|
|
search_type: answerType.value,
|
|
|
score_threshold: 0.5,
|
|
@@ -1133,12 +1143,16 @@ const quest = async (isFllow) => {
|
|
|
stream: true,
|
|
|
prompt_name: 'rag_context_qa.md',
|
|
|
return_direct: false
|
|
|
- }
|
|
|
+ };
|
|
|
} else if (activeTab.value === 'original') {
|
|
|
body = {
|
|
|
query: question.value,
|
|
|
- stream: true
|
|
|
- }
|
|
|
+ search_type: answerType.value,
|
|
|
+ model: dsChecked.value ? 'deepseek-r1' : '',
|
|
|
+ history: isFllow ? getFlowHistory() : [],
|
|
|
+ stream: true,
|
|
|
+ return_direct: false
|
|
|
+ };
|
|
|
}
|
|
|
if (activeTab.value === 'knowledge' && isFllow) {
|
|
|
if (questHistories.value.length > 0) {
|
|
@@ -1227,30 +1241,30 @@ const handleKnowledgeResponse = (msg, id) => {
|
|
|
var time = ((endTime.value - startTime.value) / 1000).toFixed(0);
|
|
|
dsHintTxt.value = `已深度思考(用时 ${time} 秒)`;
|
|
|
dsLoading.value = false;
|
|
|
- aiLoading.value=true;
|
|
|
+ aiLoading.value = true;
|
|
|
}
|
|
|
- currentResponse.value.originAnswer = rData.choices[0]?.delta?.content.replaceAll(
|
|
|
- '\n',
|
|
|
- ` \n`
|
|
|
- );
|
|
|
- currentResponse.value.msg = rData.choices[0]?.delta?.content.replaceAll('\n', ` \n`);
|
|
|
- let num = getNum(currentResponse.value.msg);
|
|
|
- while (num) {
|
|
|
- const docsNum = currentResponse.value.docs.length;
|
|
|
- if (docsNum && num > docsNum + 1) {
|
|
|
- }
|
|
|
+ currentResponse.value.originAnswer = rData.choices[0]?.delta?.content.replaceAll(
|
|
|
+ '\n',
|
|
|
+ ` \n`
|
|
|
+ );
|
|
|
+ currentResponse.value.msg = rData.choices[0]?.delta?.content.replaceAll('\n', ` \n`);
|
|
|
+ let num = getNum(currentResponse.value.msg);
|
|
|
+ while (num) {
|
|
|
+ const docsNum = currentResponse.value.docs.length;
|
|
|
+ if (docsNum && num > docsNum + 1) {
|
|
|
+ }
|
|
|
|
|
|
- currentResponse.value.msg = currentResponse.value.msg.replace(
|
|
|
- `[[${num}]]`,
|
|
|
- `<span onclick="window.openDocByIndex(${num}, ${id})" class="poi" style=" cursor: pointer; display: inline-block; width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; margin: 0 5px; border-radius: 10px;background: #d0d5dd; width: 20px;
|
|
|
+ currentResponse.value.msg = currentResponse.value.msg.replace(
|
|
|
+ `[[${num}]]`,
|
|
|
+ `<span onclick="window.openDocByIndex(${num}, ${id})" class="poi" style=" cursor: pointer; display: inline-block; width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; margin: 0 5px; border-radius: 10px;background: #d0d5dd; width: 20px;
|
|
|
height: 20px;
|
|
|
background: #FFFFFF;
|
|
|
border-radius: 4px 4px 4px 4px;
|
|
|
border: 1px solid #BACAE3;">${num}</span>`
|
|
|
- );
|
|
|
+ );
|
|
|
|
|
|
- num = getNum(currentResponse.value.msg);
|
|
|
- }
|
|
|
+ num = getNum(currentResponse.value.msg);
|
|
|
+ }
|
|
|
} else {
|
|
|
aiLoading.value = false;
|
|
|
if (dsChecked.value) {
|
|
@@ -1402,12 +1416,15 @@ const handleDocs = (docs) => {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- if (v.indexOf('.pdf') > 0) {
|
|
|
+ if (v.toLowerCase().indexOf('.pdf') > 0) {
|
|
|
return {
|
|
|
index: i++,
|
|
|
- doc: v.substring(v.indexOf('] [') + 3, v.indexOf('.pdf]') + 4),
|
|
|
- link: v.substring(v.indexOf('.pdf]') + 6, v.indexOf('.pdf)') + 4),
|
|
|
- content: v.substring(v.indexOf('.pdf)') + 5),
|
|
|
+ doc: v.substring(v.indexOf('] [') + 3, v.toLowerCase().indexOf('.pdf]') + 4),
|
|
|
+ link: v.substring(
|
|
|
+ v.toLowerCase().indexOf('.pdf]') + 6,
|
|
|
+ v.toLowerCase().indexOf('.pdf)') + 4
|
|
|
+ ),
|
|
|
+ content: v.substring(v.toLowerCase().indexOf('.pdf)') + 5),
|
|
|
showContent: false,
|
|
|
type: 'pdf'
|
|
|
};
|
|
@@ -1434,6 +1451,9 @@ const handleDocs = (docs) => {
|
|
|
};
|
|
|
|
|
|
const openDoc = (doc, i) => {
|
|
|
+ if (!doc) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
var link = doc.link;
|
|
|
var type = doc.type;
|
|
|
pdfSrc.value = link.replace(
|
|
@@ -1584,7 +1604,7 @@ for example:
|
|
|
|
|
|
fetch(window.AppGlobalConfig.knowledgeServer + '/chat/chat', requestOptions)
|
|
|
.then((response) => {
|
|
|
- return response.json()
|
|
|
+ return response.json();
|
|
|
})
|
|
|
.then((msg) => {
|
|
|
const str = msg.choices[0]?.message?.content;
|
|
@@ -1602,7 +1622,7 @@ const changeRecommendedQuestions = () => {
|
|
|
questions.value = recommendedQuestions.slice(0, 5);
|
|
|
} else {
|
|
|
questions.value = recommendedQuestions.slice(5);
|
|
|
- getRecommendedQuestion(true)
|
|
|
+ getRecommendedQuestion(true);
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -1626,12 +1646,12 @@ const getQuestionKeyWords = async () => {
|
|
|
return fetch(window.AppGlobalConfig.knowledgeServer + '/chat/chat', requestOptions)
|
|
|
.then((response) => response.json())
|
|
|
.then((msgStr) => {
|
|
|
- const msg = JSON.parse(msgStr)
|
|
|
+ const msg = JSON.parse(msgStr);
|
|
|
activeIndex.value = 1;
|
|
|
const str = msg.choices[0]?.message?.content;
|
|
|
if (str) {
|
|
|
- const str1 = str.slice(str.indexOf("</think>")+7)
|
|
|
- console.log(str1)
|
|
|
+ const str1 = str.slice(str.indexOf('</think>') + 7);
|
|
|
+ console.log(str1);
|
|
|
const keywords = splitWords(str1).slice(0, 3);
|
|
|
setActiveIndexTags(0, keywords);
|
|
|
currentResponse.value.keywords = keywords;
|
|
@@ -1755,13 +1775,13 @@ const generateToc = () => {
|
|
|
// });
|
|
|
return;
|
|
|
}
|
|
|
- const resMarkdownDom = document.getElementById("resMarkdown");
|
|
|
- let thinkDoms = resMarkdownDom.getElementsByTagName("think");
|
|
|
+ const resMarkdownDom = document.getElementById('resMarkdown');
|
|
|
+ let thinkDoms = resMarkdownDom.getElementsByTagName('think');
|
|
|
let markdowns = null;
|
|
|
if (!thinkDoms || thinkDoms.length === 0) {
|
|
|
markdowns = resMarkdownDom.children;
|
|
|
} else {
|
|
|
- markdowns = thinkDoms[0].children
|
|
|
+ markdowns = thinkDoms[0].children;
|
|
|
}
|
|
|
let index = 1;
|
|
|
let children = [];
|
|
@@ -1853,10 +1873,9 @@ defineExpose({ search, changeActiveTab, stopAI });
|
|
|
.header {
|
|
|
width: 100%;
|
|
|
height: 60px;
|
|
|
- background: #F4F6F9;
|
|
|
+ background: #f4f6f9;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
.search-panel {
|
|
|
width: 100%;
|
|
|
height: calc(100% - 60px - 50px);
|
|
@@ -2110,11 +2129,11 @@ defineExpose({ search, changeActiveTab, stopAI });
|
|
|
display: flex;
|
|
|
height: 36px;
|
|
|
align-items: center;
|
|
|
- border: 1px solid #E3E4E4;
|
|
|
+ border: 1px solid #e3e4e4;
|
|
|
background: #f0f0f0;
|
|
|
border-radius: 5px;
|
|
|
overflow: hidden;
|
|
|
- >div {
|
|
|
+ > div {
|
|
|
height: 100%;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
@@ -2130,12 +2149,12 @@ defineExpose({ search, changeActiveTab, stopAI });
|
|
|
}
|
|
|
&:nth-child(2) {
|
|
|
.iconfont {
|
|
|
- color: #605BEC;
|
|
|
+ color: #605bec;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
.iconfont {
|
|
|
- color: #898D93;
|
|
|
+ color: #898d93;
|
|
|
margin-top: 2px;
|
|
|
}
|
|
|
&:nth-child(1) {
|
|
@@ -2203,7 +2222,7 @@ defineExpose({ search, changeActiveTab, stopAI });
|
|
|
.bottom {
|
|
|
width: 100%;
|
|
|
height: 4px;
|
|
|
- background: #3987F4;
|
|
|
+ background: #3987f4;
|
|
|
border-radius: 2px;
|
|
|
}
|
|
|
}
|
|
@@ -2445,7 +2464,7 @@ defineExpose({ search, changeActiveTab, stopAI });
|
|
|
|
|
|
.doc-link {
|
|
|
cursor: pointer;
|
|
|
- color: #3987F4;
|
|
|
+ color: #3987f4;
|
|
|
|
|
|
&:hover {
|
|
|
font-weight: bold;
|