Update AI assistant

This commit is contained in:
meswork
2026-05-28 13:45:16 +08:00
parent 9a2edb15c3
commit 318414394a
6 changed files with 1378 additions and 8 deletions

View File

@@ -4,4 +4,3 @@ export const ip = 'http://localhost:10050'
// export const ip = 'http://10.81.128.42:8011'
// export const ip = 'http://124.220.15.242:8154' // AP
// export const ip = 'http://124.220.15.242:8153' // 福田

View File

@@ -6,7 +6,7 @@
<div class="ai-header" @mousedown="startDrag">
<div class="ai-title">
<span class="ai-dot"/>
<span v-if="!collapsed">DeepSeekV4Pro AI助手</span>
<span v-if="!collapsed">品质管理AI助手</span>
</div>
<div class="ai-actions">
<el-tooltip v-if="!collapsed" :content="'窗口尺寸:' + sizeLabel" effect="dark" placement="top">
@@ -81,7 +81,8 @@ export default {
},
messages: [welcomeMessage()],
messageId: 2,
chartInstances: {}
chartInstances: {},
lastSpcWarning: null
}
},
computed: {
@@ -204,8 +205,19 @@ export default {
this.question = ''
this.loading = true
this.scrollToBottom()
axios.post(this.getBaseUrl() + '/api/assistant/chat', { question: content }).then(response => {
axios.post(this.getBaseUrl() + '/api/assistant/chat', {
question: content,
context: {
lastSpcWarning: this.lastSpcWarning
}
}).then(response => {
const payload = response.data || {}
if (payload.data && payload.data.analysis) {
this.lastSpcWarning = {
analysis: payload.data.analysis,
updatedAt: new Date().toISOString()
}
}
const message = {
id: this.messageId++,
role: 'assistant',
@@ -414,6 +426,42 @@ export default {
font-weight: 600;
}
.ai-risk-badge {
display: inline-flex;
align-items: center;
min-width: 48px;
height: 22px;
padding: 0 8px;
border-radius: 3px;
font-size: 12px;
font-weight: 600;
line-height: 22px;
}
.ai-risk-normal {
color: #166534;
background: #dcfce7;
border: 1px solid #86efac;
}
.ai-risk-watch {
color: #854d0e;
background: #fef9c3;
border: 1px solid #fde68a;
}
.ai-risk-warning {
color: #9a3412;
background: #ffedd5;
border: 1px solid #fdba74;
}
.ai-risk-critical {
color: #b91c1c;
background: #fee2e2;
border: 1px solid #fca5a5;
}
.ai-detail-table-wrap {
width: 100%;
overflow-x: auto;