feat: Introduce Wiki Fixer agent and related functionalities

- Added a new built-in agent, "Wiki Fixer," designed to repair and optimize Wiki pages based on linter issues, with multilingual support for enhanced accessibility.
- Implemented a corresponding system prompt detailing the agent's role, mission, and workflow for effective issue resolution.
- Introduced new API functions for listing and updating wiki issues, allowing for better management of content conflicts and errors.
- Enhanced the frontend with new UI elements to display pending issues and facilitate auto-fixing, improving user interaction with the Wiki content.

These changes significantly enhance the agent's capabilities for maintaining the accuracy and quality of Wiki pages, fostering a more reliable knowledge base.
This commit is contained in:
wizardchen
2026-04-10 17:56:17 +08:00
parent 3e47376539
commit bd096454e1
29 changed files with 1724 additions and 50 deletions
+15 -1
View File
@@ -1,5 +1,5 @@
<template>
<div class="bot_msg">
<div class="bot_msg" :class="{ 'is-embedded': embeddedMode }">
<div style="display: flex;flex-direction: column; gap:8px">
<!-- 显示@的知识库和文件(非 Agent 模式下显示) -->
<div v-if="!session.isAgentMode && mentionedItems && mentionedItems.length > 0" class="mentioned_items">
@@ -127,6 +127,10 @@ const props = defineProps({
isFirstEnter: {
type: Boolean,
required: false
},
embeddedMode: {
type: Boolean,
default: false
}
});
@@ -298,6 +302,16 @@ onBeforeUnmount(() => {
@import '../../../components/css/markdown.less';
@import '../../../components/css/chat-message-shared.less';
.bot_msg {
&.is-embedded {
width: 100%;
:deep(.agent-stream-display) {
width: 100%;
}
}
}
// 内容包装器 - 与 Agent 模式的 answer 样式一致
.content-wrapper {
background: var(--td-bg-color-container);
@@ -197,6 +197,7 @@ const getWebSearchDisplayText = (item) => {
background-color: var(--td-bg-color-container);
border: .5px solid var(--td-component-stroke);
box-shadow: 0 2px 4px rgba(7, 192, 95, 0.08);
box-sizing: border-box;
overflow: hidden;
box-sizing: border-box;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
+13 -2
View File
@@ -1,5 +1,5 @@
<template>
<div class="user_msg_container" ref="containerRef">
<div class="user_msg_container" ref="containerRef" :class="{ 'is-embedded': embeddedMode }">
<!-- 显示@的知识库和文件 -->
<div v-if="mentioned_items && mentioned_items.length > 0" class="mentioned_items">
<span
@@ -84,6 +84,10 @@ const props = defineProps({
type: String,
required: false,
default: ''
},
embeddedMode: {
type: Boolean,
default: false
}
});
@@ -216,6 +220,14 @@ const closePreImg = () => {
}
}
.user_msg_container {
&.is-embedded {
.user_msg {
max-width: 100%;
}
}
}
.user_msg {
width: max-content;
max-width: 776px;
@@ -233,7 +245,6 @@ const closePreImg = () => {
font-size: 15px;
text-align: justify;
word-break: break-all;
max-width: 100%;
box-sizing: border-box;
}
+53 -8
View File
@@ -1,7 +1,7 @@
<template>
<div class="chat">
<div class="chat" :class="{ 'is-embedded': embeddedMode }">
<div ref="scrollContainer" class="chat_scroll_box" @scroll="handleScroll">
<div class="msg_list">
<div class="msg_list" :class="{ 'is-embedded': embeddedMode }">
<!-- 消息列表骨架屏 -->
<div v-if="historyLoading && messagesList.length === 0" class="msg-skeleton-list">
<div class="msg-skeleton msg-skeleton-user">
@@ -47,11 +47,11 @@
</div>
<div v-for="(session, id) in messagesList" :key='id'>
<div v-if="session.role == 'user'">
<usermsg :content="session.content" :mentioned_items="session.mentioned_items" :images="session.images" :attachments="session.attachments"></usermsg>
<usermsg :content="session.content" :mentioned_items="session.mentioned_items" :images="session.images" :attachments="session.attachments" :embeddedMode="embeddedMode"></usermsg>
</div>
<div v-if="session.role == 'assistant'">
<botmsg :content="session.content" :session="session" :user-query="getUserQuery(id)" @scroll-bottom="scrollToBottom"
:isFirstEnter="isFirstEnter"></botmsg>
:isFirstEnter="isFirstEnter" :embeddedMode="embeddedMode"></botmsg>
</div>
</div>
<div v-if="loading"
@@ -69,7 +69,7 @@
<t-icon name="chevron-down" size="20px" />
</div>
</transition>
<div style="min-height: 115px; margin: 16px auto 4px;width: 100%;max-width: 800px;">
<div class="input-container" :class="{ 'is-embedded': embeddedMode }">
<InputField
ref="inputFieldRef"
@send-msg="(query, modelId, mentionedItems, imageFiles, attachmentFiles) => sendMsg(query, modelId, mentionedItems, imageFiles, attachmentFiles)"
@@ -77,6 +77,7 @@
:isReplying="isReplying"
:sessionId="session_id"
:assistantMessageId="currentAssistantMessageId"
:embeddedMode="embeddedMode"
></InputField>
</div>
</div>
@@ -91,7 +92,7 @@
</template>
<script setup>
import { storeToRefs } from 'pinia';
import { ref, onMounted, onUnmounted, nextTick, watch, reactive, onBeforeUnmount } from 'vue';
import { ref, onMounted, onUnmounted, nextTick, watch, reactive, onBeforeUnmount, defineProps } from 'vue';
import { useRoute, useRouter, onBeforeRouteLeave, onBeforeRouteUpdate } from 'vue-router';
import InputField from '../../components/Input-field.vue';
import botmsg from './components/botmsg.vue';
@@ -106,6 +107,14 @@ import { useI18n } from 'vue-i18n';
import { useUIStore } from '@/stores/ui';
import KnowledgeBaseEditorModal from '@/views/knowledge/KnowledgeBaseEditorModal.vue';
import { useKnowledgeBaseCreationNavigation } from '@/hooks/useKnowledgeBaseCreationNavigation';
const props = defineProps({
session_id: { type: String, default: '' },
agentId: { type: String, default: '' },
kbIds: { type: Array, default: () => [] },
embeddedMode: { type: Boolean, default: false }
});
const usemenuStore = useMenuStore();
const useSettingsStoreInstance = useSettingsStore();
const uiStore = useUIStore();
@@ -115,7 +124,7 @@ const { menuArr, isFirstSession, firstQuery, firstMentionedItems, firstModelId,
const { output, onChunk, isStreaming, isLoading, error, startStream, stopStream } = useStream();
const route = useRoute();
const router = useRouter();
const session_id = ref(route.params.chatid);
const session_id = ref(props.session_id || route.params.chatid);
const sessionData = ref(null);
const inputFieldRef = ref();
const created_at = ref('');
@@ -1140,10 +1149,16 @@ onMounted(async () => {
messagesList.splice(0);
// 若从智能体列表点击共享智能体进入,URL 带 agent_id 与 source_tenant_id,同步到 store
const agentIdFromQuery = route.query.agent_id && String(route.query.agent_id);
const agentIdFromQuery = props.embeddedAgentId || (route.query.agent_id && String(route.query.agent_id));
const sourceTenantIdFromQuery = route.query.source_tenant_id && String(route.query.source_tenant_id);
if (agentIdFromQuery && sourceTenantIdFromQuery) {
useSettingsStoreInstance.selectAgent(agentIdFromQuery, sourceTenantIdFromQuery);
} else if (agentIdFromQuery) {
useSettingsStoreInstance.selectAgent(agentIdFromQuery, null);
}
if (props.embeddedKbIds && props.embeddedKbIds.length > 0) {
useSettingsStoreInstance.selectKnowledgeBases(props.embeddedKbIds);
}
// 初始化状态:加载历史消息时不应显示loading
@@ -1211,6 +1226,21 @@ onBeforeRouteUpdate((to, from, next) => {
max-width: calc(100vw - 260px);
min-width: 400px;
&.is-embedded {
max-width: 100%;
min-width: 100%;
padding: 0;
overflow-x: hidden;
}
&.is-embedded :deep(.answers-input) {
transform: translateX(0);
width: 100%;
left: 0;
display: flex;
justify-content: center;
}
:deep(.answers-input) {
position: static;
transform: translateX(0);
@@ -1321,6 +1351,21 @@ onBeforeRouteUpdate((to, from, next) => {
padding-left: 4px;
}
.input-container {
min-height: 115px;
margin: 16px auto 4px;
width: 100%;
max-width: 800px;
box-sizing: border-box;
&.is-embedded {
max-width: 100%;
width: 100%;
margin: 0;
overflow-x: hidden;
}
}
.msg_list {
display: flex;
flex-direction: column;