feat: 展示 Agent 上下文摘要

This commit is contained in:
湛兮
2026-06-12 02:57:33 +08:00
parent 7a91bd1c36
commit 4988c5be38
2 changed files with 17 additions and 0 deletions
+16
View File
@@ -1,4 +1,7 @@
<script setup lang="ts">
/**
* 全局右侧 Agent 抽屉,只展示后端受控的 DevOps 场景能力和上下文摘要。
*/
import { Close, Promotion } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { computed, ref, watch } from 'vue'
@@ -11,6 +14,7 @@ type AgentMessage = {
role: 'user' | 'assistant'
title: string
content: string
contextSummary?: string
createdAt: string
}
@@ -123,6 +127,7 @@ async function sendPrompt() {
role: 'assistant',
title: invocation.status === 'success' ? 'Agent 结果' : 'Agent 调用失败',
content: invocation.resultMarkdown || 'Agent 未返回内容',
contextSummary: invocation.contextSummary,
createdAt: formatTime(invocation.createdAt),
})
} catch (error) {
@@ -209,6 +214,9 @@ function formatTime(value: string): string {
<span>{{ message.createdAt }}</span>
</div>
<p>{{ message.content }}</p>
<small v-if="message.contextSummary" class="message-context">
上下文{{ message.contextSummary }}
</small>
</article>
</div>
@@ -332,6 +340,14 @@ function formatTime(value: string): string {
word-break: break-word;
}
.message-context {
display: block;
margin-top: 10px;
color: #64748b;
font-size: 12px;
line-height: 1.5;
}
.agent-composer {
display: flex;
flex-direction: column;
+1
View File
@@ -367,6 +367,7 @@ export interface AgentInvocation {
type: AgentPurpose
status: 'pending' | 'running' | 'success' | 'failed'
promptSummary: string
contextSummary?: string
resultMarkdown?: string
createdAt: string
}