diff --git a/app/src/doctor_workstation/ui/dialogs/ai_consult.py b/app/src/doctor_workstation/ui/dialogs/ai_consult.py index 2fda196c5..f566e2d43 100644 --- a/app/src/doctor_workstation/ui/dialogs/ai_consult.py +++ b/app/src/doctor_workstation/ui/dialogs/ai_consult.py @@ -788,6 +788,35 @@ QDialog#AiConsultDialog QLabel#AiConsultSideSubtitle { background-color: transparent; font-size: 13px; } +QDialog#AiConsultDialog QLabel#AiConsultSideRequestStatus { + color: #606163; + background-color: #F7F7F7; + border: 1px solid #EDEDEE; + border-radius: 10px; + padding: 10px 12px; + font-size: 13px; + font-weight: 500; +} +QDialog#AiConsultDialog QLabel#AiConsultSideRequestStatus[tone="running"] { + color: #3347B8; + background-color: #EEF1FA; + border-color: #C9D1F3; +} +QDialog#AiConsultDialog QLabel#AiConsultSideRequestStatus[tone="done"] { + color: #1F7A4D; + background-color: #EAF7F0; + border-color: #BFE6D0; +} +QDialog#AiConsultDialog QLabel#AiConsultSideRequestStatus[tone="failed"] { + color: #B42318; + background-color: #FFF1F3; + border-color: #F5C2C7; +} +QDialog#AiConsultDialog QLabel#AiConsultSideRequestStatus[tone="cancelled"] { + color: #9A5B00; + background-color: #FFF7E6; + border-color: #F5D9A8; +} QDialog#AiConsultDialog QPushButton#AiConsultSideClose { min-width: 28px; max-width: 28px; @@ -7409,6 +7438,27 @@ class AiConsultDialog(QDialog): self.side_request_status.setProperty("diagnosisId", self.diagnosis_id) self.side_request_status.setProperty("task", self._stream_task) self.side_request_status.setProperty("requestId", self._sidebar_request_id) + self._apply_sidebar_request_tone(self._sidebar_request_state) + + def _apply_sidebar_request_tone(self, state: str, tone: str = "") -> None: + """按请求状态给侧栏状态卡配色:进行中蓝、完成绿、失败红、取消橙、未发起灰。""" + if not tone: + if state.startswith("本次请求失败"): + tone = "failed" + elif self._stream_meta.get("phase") == "cancelled" or "取消" in state or "停止" in state: + tone = "cancelled" + elif "已完整显示" in state: + tone = "done" + elif self._stream_started_at is not None and self._stream_ended_at is None: + tone = "running" + else: + tone = "idle" + label = self.side_request_status + if label.property("tone") == tone: + return + label.setProperty("tone", tone) + label.style().unpolish(label) + label.style().polish(label) def _stream_cancel_result(self, generation: int, diagnosis_id: int, bubble: Any, worker: _AiStreamWorker, result: Any) -> None: if self._session_closed or generation != self._generation or diagnosis_id != self.diagnosis_id: @@ -7429,6 +7479,7 @@ class AiConsultDialog(QDialog): self._sidebar_request_state = notice prefix = f"{self._sidebar_request_prefix}\n" if self._sidebar_request_prefix else "" self.side_request_status.setText(f"{prefix}{notice}") + self._apply_sidebar_request_tone(notice, "cancelled") def _flush_stream_chunks(self) -> None: self._flush_timer.stop()