Merge remote-tracking branch 'origin/main'

This commit is contained in:
wangjiahao
2025-08-06 09:57:45 +08:00
10 changed files with 252 additions and 169 deletions
+2 -2
View File
@@ -45,8 +45,8 @@ export const supplierList: Array<{
{ name: 'qwen-long' },
{ name: 'qwen-long-latest' },
{ name: 'qwen-omni-turbo' },
{ name: 'qwen-omni-turbo-realtime' },
{ name: 'qwen-omni-turbo-realtime-latest' },
/* { name: 'qwen-omni-turbo-realtime' },
{ name: 'qwen-omni-turbo-realtime-latest' }, */
{ name: 'qvq-max' },
{ name: 'qvq-max-latest' },
{ name: 'qvq-plus' },
+104 -95
View File
@@ -51,6 +51,7 @@ function listDs() {
const innerDs = ref()
const loading = ref(false)
const statusLoading = ref(false)
function showDs() {
listDs()
@@ -68,12 +69,18 @@ function selectDsInDialog(ds: any) {
function confirmSelectDs() {
if (innerDs.value) {
statusLoading.value = true
//check first
datasourceApi.check_by_id(innerDs.value).then((res: any) => {
if (res) {
createChat(innerDs.value)
}
})
datasourceApi
.check_by_id(innerDs.value)
.then((res: any) => {
if (res) {
createChat(innerDs.value)
}
})
.finally(() => {
statusLoading.value = false
})
}
}
@@ -117,98 +124,100 @@ defineExpose({
</script>
<template>
<el-drawer
v-model="datasourceConfigvVisible"
:close-on-click-modal="false"
size="calc(100% - 100px)"
modal-class="datasource-drawer-chat"
direction="btt"
:before-close="beforeClose"
:show-close="false"
>
<template #header="{ close }">
<span style="white-space: nowrap">{{ $t('qa.select_datasource') }}</span>
<div class="flex-center" style="width: 100%">
<el-input
v-model="keywords"
clearable
style="width: 320px"
:placeholder="$t('datasource.search')"
>
<template #prefix>
<el-icon>
<icon_searchOutline_outlined />
</el-icon>
</template>
</el-input>
</div>
<el-icon style="cursor: pointer" @click="close">
<icon_close_outlined></icon_close_outlined>
</el-icon>
</template>
<div v-if="datasourceListWithSearch.length" class="card-content">
<el-row :gutter="16" class="w-full">
<el-col
v-for="ele in datasourceListWithSearch"
:key="ele.id"
:xs="24"
:sm="12"
:md="12"
:lg="8"
:xl="6"
class="mb-16"
>
<Card
:id="ele.id"
<div v-loading.body.fullscreen.lock="loading || statusLoading">
<el-drawer
v-model="datasourceConfigvVisible"
:close-on-click-modal="false"
size="calc(100% - 100px)"
modal-class="datasource-drawer-chat"
direction="btt"
:before-close="beforeClose"
:show-close="false"
>
<template #header="{ close }">
<span style="white-space: nowrap">{{ $t('qa.select_datasource') }}</span>
<div class="flex-center" style="width: 100%">
<el-input
v-model="keywords"
clearable
style="width: 320px"
:placeholder="$t('datasource.search')"
>
<template #prefix>
<el-icon>
<icon_searchOutline_outlined />
</el-icon>
</template>
</el-input>
</div>
<el-icon style="cursor: pointer" @click="close">
<icon_close_outlined></icon_close_outlined>
</el-icon>
</template>
<div v-if="datasourceListWithSearch.length" class="card-content">
<el-row :gutter="16" class="w-full">
<el-col
v-for="ele in datasourceListWithSearch"
:key="ele.id"
:name="ele.name"
:type="ele.type"
:type-name="ele.type_name"
:num="ele.num"
:is-selected="ele.id === innerDs"
:description="ele.description"
@select-ds="selectDsInDialog(ele)"
></Card>
</el-col>
</el-row>
</div>
<template v-if="!keywords && !datasourceListWithSearch.length && !searchLoading">
<EmptyBackground
class="datasource-yet_btn"
:description="$t('datasource.data_source_yet')"
img-type="noneWhite"
/>
:xs="24"
:sm="12"
:md="12"
:lg="8"
:xl="6"
class="mb-16"
>
<Card
:id="ele.id"
:key="ele.id"
:name="ele.name"
:type="ele.type"
:type-name="ele.type_name"
:num="ele.num"
:is-selected="ele.id === innerDs"
:description="ele.description"
@select-ds="selectDsInDialog(ele)"
></Card>
</el-col>
</el-row>
</div>
<template v-if="!keywords && !datasourceListWithSearch.length && !searchLoading">
<EmptyBackground
class="datasource-yet_btn"
:description="$t('datasource.data_source_yet')"
img-type="noneWhite"
/>
<div style="text-align: center; margin-top: -10px">
<el-button type="primary" @click="handleAddDatasource">
<template #icon>
<icon_add_outlined></icon_add_outlined>
</template>
{{ $t('datasource.new_data_source') }}
</el-button>
</div>
</template>
<EmptyBackground
v-if="!!keywords && !datasourceListWithSearch.length"
:description="$t('datasource.relevant_content_found')"
class="datasource-yet"
img-type="tree"
/>
<template #footer>
<div class="dialog-footer">
<el-button secondary :disabled="loading" @click="hideDs">{{
$t('common.cancel')
}}</el-button>
<el-button
:type="loading || innerDs === undefined ? 'info' : 'primary'"
:disabled="loading || innerDs === undefined"
@click="confirmSelectDs"
>
{{ $t('datasource.confirm') }}
</el-button>
</div>
</template>
</el-drawer>
<div style="text-align: center; margin-top: -10px">
<el-button type="primary" @click="handleAddDatasource">
<template #icon>
<icon_add_outlined></icon_add_outlined>
</template>
{{ $t('datasource.new_data_source') }}
</el-button>
</div>
</template>
<EmptyBackground
v-if="!!keywords && !datasourceListWithSearch.length"
:description="$t('datasource.relevant_content_found')"
class="datasource-yet"
img-type="tree"
/>
<template #footer>
<div class="dialog-footer">
<el-button secondary :disabled="loading" @click="hideDs">{{
$t('common.cancel')
}}</el-button>
<el-button
:type="loading || statusLoading || innerDs === undefined ? 'info' : 'primary'"
:disabled="loading || statusLoading || innerDs === undefined"
@click="confirmSelectDs"
>
{{ $t('datasource.confirm') }}
</el-button>
</div>
</template>
</el-drawer>
</div>
</template>
<style lang="less">
@@ -1,7 +1,8 @@
<script setup lang="ts">
import BaseAnswer from './BaseAnswer.vue'
import { Chat, chatApi, ChatInfo, type ChatMessage, ChatRecord, questionApi } from '@/api/chat.ts'
import { computed, nextTick, onBeforeUnmount, ref } from 'vue'
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
import ChartBlock from '@/views/chat/chat-block/ChartBlock.vue'
const props = withDefaults(
defineProps<{
chatList?: Array<ChatInfo>
@@ -234,11 +235,18 @@ onBeforeUnmount(() => {
stop()
})
onMounted(() => {
if (props.message?.record?.id && props.message?.record?.finish) {
getChatData(props.message.record.id)
}
})
defineExpose({ sendMessage, index: () => index.value, stop })
</script>
<template>
<BaseAnswer v-if="message" :message="message" :reasoning-name="reasoningName" :loading="_loading">
<ChartBlock style="margin-top: 12px" :message="message" />
<slot></slot>
<template #tool>
<slot name="tool"></slot>
@@ -1,8 +1,9 @@
<script setup lang="ts">
import BaseAnswer from './BaseAnswer.vue'
import { chatApi, ChatInfo, type ChatMessage, ChatRecord } from '@/api/chat.ts'
import { computed, nextTick, onBeforeUnmount, ref } from 'vue'
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
import MdComponent from '@/views/chat/component/MdComponent.vue'
import ChartBlock from '@/views/chat/chat-block/ChartBlock.vue'
const props = withDefaults(
defineProps<{
chatList?: Array<ChatInfo>
@@ -174,6 +175,7 @@ const sendMessage = async () => {
break
case 'predict-success':
//currentChat.value.records[_index].predict_data = data.content
getChatPredictData(_currentChat.value.records[index.value].id)
emits('finish', currentRecord.id)
break
case 'predict_finish':
@@ -198,6 +200,33 @@ const sendMessage = async () => {
}
}
const chartBlockRef = ref()
function getChatPredictData(recordId?: number) {
chatApi.get_chart_predict_data(recordId).then((response) => {
_currentChat.value.records.forEach((record) => {
if (record.id === recordId) {
record.predict_data = response ?? []
if (record.predict_data.length > 1) {
getChatData(recordId)
}
}
})
})
}
function getChatData(recordId?: number) {
chatApi.get_chart_data(recordId).then((response) => {
_currentChat.value.records.forEach((record) => {
if (record.id === recordId) {
record.data = response
console.log(record.data)
}
})
})
}
function stop() {
stopFlag.value = true
_loading.value = false
@@ -208,12 +237,25 @@ onBeforeUnmount(() => {
stop()
})
onMounted(() => {
if (props.message?.record?.id && props.message?.record?.finish) {
getChatPredictData(props.message.record.id)
}
})
defineExpose({ sendMessage, index: () => index.value, chatList: () => _chatList, stop })
</script>
<template>
<BaseAnswer v-if="message" :message="message" :reasoning-name="['predict']" :loading="_loading">
<MdComponent :message="message.record?.predict_content" style="margin-top: 12px" />
<ChartBlock
v-if="message.record?.predict_data?.length > 0 && message.record?.data"
ref="chartBlockRef"
style="margin-top: 12px"
:message="message"
is-predict
/>
<slot></slot>
<template #tool>
<slot name="tool"></slot>
@@ -81,19 +81,17 @@ const data = computed(() => {
}
}
} else {
if (props.message?.record?.predict_data.length > 0) {
if (props.message?.record?.predict_data?.length > 0) {
_list = props.message?.record?.predict_data
}
}
if (_list.length == 0) {
return _list
}
if (dataObject.value.data && dataObject.value.data.length > 0) {
if (dataObject.value.data && dataObject.value.data?.length > 0) {
return concat(dataObject.value.data, _list)
}
return _list
} else {
return dataObject.value.data
@@ -180,6 +178,10 @@ function onTypeChange(val: any) {
chartRef.value?.onTypeChange()
}
function reloadChart() {
chartRef.value?.onTypeChange()
}
const dialogVisible = ref(false)
function openFullScreen() {
@@ -274,6 +276,10 @@ function exportToImage() {
exportRef.value?.hide()
}
defineExpose({
reloadChart,
})
watch(
() => chartObject.value?.type,
(val) => {
+9 -17
View File
@@ -160,7 +160,6 @@
@error="onChartAnswerError"
@stop="onChatStop"
>
<ChartBlock style="margin-top: 12px" :message="message" />
<ErrorInfo :error="message.record?.error" class="error-container" />
<template #tool>
<ChatToolBar v-if="!message.isTyping" :message="message">
@@ -265,7 +264,6 @@
@error="onPredictAnswerError"
@stop="onChatStop"
>
<ChartBlock style="margin-top: 12px" :message="message" is-predict />
<ErrorInfo :error="message.record?.error" class="error-container" />
<template #tool>
<ChatToolBar v-if="!message.isTyping" :message="message" />
@@ -337,7 +335,6 @@ import ChartAnswer from './answer/ChartAnswer.vue'
import AnalysisAnswer from './answer/AnalysisAnswer.vue'
import PredictAnswer from './answer/PredictAnswer.vue'
import UserChat from './chat-block/UserChat.vue'
import ChartBlock from './chat-block/ChartBlock.vue'
import RecommendQuestion from './RecommendQuestion.vue'
import ChatListContainer from './ChatListContainer.vue'
import ChatCreator from '@/views/chat/ChatCreator.vue'
@@ -345,7 +342,7 @@ import ErrorInfo from './ErrorInfo.vue'
import ChatToolBar from './ChatToolBar.vue'
import { dsTypeWithImg } from '@/views/ds/js/ds-type'
import { useI18n } from 'vue-i18n'
import { find } from 'lodash-es'
import { find, forEach } from 'lodash-es'
import icon_new_chat_outlined from '@/assets/svg/icon_new_chat_outlined.svg'
import icon_sidebar_outlined from '@/assets/svg/icon_sidebar_outlined.svg'
import icon_replace_outlined from '@/assets/svg/icon_replace_outlined.svg'
@@ -490,9 +487,14 @@ function getChatList(callback?: () => void) {
})
}
function onClickHistory(chat: Chat) {
function onClickHistory(chat: ChatInfo) {
scrollToBottom()
console.debug('click history', chat)
forEach(chat?.records, (record: ChatRecord) => {
// getChatData(record.id)
if (record.predict_record_id) {
// getChatPredictData(record.id)
}
})
}
const currentChatEngineType = computed(() => {
@@ -629,16 +631,6 @@ const sendMessage = async ($event: any = {}) => {
})
}
function getChatPredictData(recordId?: number) {
chatApi.get_chart_predict_data(recordId).then((response) => {
currentChat.value.records.forEach((record) => {
if (record.id === recordId) {
record.predict_data = response ?? []
}
})
})
}
const analysisAnswerRef = ref()
async function onAnalysisAnswerFinish(id: number) {
@@ -704,7 +696,7 @@ const predictAnswerRef = ref()
async function onPredictAnswerFinish(id: number) {
loading.value = false
isTyping.value = false
getChatPredictData(id)
console.debug('onPredictAnswerFinish: ', id)
//await getRecommendQuestions(id)
}
function onPredictAnswerError() {
+4 -4
View File
@@ -109,12 +109,12 @@ const handleAddEmbedded = (val: any) => {
const wsChanged = (val: any) => {
dsForm.private_list = []
dsForm.oid = val
getDsList()
getDsList(true)
}
const getDsList = () => {
const getDsList = (change: boolean = false) => {
dsApi(dsForm.oid).then((res: any) => {
dsListOptions.value = res || []
if (!currentEmbedded.id) {
if (change || !currentEmbedded.id) {
dsForm.private_list = dsListOptions.value.map((ele) => ele.id)
}
})
@@ -125,7 +125,7 @@ const handleBaseEmbedded = (row: any) => {
if (row) {
Object.assign(dsForm, JSON.parse(row.configuration))
}
getDsList()
getDsList(false)
ruleConfigvVisible.value = true
dialogTitle.value = row?.id
? t('embedded.edit_basic_applications')