|
|
@ -1,4 +1,5 @@
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
|
|
|
import { LLMToolOutputData } from '@/types/chatComplete';
|
|
|
|
import { createOutline, reloadOutline, gitNetworkOutline } from 'ionicons/icons'
|
|
|
|
import { createOutline, reloadOutline, gitNetworkOutline } from 'ionicons/icons'
|
|
|
|
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
defineOptions({
|
|
|
@ -15,7 +16,10 @@ const props = defineProps<{
|
|
|
|
assistant?: boolean,
|
|
|
|
assistant?: boolean,
|
|
|
|
cursor?: boolean,
|
|
|
|
cursor?: boolean,
|
|
|
|
edit?: boolean,
|
|
|
|
edit?: boolean,
|
|
|
|
change?: boolean
|
|
|
|
change?: boolean,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
toolRunning?: boolean,
|
|
|
|
|
|
|
|
toolOutput?: any[],
|
|
|
|
}>()
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
const emit = defineEmits<{
|
|
|
@ -38,6 +42,19 @@ const displayTime = computed(() => {
|
|
|
|
return ''
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const toolOutput: Ref<LLMToolOutputData[] | undefined> = toRef(props, 'toolOutput')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const toolRunningTitle = computed(() => {
|
|
|
|
|
|
|
|
if (props.toolRunning) {
|
|
|
|
|
|
|
|
if (toolOutput.value && toolOutput.value.length > 0) {
|
|
|
|
|
|
|
|
return '正在进行:' + toolOutput.value[0].name;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return '正在运行工具...';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return '工具运行结果';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
@ -70,6 +87,21 @@ const displayTime = computed(() => {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="message-content">
|
|
|
|
<div class="message-content">
|
|
|
|
<div class="message-body">
|
|
|
|
<div class="message-body">
|
|
|
|
|
|
|
|
<div class="preprocess-tool-info-container" v-if="toolOutput && toolOutput.length > 0">
|
|
|
|
|
|
|
|
<ion-accordion-group expand="inset">
|
|
|
|
|
|
|
|
<ion-accordion value="1">
|
|
|
|
|
|
|
|
<ion-item slot="header" color="light">
|
|
|
|
|
|
|
|
<loading-title :loading="props.toolRunning">{{ toolRunningTitle }}</loading-title>
|
|
|
|
|
|
|
|
</ion-item>
|
|
|
|
|
|
|
|
<div class="ion-padding" slot="content">
|
|
|
|
|
|
|
|
<div v-for="item in toolOutput" :key="item.name">
|
|
|
|
|
|
|
|
<div class="text-selectable tool-output-title">{{ item.name }}</div>
|
|
|
|
|
|
|
|
<markdown-parser :md="item.output"></markdown-parser>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</ion-accordion>
|
|
|
|
|
|
|
|
</ion-accordion-group>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<markdown-parser v-if="props.content !== undefined" :md="props.content" :cursor="props.cursor"></markdown-parser>
|
|
|
|
<markdown-parser v-if="props.content !== undefined" :md="props.content" :cursor="props.cursor"></markdown-parser>
|
|
|
|
<div class="message-error text-selectable" v-else-if="props.error">
|
|
|
|
<div class="message-error text-selectable" v-else-if="props.error">
|
|
|
|
{{ props.error }}
|
|
|
|
{{ props.error }}
|
|
|
@ -95,7 +127,7 @@ const displayTime = computed(() => {
|
|
|
|
.message {
|
|
|
|
.message {
|
|
|
|
display: grid;
|
|
|
|
display: grid;
|
|
|
|
grid-template-areas: "avatar-col message-header avatar-balance" "avatar-col message-content avatar-balance";
|
|
|
|
grid-template-areas: "avatar-col message-header avatar-balance" "avatar-col message-content avatar-balance";
|
|
|
|
grid-template-columns: 46px 1fr 46px;
|
|
|
|
grid-template-columns: 46px minmax(0, 1fr) 46px;
|
|
|
|
grid-template-rows: auto auto;
|
|
|
|
grid-template-rows: auto auto;
|
|
|
|
column-gap: 16px;
|
|
|
|
column-gap: 16px;
|
|
|
|
row-gap: 8px;
|
|
|
|
row-gap: 8px;
|
|
|
@ -104,7 +136,7 @@ const displayTime = computed(() => {
|
|
|
|
|
|
|
|
|
|
|
|
@media (max-width: 767px) {
|
|
|
|
@media (max-width: 767px) {
|
|
|
|
grid-template-areas: "avatar-col message-header" "message-content message-content";
|
|
|
|
grid-template-areas: "avatar-col message-header" "message-content message-content";
|
|
|
|
grid-template-columns: auto 1fr;
|
|
|
|
grid-template-columns: auto minmax(0, 1fr);
|
|
|
|
grid-template-rows: auto auto;
|
|
|
|
grid-template-rows: auto auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -170,6 +202,36 @@ const displayTime = computed(() => {
|
|
|
|
width: 100%;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.preprocess-tool-info-container {
|
|
|
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ion-accordion-group {
|
|
|
|
|
|
|
|
-webkit-margin-start: 0;
|
|
|
|
|
|
|
|
margin-inline-start: 0;
|
|
|
|
|
|
|
|
-webkit-margin-end: 0;
|
|
|
|
|
|
|
|
margin-inline-end: 0;
|
|
|
|
|
|
|
|
margin-top: 0;
|
|
|
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ion-accordion {
|
|
|
|
|
|
|
|
box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1),
|
|
|
|
|
|
|
|
0 2px 4px -1px rgba(0,0,0,0.06),
|
|
|
|
|
|
|
|
0 -1px 4px -1px rgba(0,0,0,0.1),
|
|
|
|
|
|
|
|
0 0 0 1px rgba(53,72,91,0.07000000000000001);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.tool-output-title {
|
|
|
|
|
|
|
|
font-size: 1.25rem;
|
|
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.loading-title-container {
|
|
|
|
|
|
|
|
justify-content: start;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.message-error {
|
|
|
|
.message-error {
|
|
|
|
position: relative;
|
|
|
|
position: relative;
|
|
|
|
padding: .75rem 1.25rem;
|
|
|
|
padding: .75rem 1.25rem;
|
|
|
|