可信代码库-AI大模型对话优化软件详情问答展示
This commit is contained in:
@@ -1,24 +1,27 @@
|
||||
<template>
|
||||
<div class="secret-container">
|
||||
<div class="title">以下是Redis的软件详情</div>
|
||||
<div class="mt-3">
|
||||
<OssDetailCp ref="ossDetailRef" :versionId="versionId"/>
|
||||
</div>
|
||||
<div v-if="versionId">
|
||||
<div class="title">以下是{{props.software_name}}的软件详情</div>
|
||||
<div class="mt-3">
|
||||
<OssDetailCp ref="ossDetailRef" :versionId="versionId"/>
|
||||
</div>
|
||||
|
||||
<d-button v-if="isLogin" class="output-btn" @click="openSubscription">订阅</d-button>
|
||||
<div class="bubble-bottom-operations">
|
||||
<img onclick="handleRefresh()" src="@/assets/imgs/jyh/ai/icon_generate.png" />
|
||||
<i class="icon-file" title="复制" onclick="handleFile()"></i>
|
||||
<i class="icon-like" title="点赞" onclick="handleLike()"></i>
|
||||
<i class="icon-dislike" title="踩" onclick="handleDislike()"></i>
|
||||
<i class="icon-clever-customer" title="智能客服" onclick="handleCustomerService()"></i>
|
||||
<i class="icon-more-operate" title="更多操作" onclick="handleMore()"></i>
|
||||
<d-button v-if="isLogin" class="output-btn" @click="openSubscription">订阅</d-button>
|
||||
<div class="bubble-bottom-operations">
|
||||
<img onclick="handleRefresh()" src="@/assets/imgs/jyh/ai/icon_generate.png" />
|
||||
<i class="icon-file" title="复制" onclick="handleFile()"></i>
|
||||
<i class="icon-like" title="点赞" onclick="handleLike()"></i>
|
||||
<i class="icon-dislike" title="踩" onclick="handleDislike()"></i>
|
||||
<i class="icon-clever-customer" title="智能客服" onclick="handleCustomerService()"></i>
|
||||
<i class="icon-more-operate" title="更多操作" onclick="handleMore()"></i>
|
||||
</div>
|
||||
</div>
|
||||
<NoData v-else />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, watch, nextTick } from 'vue';
|
||||
import { ref, reactive, onMounted, watch, nextTick,defineProps } from 'vue';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import { getOrgInfo } from '@/views/Org/hooks/orgInfo';
|
||||
import { Message } from 'vue-devui';
|
||||
@@ -32,12 +35,20 @@ import { useTimeFormat } from '@/utils/hooks/useTimeFormat';
|
||||
import { useGlobalInfoStore } from '@/stores/Global';
|
||||
import OssDetailCp from './OssDetail/index.vue'
|
||||
|
||||
const props = defineProps({
|
||||
id: {
|
||||
type: String || Number
|
||||
},
|
||||
software_name: {
|
||||
type: String || Number
|
||||
}
|
||||
})
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const filterTableRef = ref();
|
||||
const ossDetailRef = ref(null);
|
||||
const versionId = ref('3238');
|
||||
const versionId = ref(props.id);
|
||||
const { namespace } = getOrgInfo();
|
||||
const userInfo = useAccountStore();
|
||||
const { isLogin } = storeToRefs(userInfo);
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<!--预警列表-->
|
||||
<WarningList v-else-if="msg.type===2"/>
|
||||
<!--软件详情-->
|
||||
<OssDetail v-else-if="msg.type===3"/>
|
||||
<!--软件详情-->
|
||||
<OssDetail :id="msg.id" :software_name="msg.software_name||''" v-else-if="msg.type==='critical_software_info'"/>
|
||||
<!--列表展示-->
|
||||
<AIList v-else-if="msg.type==='df'" :content="msg.content"/>
|
||||
<!--text或者富文本展示-->
|
||||
<Other v-else :content="msg.content"></Other>
|
||||
@@ -261,7 +261,7 @@ const getAIAnswer = async (content) => {
|
||||
});
|
||||
|
||||
if(response.data.type) {
|
||||
const {text,type,id} = response.data;
|
||||
const {text,type,id,table_name=[]} = response.data;
|
||||
messages.value[messages.value.length - 1].id = id;
|
||||
if(type==='text') {
|
||||
messages.value[messages.value.length - 1].content = text;
|
||||
@@ -271,6 +271,16 @@ const getAIAnswer = async (content) => {
|
||||
messages.value[messages.value.length - 1].content = response.data[type];
|
||||
messages.value[messages.value.length - 1].loading = false;
|
||||
messages.value[messages.value.length - 1].type = 'df';
|
||||
|
||||
// 判断是否软件详情
|
||||
if(table_name.length===1&&table_name[0]==='critical_software_info') {
|
||||
let arr = JSON.parse(response.data[type]);
|
||||
if(arr&&arr.length===1) {
|
||||
messages.value[messages.value.length - 1].type = 'critical_software_info';
|
||||
messages.value[messages.value.length - 1].id = arr[0]?.id;
|
||||
messages.value[messages.value.length - 1].software_name = arr[0]?.software_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
fetchFollowupQuestions(content,id)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user