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