feat: 全新智能体功能

- 基于先进智能体框架,增加智能体编排功能
- 增加智能体聊天,并对接持久化
This commit is contained in:
2026-05-25 11:42:48 +08:00
parent 6c3d98eaac
commit 72df00f25b
168 changed files with 22045 additions and 400 deletions

View File

@@ -1,31 +1,23 @@
<script setup lang="ts">
import type { ServerSentEventMessage } from 'fetch-event-stream';
import type {ServerSentEventMessage} from 'fetch-event-stream';
import type { ChatThinkingBlockStatus } from '@easyflow/common-ui';
import type { BotInfo } from '@easyflow/types';
import type {ChatThinkingBlockStatus} from '@easyflow/common-ui';
import {ChatThinkingBlock, ChatTimeMarkdown} from '@easyflow/common-ui';
import type {BotInfo} from '@easyflow/types';
import {
computed,
nextTick,
onBeforeUnmount,
onMounted,
ref,
watch,
} from 'vue';
import { useRoute, useRouter } from 'vue-router';
import {computed, nextTick, onBeforeUnmount, onMounted, ref, watch,} from 'vue';
import {useRoute, useRouter} from 'vue-router';
import {LOGIN_PATH} from '@easyflow/constants';
import {IconifyIcon} from '@easyflow/icons';
import {$t} from '@easyflow/locales';
import {useAccessStore} from '@easyflow/stores';
import {createChatVariantSwitchController, uuid} from '@easyflow/utils';
import { ChatThinkingBlock, ChatTimeMarkdown } from '@easyflow/common-ui';
import { LOGIN_PATH } from '@easyflow/constants';
import { IconifyIcon } from '@easyflow/icons';
import { $t } from '@easyflow/locales';
import { useAccessStore } from '@easyflow/stores';
import { createChatVariantSwitchController, uuid } from '@easyflow/utils';
import {useTitle} from '@vueuse/core';
import {ElAvatar, ElButton, ElInput, ElMessage, ElSkeleton} from 'element-plus';
import { useTitle } from '@vueuse/core';
import { ElAvatar, ElButton, ElInput, ElMessage, ElSkeleton } from 'element-plus';
import { refreshTokenApi } from '#/api/core';
import { baseRequestClient, sseClient } from '#/api/request';
import {refreshTokenApi} from '#/api/core';
import {baseRequestClient, sseClient} from '#/api/request';
import defaultBotAvatar from '#/assets/ai/bot/defaultBotAvatar.png';
import ChatMessageActionBar from '#/components/chat-workspace/ChatMessageActionBar.vue';
@@ -986,7 +978,20 @@ const getRenderableSegments = (message: BubbleMessage) => {
content: message.content,
});
}
return segments;
const textSegments = segments.filter(
(segment): segment is AssistantTextSegment => segment.type === 'text',
);
if (textSegments.length <= 1) {
return segments;
}
return [
...segments.filter((segment) => segment.type !== 'text'),
{
id: `${message.id}-merged-text`,
type: 'text' as const,
content: textSegments.map((segment) => segment.content).join(''),
},
];
};
const hasAssistantRenderableContent = (message: BubbleMessage) => {
@@ -1221,7 +1226,7 @@ const onSseMessage = (event: ServerSentEventMessage) => {
if (eventType === 'MESSAGE' && eventDomain === 'LLM') {
stopAssistantThinking();
const deltaRaw = sseData?.payload?.delta ?? sseData?.payload?.content ?? '';
const deltaRaw = sseData?.payload?.delta ?? '';
const delta =
typeof deltaRaw === 'string'
? deltaRaw
@@ -1856,6 +1861,7 @@ function prefetchVisibleVariants() {
<ChatTimeMarkdown
class="public-chat-markdown"
:content="segment.content"
:streaming="item.loading"
/>
</template>
<template v-else-if="segment.type === 'thinking'">