feat: enhance ChatView with improved layout and conversation interactions

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-30 17:11:05 +08:00
parent 9e61163fa2
commit d07f88ba34
2 changed files with 739 additions and 284 deletions

View File

@@ -1,5 +1,24 @@
import { nextTick, ref } from 'vue' import { nextTick, ref } from 'vue'
import { initialMessages, prompts } from '../data/requests.js'
const initialMessages = [
{
id: 1,
role: 'agent',
text: '我已读取当前报销、发票、行程和制度命中情况。当前建议:优先处理即将超时与高风险单据。'
},
{
id: 2,
role: 'user',
text: '请列出今天最需要关注的风险。'
},
{
id: 3,
role: 'agent',
text: '主要风险包括3 笔单据将在 30 分钟内超时,市场部存在 2 笔高风险差旅报销,另有 1 笔报销缺少酒店入住清单。'
}
]
export const prompts = ['生成审批意见', '列出补件清单', '解释风险原因', '生成运营简报']
export function useChat(activeView) { export function useChat(activeView) {
const messages = ref([...initialMessages]) const messages = ref([...initialMessages])
@@ -10,21 +29,27 @@ export function useChat(activeView) {
function agentReply(text) { function agentReply(text) {
const c = activeCase.value const c = activeCase.value
if (text.includes('出差申请') || text.includes('出差')) if (text.includes('超时') || text.includes('SLA')) {
return '好的,我来帮您处理出差申请。请提供以下信息:\n1. 出发城市和目的地\n2. 出差日期和天数\n3. 出差事由\n4. 预计费用预算' return '当前最紧急的是 3 笔即将超时单据,建议先按剩余处理时长排序,并把缺附件单据转给申请人补齐。'
if (text.includes('机票') || text.includes('飞机')) }
return '我来帮您查询机票信息。请告诉我:\n1. 出发城市 → 目的城市\n2. 出发日期\n3. 偏好的时间段(上午/下午/晚间)\n4. 舱位要求(经济舱/商务舱)' if (text.includes('高风险') || text.includes('风险')) {
if (text.includes('酒店') || text.includes('住宿')) return '高风险主要集中在市场部差旅报销,风险点包括住宿超标、重复发票疑似命中、行程说明缺失。建议人工复核后再通过。'
return '好的,帮您查找合适的酒店。请提供:\n1. 入住城市和区域偏好\n2. 入住和退房日期\n3. 星级/价位要求\n4. 是否需要含早餐' }
if (text.includes('火车票') || text.includes('高铁')) if (text.includes('部门')) {
return '帮您查询火车票。请告诉我:\n1. 出发站 → 到达站\n2. 出行日期\n3. 座位偏好(二等座/一等座/商务座)\n4. 偏好的出发时间段' return '从待处理金额看,销售部与研发中心占比最高;从异常占比看,市场部更需要优先关注。'
if (text.includes('审批意见')) }
return c ? `${c.id} 建议审批意见:费用归属与预算中心匹配,建议保留业务说明后通过。` : '请先选择一份单据再生成审批意见。' if (text.includes('简报')) {
if (text.includes('补件')) return '运营简报:今日待审批 12 单,高风险 4 单,平均审批 5.6hSLA 达成率 96%。建议优先处理差旅报销和即将超时单据。'
return '补件优先级:业务目的说明、行程或客户名单、直属经理确认记录。' }
if (text.includes('差旅政策') || text.includes('政策')) if (text.includes('补件') || text.includes('附件')) {
return '当前差旅政策要点:\n• 住宿标准:一线城市 600 元/晚,二线城市 400 元/晚\n• 机票优先经济舱3 小时以上可申请商务舱\n• 高铁优先二等座4 小时以上可申请一等座\n• 每日餐饮补贴120 元' return '建议补件清单:酒店入住水单、完整行程单、发票原件或验真结果、直属经理确认记录。'
return '好的,我已记录您的需求。请问还需要什么帮助?我还可以帮您查询差旅政策、预订机票酒店火车票等。' }
if (text.includes('审批意见')) {
return c
? `${c.id} 建议审批意见:费用归属与预算中心基本匹配,请补充必要说明后通过。`
: '建议审批意见:当前单据存在待确认项,请先完成风险核查和附件补齐后再审批。'
}
return '收到。我可以继续帮你拆解异常原因、比较部门趋势、生成审批意见,或整理一份今日报销运营简报。'
} }
function scrollToBottom() { function scrollToBottom() {
@@ -53,7 +78,7 @@ export function useChat(activeView) {
messages.value.push({ messages.value.push({
id: Date.now(), id: Date.now(),
role: 'agent', role: 'agent',
text: `已接收 ${uploadedFiles.value.length} 个附件:${names}。我会优先核对发票验真、费用标准、预算归属和必审批材料。` text: `已接收 ${uploadedFiles.value.length} 个附件:${names}。我会优先核对发票验真、费用标准、预算归属和必审批材料。`
}) })
scrollToBottom() scrollToBottom()
} }

File diff suppressed because it is too large Load Diff