fix: 工单详情AI建议区域UI统一为Bootstrap 5风格
- 去掉自定义 ai-suggestion-section/generate-ai-btn 等样式 - 改用 Bootstrap card + badge + btn 组件 - 相似度和审批状态用 badge bg-success/warning/danger - 按钮用 btn btn-sm 标准样式 - 租户管理飞书配置简化为只保留群绑定(去掉独立凭证字段) - 未绑定群的消息日志增加提示
This commit is contained in:
@@ -155,6 +155,7 @@ def resolve_tenant_by_chat_id(chat_id: str) -> str:
|
||||
return t.tenant_id
|
||||
except Exception as e:
|
||||
logger.error(f"解析飞书群租户映射失败: {e}")
|
||||
logger.warning(f"⚠️ 飞书群 {chat_id} 未绑定任何租户,使用默认租户。请在租户管理页面将此 chat_id 绑定到对应租户。")
|
||||
return DEFAULT_TENANT
|
||||
|
||||
|
||||
|
||||
@@ -41,21 +41,21 @@ Object.assign(TSPDashboard.prototype, {
|
||||
const approveBtn = document.getElementById(`approveBtn_${workorderId}`);
|
||||
const percent = Math.round((data.similarity || 0) * 100);
|
||||
if (simEl) {
|
||||
simEl.innerHTML = `<i class="fas fa-percentage"></i>语义相似度: ${percent}%`;
|
||||
simEl.className = percent >= 90 ? 'similarity-badge high' : percent >= 80 ? 'similarity-badge medium' : 'similarity-badge low';
|
||||
simEl.innerHTML = `<i class="fas fa-percentage me-1"></i>相似度: ${percent}%`;
|
||||
simEl.className = percent >= 90 ? 'badge bg-success' : percent >= 80 ? 'badge bg-warning text-dark' : 'badge bg-danger';
|
||||
simEl.title = this.getSimilarityExplanation(percent);
|
||||
}
|
||||
if (apprEl) {
|
||||
if (data.use_human_resolution) { apprEl.textContent = '将使用人工描述入库'; apprEl.className = 'status-badge human-resolution'; }
|
||||
else if (data.approved) { apprEl.textContent = '已自动审批'; apprEl.className = 'status-badge approved'; }
|
||||
else { apprEl.textContent = '未审批'; apprEl.className = 'status-badge pending'; }
|
||||
if (data.use_human_resolution) { apprEl.textContent = '使用人工描述'; apprEl.className = 'badge bg-info'; }
|
||||
else if (data.approved) { apprEl.textContent = '已自动审批'; apprEl.className = 'badge bg-success'; }
|
||||
else { apprEl.textContent = '未审批'; apprEl.className = 'badge bg-secondary'; }
|
||||
}
|
||||
if (approveBtn) {
|
||||
const canApprove = data.approved || data.use_human_resolution;
|
||||
approveBtn.disabled = !canApprove;
|
||||
if (data.use_human_resolution) { approveBtn.textContent = '使用人工描述入库'; approveBtn.className = 'approve-btn'; }
|
||||
else if (data.approved) { approveBtn.textContent = '已自动审批'; approveBtn.className = 'approve-btn approved'; }
|
||||
else { approveBtn.textContent = '审批入库'; approveBtn.className = 'approve-btn'; }
|
||||
if (data.use_human_resolution) { approveBtn.innerHTML = '<i class="fas fa-check me-1"></i>使用人工描述入库'; approveBtn.className = 'btn btn-info btn-sm'; }
|
||||
else if (data.approved) { approveBtn.innerHTML = '<i class="fas fa-check me-1"></i>已自动审批'; approveBtn.className = 'btn btn-success btn-sm'; }
|
||||
else { approveBtn.innerHTML = '<i class="fas fa-check me-1"></i>审批入库'; approveBtn.className = 'btn btn-warning btn-sm'; }
|
||||
}
|
||||
const message = this.getSimilarityMessage(percent, data.approved, data.use_human_resolution);
|
||||
this.showNotification(message, data.approved ? 'success' : data.use_human_resolution ? 'warning' : 'info');
|
||||
@@ -279,26 +279,26 @@ Object.assign(TSPDashboard.prototype, {
|
||||
<div class="border p-3 rounded">${workorder.description || '无问题描述'}</div>
|
||||
${workorder.resolution ? `<h6 class="mt-3">解决方案</h6><div class="border p-3 rounded bg-light">${workorder.resolution}</div>` : ''}
|
||||
${workorder.satisfaction_score ? `<h6 class="mt-3">满意度评分</h6><div class="border p-3 rounded"><div class="progress"><div class="progress-bar" style="width: ${workorder.satisfaction_score * 100}%"></div></div><small class="text-muted">${workorder.satisfaction_score}/5.0</small></div>` : ''}
|
||||
<div class="ai-suggestion-section">
|
||||
<div class="ai-suggestion-header">
|
||||
<h6 class="ai-suggestion-title"><i class="fas fa-robot"></i>AI建议与人工描述</h6>
|
||||
<button class="generate-ai-btn" onclick="dashboard.generateAISuggestion(${workorder.id})"><i class="fas fa-magic me-1"></i>生成AI建议</button>
|
||||
<div class="card mt-3">
|
||||
<div class="card-header d-flex justify-content-between align-items-center py-2">
|
||||
<h6 class="mb-0"><i class="fas fa-robot me-2"></i>AI建议与人工描述</h6>
|
||||
<button class="btn btn-primary btn-sm" onclick="dashboard.generateAISuggestion(${workorder.id})"><i class="fas fa-magic me-1"></i>生成AI建议</button>
|
||||
</div>
|
||||
<div class="ai-suggestion-content">
|
||||
<label class="form-label fw-bold text-primary mb-2"><i class="fas fa-brain me-1"></i>AI建议</label>
|
||||
<textarea id="aiSuggestion_${workorder.id}" class="form-control" rows="4" placeholder="点击上方按钮生成AI建议..." readonly></textarea>
|
||||
</div>
|
||||
<div class="human-resolution-content">
|
||||
<label class="form-label fw-bold text-warning mb-2"><i class="fas fa-user-edit me-1"></i>人工描述</label>
|
||||
<textarea id="humanResolution_${workorder.id}" class="form-control" rows="3" placeholder="请填写人工处理描述..."></textarea>
|
||||
</div>
|
||||
<div class="similarity-indicator">
|
||||
<button class="save-human-btn" onclick="dashboard.saveHumanResolution(${workorder.id})"><i class="fas fa-save me-1"></i>保存人工描述并评估</button>
|
||||
<span id="aiSim_${workorder.id}" class="similarity-badge bg-secondary"><i class="fas fa-percentage"></i>相似度: --</span>
|
||||
<span id="aiApproved_${workorder.id}" class="status-badge pending">未审批</span>
|
||||
</div>
|
||||
<div class="action-buttons">
|
||||
<button id="approveBtn_${workorder.id}" class="approve-btn" onclick="dashboard.approveToKnowledge(${workorder.id})" disabled><i class="fas fa-check me-1"></i>审批入库</button>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-muted small mb-1"><i class="fas fa-brain me-1"></i>AI建议</label>
|
||||
<textarea id="aiSuggestion_${workorder.id}" class="form-control" rows="3" placeholder="点击上方按钮生成AI建议..." readonly></textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-muted small mb-1"><i class="fas fa-user-edit me-1"></i>人工描述</label>
|
||||
<textarea id="humanResolution_${workorder.id}" class="form-control" rows="2" placeholder="请填写人工处理描述..."></textarea>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2 flex-wrap">
|
||||
<button class="btn btn-success btn-sm" onclick="dashboard.saveHumanResolution(${workorder.id})"><i class="fas fa-save me-1"></i>保存并评估</button>
|
||||
<span id="aiSim_${workorder.id}" class="badge bg-secondary"><i class="fas fa-percentage me-1"></i>相似度: --</span>
|
||||
<span id="aiApproved_${workorder.id}" class="badge bg-secondary">未审批</span>
|
||||
<button id="approveBtn_${workorder.id}" class="btn btn-warning btn-sm" onclick="dashboard.approveToKnowledge(${workorder.id})" disabled><i class="fas fa-check me-1"></i>审批入库</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2266,19 +2266,11 @@
|
||||
<textarea class="form-control" id="tenant-desc-input" rows="2" placeholder="可选"></textarea>
|
||||
</div>
|
||||
<hr>
|
||||
<h6 class="text-muted">飞书配置(可选)</h6>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">飞书 App ID</label>
|
||||
<input type="text" class="form-control" id="tenant-feishu-appid" placeholder="留空则使用全局配置">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">飞书 App Secret</label>
|
||||
<input type="password" class="form-control" id="tenant-feishu-appsecret" placeholder="留空则使用全局配置">
|
||||
</div>
|
||||
<h6 class="text-muted">飞书群绑定</h6>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">绑定的飞书群 Chat ID(每行一个)</label>
|
||||
<textarea class="form-control" id="tenant-feishu-chatgroups" rows="3" placeholder="oc_xxxxxxxx oc_yyyyyyyy"></textarea>
|
||||
<div class="form-text">将飞书群绑定到此租户,机器人在该群收到消息时自动使用此租户的知识库</div>
|
||||
<div class="form-text">将飞书群绑定到此租户,机器人在该群收到消息时自动使用此租户的知识库。Chat ID 可从机器人日志中获取。</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
Reference in New Issue
Block a user