feat: 展示 Agent 上下文摘要
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -367,6 +367,7 @@ export interface AgentInvocation {
|
||||
type: AgentPurpose
|
||||
status: 'pending' | 'running' | 'success' | 'failed'
|
||||
promptSummary: string
|
||||
contextSummary?: string
|
||||
resultMarkdown?: string
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user