|
|
@@ -12,13 +12,6 @@
|
|
|
</footer>
|
|
|
</div>
|
|
|
|
|
|
- <!-- <div class="section-suggestions">
|
|
|
- <div :class="['section-suggestion', readonly ? 'disabled' : '']" v-for="(suggestion, key) in suggestions"
|
|
|
- :key="key" @click="selectSuggestion(suggestion)">
|
|
|
- {{ suggestion }}<icon-arrow-right />
|
|
|
- </div>
|
|
|
- </div> -->
|
|
|
-
|
|
|
<Suggestion :suggestions="suggestions" :readonly="readonly"/>
|
|
|
|
|
|
<div class="dialog-list" v-if="dialogList.length > 0">
|
|
|
@@ -36,7 +29,6 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="dialog-footer" v-if="item?.question">
|
|
|
- <!-- <p style="margin-top: 0" data-question-content="------">{{ item.question }}</p> -->
|
|
|
<Question
|
|
|
:question="item.question"
|
|
|
:index="key"
|
|
|
@@ -65,6 +57,7 @@
|
|
|
|
|
|
<div class="dialog-footer" v-else-if="item?.capacity"
|
|
|
:style="{ display: dialogConfig.type === 'paper' ? 'inline-block' : 'block' }">
|
|
|
+
|
|
|
<div v-if="type === 'knowledge'" @click="openCapacity(key)"
|
|
|
:class="[readonly || item.capacity.status === 'loading' ? 'disabled' : '']">
|
|
|
<a-spin :size="18" v-if="item.capacity.status === 'loading'" />
|
|
|
@@ -74,6 +67,7 @@
|
|
|
<icon-caret-right size="18" v-if="item.capacity.status === 'loaded' && !menuList[key]?.open" />
|
|
|
<icon-caret-down size="18" v-if="item.capacity.status === 'loaded' && menuList[key]?.open" />
|
|
|
</div>
|
|
|
+
|
|
|
<div v-else v-show="item.capacity.status === 'loading'"
|
|
|
:class="[readonly || item.capacity.status === 'loading' ? 'disabled' : '']">
|
|
|
<a-spin :size="18" />
|
|
|
@@ -104,6 +98,7 @@
|
|
|
<icon-caret-down size="12" v-if="documentKey === menuList[key].documentOpenIndex" />
|
|
|
<icon-caret-right size="12" v-else />
|
|
|
</div>
|
|
|
+
|
|
|
<div v-show="documentKey === menuList[key].documentOpenIndex">
|
|
|
<p v-for="(item, index) in document.list" :key="index">
|
|
|
<span>{{ item.title }}</span>
|
|
|
@@ -130,7 +125,6 @@
|
|
|
<em>DOCX,13.19KB</em>
|
|
|
</span>
|
|
|
</span>
|
|
|
- <!-- <span v-else v-html="getHTML(item.answer)"></span> -->
|
|
|
|
|
|
<Answer v-else
|
|
|
:answer="item.answer"
|
|
|
@@ -145,8 +139,6 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="dialog-footer" v-else>
|
|
|
- <!-- <span v-html="getHTML(item.answer)"></span> -->
|
|
|
-
|
|
|
<Answer
|
|
|
:answer="item.answer"
|
|
|
:index="key"
|
|
|
@@ -168,7 +160,14 @@
|
|
|
</header>
|
|
|
|
|
|
<section>
|
|
|
- <div v-for="(knowledge, knowledgeIndex) in item.reference" :key="knowledgeIndex">
|
|
|
+ <DocRefItem
|
|
|
+ v-for="(knowledge, knowledgeIndex) in item.reference"
|
|
|
+ :key="knowledgeIndex"
|
|
|
+ :knowledge="knowledge"
|
|
|
+ :knowledgeIndex="knowledgeIndex"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- <div v-for="(knowledge, knowledgeIndex) in item.reference" :key="knowledgeIndex">
|
|
|
<a-popover :title="knowledge.doc_name" position="left">
|
|
|
<div @click="openDocuementPage(knowledge)">
|
|
|
<span>{{ knowledgeIndex + 1 }}</span>
|
|
|
@@ -188,13 +187,11 @@
|
|
|
}
|
|
|
">{{ contentIndex + 1 }}</span>
|
|
|
</p>
|
|
|
- <!-- TODO详情暂时注释 -->
|
|
|
- <!-- <p @click="goKnowledge(knowledge.id)">查看详情></p> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</a-popover>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</section>
|
|
|
</div>
|
|
|
|
|
|
@@ -268,7 +265,7 @@ import { defineComponent, ref, onBeforeUnmount, onMounted, reactive, nextTick, i
|
|
|
import formatAnwserString from './answer-effect/format-anwser-string';
|
|
|
import initTempHistory, {getChatIdFromUrl} from './answer-effect/temp-history';
|
|
|
|
|
|
-import { getDocumentUrl } from '../ajax/document';
|
|
|
+// import { getDocumentUrl } from '../ajax/document';
|
|
|
|
|
|
import Question from './dialog-wrap/Question.vue';
|
|
|
import Suggestion from './dialog-wrap/Suggestion.vue';
|
|
|
@@ -278,6 +275,9 @@ import Answer from './dialog-wrap/Answer.vue';
|
|
|
import {huituSetTempImageIndex} from './dialog-wrap/temp-image'
|
|
|
|
|
|
import generateClientUniqueId from './dialog-wrap/generate-client-unique-id';
|
|
|
+import formatDialogItem from './dialog-wrap/format-dialog-item';
|
|
|
+
|
|
|
+import DocRefItem from './dialog-wrap/DocRefItem.vue';
|
|
|
|
|
|
export default defineComponent({
|
|
|
components: {
|
|
|
@@ -286,7 +286,9 @@ export default defineComponent({
|
|
|
Suggestion,
|
|
|
|
|
|
Question,
|
|
|
- Answer
|
|
|
+ Answer,
|
|
|
+
|
|
|
+ DocRefItem
|
|
|
},
|
|
|
props: [
|
|
|
"open",
|
|
|
@@ -324,46 +326,50 @@ export default defineComponent({
|
|
|
const tempHistory = initTempHistory();
|
|
|
|
|
|
const list = props.list.map((item, index) => {
|
|
|
- return {
|
|
|
- /**
|
|
|
- * 客户端生成的ID
|
|
|
- * 此数据作为列表唯一的key
|
|
|
- */
|
|
|
- client_gen_id: generateClientUniqueId(JSON.stringify(item)),
|
|
|
-
|
|
|
- answer: item.answer && replaceCode(item.answer, index),
|
|
|
- question: item.question,
|
|
|
- // 如果有引用
|
|
|
- reference: (item.reference && item.reference.chunks && item.reference.doc_aggs) ? item.reference.doc_aggs.map(reference => {
|
|
|
- return {
|
|
|
- id: reference.doc_id,
|
|
|
- doc_name: reference.doc_name,
|
|
|
- page: 0,
|
|
|
- content_ltks: [item.reference.chunks.find(chunk => chunk.doc_id == reference.doc_id).content_ltks]
|
|
|
- }
|
|
|
- }) : [],
|
|
|
-
|
|
|
- // 完整的引用数据: pdf文档引用效果需要使用此数据
|
|
|
- fullRefference: item.reference,
|
|
|
- // 合法可用的图片地址
|
|
|
- fullImageUrls: (() => {
|
|
|
- if(item.images){
|
|
|
- return item.images;
|
|
|
- }else{
|
|
|
- return [];
|
|
|
- }
|
|
|
- })(),
|
|
|
-
|
|
|
- // 如果有文件处理完拿第一个,后续有变动再改
|
|
|
- file: (item.files && item.files.length > 0) ? item.files.map(item => {
|
|
|
- const port = window.location.port ? `:${window.location.port}` : '';
|
|
|
- return {
|
|
|
- file_type: 'word',
|
|
|
- file_name: item.file_name,
|
|
|
- file_url: `http://${window.location.hostname}${port}${item.file_url}`,
|
|
|
- }
|
|
|
- })[0] : null,
|
|
|
- }
|
|
|
+ // const client_id = generateClientUniqueId(JSON.stringify(item));
|
|
|
+
|
|
|
+ return formatDialogItem(item, index);
|
|
|
+
|
|
|
+ // return {
|
|
|
+ // /**
|
|
|
+ // * 客户端生成的ID
|
|
|
+ // * 此数据作为列表唯一的key
|
|
|
+ // */
|
|
|
+ // client_gen_id: client_id,
|
|
|
+
|
|
|
+ // answer: item.answer && replaceCode(item.answer, index),
|
|
|
+ // question: item.question,
|
|
|
+ // // 如果有引用
|
|
|
+ // reference: (item.reference && item.reference.chunks && item.reference.doc_aggs) ? item.reference.doc_aggs.map(reference => {
|
|
|
+ // return {
|
|
|
+ // id: reference.doc_id,
|
|
|
+ // doc_name: reference.doc_name,
|
|
|
+ // page: 0,
|
|
|
+ // content_ltks: [item.reference.chunks.find(chunk => chunk.doc_id == reference.doc_id).content_ltks]
|
|
|
+ // }
|
|
|
+ // }) : [],
|
|
|
+
|
|
|
+ // // 完整的引用数据: pdf文档引用效果需要使用此数据
|
|
|
+ // fullRefference: item.reference,
|
|
|
+ // // 合法可用的图片地址
|
|
|
+ // fullImageUrls: (() => {
|
|
|
+ // if(item.images){
|
|
|
+ // return item.images;
|
|
|
+ // }else{
|
|
|
+ // return [];
|
|
|
+ // }
|
|
|
+ // })(),
|
|
|
+
|
|
|
+ // // 如果有文件处理完拿第一个,后续有变动再改
|
|
|
+ // file: (item.files && item.files.length > 0) ? item.files.map(item => {
|
|
|
+ // const port = window.location.port ? `:${window.location.port}` : '';
|
|
|
+ // return {
|
|
|
+ // file_type: 'word',
|
|
|
+ // file_name: item.file_name,
|
|
|
+ // file_url: `http://${window.location.hostname}${port}${item.file_url}`,
|
|
|
+ // }
|
|
|
+ // })[0] : null,
|
|
|
+ // }
|
|
|
});
|
|
|
|
|
|
const dialogList = reactive(list || []);
|
|
|
@@ -456,16 +462,16 @@ export default defineComponent({
|
|
|
const goKnowledge = () => {
|
|
|
// emit("go-document");
|
|
|
};
|
|
|
- // 点击文档,打开新页面
|
|
|
- const openDocuementPage = (knowledge) => {
|
|
|
- const doc_name = knowledge.doc_name;
|
|
|
- const doc_id = knowledge.id;
|
|
|
+ // // 点击文档,打开新页面
|
|
|
+ // const openDocuementPage = (knowledge) => {
|
|
|
+ // const doc_name = knowledge.doc_name;
|
|
|
+ // const doc_id = knowledge.id;
|
|
|
|
|
|
- // const pdf_url = `http://192.168.20.119:11080/v1/document/get/${doc_id}`;
|
|
|
- const pdf_url = getDocumentUrl(doc_id);
|
|
|
+ // // const pdf_url = `http://192.168.20.119:11080/v1/document/get/${doc_id}`;
|
|
|
+ // const pdf_url = getDocumentUrl(doc_id);
|
|
|
|
|
|
- window.open(pdf_url);
|
|
|
- }
|
|
|
+ // window.open(pdf_url);
|
|
|
+ // }
|
|
|
|
|
|
const addLoading = (data) => {
|
|
|
const mockData = DOCUMENT_RESULT;
|
|
|
@@ -899,7 +905,7 @@ export default defineComponent({
|
|
|
downloadFile,
|
|
|
|
|
|
openDocument,
|
|
|
- openDocuementPage,
|
|
|
+ // openDocuementPage,
|
|
|
|
|
|
show_info_btns
|
|
|
};
|