| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- <template>
- <div class="thinking-panel">
- <div class="panel-header">
- <div class="panel-left">
- <div class="agent-avatar-small"></div>
- <div class="panel-title-group">
- <div class="panel-title">{{ currentDisplayAgent?.agentName || '智能分析' }}</div>
- </div>
- </div>
- <div class="close-btn" @click="emit('close')">
- <div class="btn-close-icon"></div>
- </div>
- </div>
- <div class="thinking-section">
- <div class="section-content thinking-content" ref="thinkingContentRef">
- <div v-if="!thinkingSections.length" class="empty-thinking">暂无思考过程</div>
- <div v-for="(section, idx) in thinkingSections" :key="idx" :class="['timeline-item', `timeline-${section.type}`]">
- <div class="timeline-marker">
- <div class="timeline-dot"></div>
- <div v-if="idx < thinkingSections.length - 1" class="timeline-line"></div>
- </div>
- <div class="timeline-body">
- <div class="timeline-header">
- <span class="timeline-label">{{ section.label }}</span>
- </div>
- <div class="timeline-text" v-html="renderMarkdown(section.content)"></div>
- </div>
- </div>
- </div>
- </div>
- <div class="agent-horizontal-list" v-if="selectedAgentParentMsg?.agentAnswers?.length">
- <div
- v-for="agent in selectedAgentParentMsg!.agentAnswers"
- :key="agent.id"
- :class="['agent-chip', { active: currentDisplayAgent?.id === agent.id }]"
- @click="emit('select-agent', agent)"
- >
- <div class="chip-body">
- <div class="chip-icon"></div>
- <div class="chip-name">
- {{ agent.agentName || '智能分析' }}
- </div>
- </div>
- <div class="chip-status">
- <span v-if="agent.status === 'thinking'">正在连接</span>
- <span v-else>已完成</span>
- </div>
- <div class="chip-border"></div>
- </div>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import { ref } from 'vue';
- import { renderMarkdown } from './utils';
- import type { AgentAnswer, Message, ThinkingSection } from './types';
- defineProps<{
- currentDisplayAgent: AgentAnswer | null;
- selectedAgentParentMsg: Message | null;
- thinkingSections: ThinkingSection[];
- }>();
- const emit = defineEmits<{
- (e: 'select-agent', answer: AgentAnswer): void;
- (e: 'close'): void;
- }>();
- const thinkingContentRef = ref<HTMLElement | null>(null);
- defineExpose({ thinkingContentRef });
- </script>
- <style scoped lang="less">
- .thinking-panel {
- height: 100%;
- width: 100%;
- display: flex;
- flex-direction: column;
- padding: 12px 16px;
- .panel-header {
- display: flex;
- padding: 0;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 6px;
- flex-shrink: 0;
- .panel-left {
- display: flex;
- align-items: center;
- gap: 12px;
- }
- .agent-avatar-small {
- width: 35px;
- height: 36px;
- border-radius: 8px;
- background-image: var(--img-chat-panel-header);
- background-repeat: no-repeat;
- background-size: 100% 100%;
- flex-shrink: 0;
- }
- .panel-title-group {
- display: flex;
- flex-direction: column;
- line-height: 1;
- }
- .panel-title {
- font-size: 15px;
- font-weight: 600;
- line-height: 1.4;
- color: #0a84ff;
- }
- .close-btn {
- cursor: pointer;
- width: 36px;
- height: 36px;
- background-image: var(--img-chat-upload-bg);
- background-repeat: no-repeat;
- background-size: 100% 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
- transition: all 0.3s;
- margin-bottom: auto;
- .btn-close-icon {
- width: 20px;
- height: 20px;
- background-image: var(--img-chat-close-icon);
- background-repeat: no-repeat;
- background-size: 100% 100%;
- }
- }
- }
- .thinking-section {
- flex: 1;
- height: 0;
- display: flex;
- flex-direction: column;
- border: 1px solid #0a84ff;
- border-radius: 4px 4px 0 0;
- .thinking-content {
- flex: 1;
- background: rgba(10, 132, 255, 0.05);
- border: 1px solid rgba(63, 80, 106, 0.5);
- border-radius: 8px;
- padding: 20px 16px;
- overflow-y: auto;
- font-size: 12px;
- font-weight: 400;
- color: #e0e6ed;
- line-height: 1.6;
- .empty-thinking {
- color: #8b949e;
- font-style: italic;
- text-align: center;
- padding: 32px 0;
- }
- .timeline-item {
- display: flex;
- gap: 0;
- position: relative;
- .timeline-marker {
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 28px;
- flex-shrink: 0;
- position: relative;
- }
- .timeline-dot {
- width: 12px;
- height: 12px;
- border-radius: 50%;
- border: 2px solid #fff;
- flex-shrink: 0;
- margin-top: 6px;
- position: relative;
- z-index: 1;
- }
- .timeline-line {
- flex: 1;
- width: 0;
- min-height: 16px;
- margin: 4px 0;
- border-left: 2px dashed #8b949e;
- }
- &.timeline-select {
- .timeline-dot {
- background: #0a84ff;
- box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
- }
- .timeline-header {
- color: #e0e6ed;
- }
- }
- &.timeline-params {
- display: none;
- .timeline-dot {
- background: #faad14;
- box-shadow: 0 0 0 3px rgba(223, 91, 12, 0.15);
- }
- .timeline-header {
- color: #e0e6ed;
- }
- }
- &.timeline-result {
- .timeline-dot {
- background: #52c41a;
- box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
- }
- }
- .timeline-body {
- flex: 1;
- min-width: 0;
- padding-bottom: 16px;
- padding-left: 12px;
- }
- .timeline-header {
- font-size: 13px;
- font-weight: 500;
- margin-bottom: 8px;
- line-height: 1.4;
- }
- .timeline-text {
- font-size: 14px;
- font-weight: 400;
- color: #e0e6ed;
- line-height: 1.6;
- :deep(p) {
- margin: 0 0 6px;
- }
- :deep(code) {
- background: rgba(10, 132, 255, 0.1);
- padding: 2px 6px;
- border-radius: 3px;
- font-family: monospace;
- font-size: 12px;
- }
- :deep(pre) {
- background: rgba(10, 132, 255, 0.1);
- padding: 10px;
- border-radius: 4px;
- overflow-x: auto;
- margin: 8px 0;
- }
- :deep(pre code) {
- background: transparent;
- padding: 0;
- }
- :deep(ul),
- :deep(ol) {
- padding-left: 20px;
- margin: 4px 0;
- }
- :deep(li) {
- margin-bottom: 2px;
- }
- :deep(h1),
- :deep(h2),
- :deep(h3),
- :deep(h4) {
- margin: 8px 0 4px;
- font-weight: 600;
- }
- :deep(blockquote) {
- border-left: 3px solid rgba(63, 80, 106, 0.5);
- padding-left: 12px;
- margin: 8px 0;
- color: #8b949e;
- }
- :deep(table) {
- border-collapse: collapse;
- width: 100%;
- margin: 8px 0;
- }
- :deep(th),
- :deep(td) {
- border: 1px solid rgba(63, 80, 106, 0.5);
- padding: 6px 10px;
- text-align: left;
- }
- :deep(th) {
- background: rgba(10, 132, 255, 0.1);
- font-weight: 600;
- }
- :deep(strong) {
- font-weight: 600;
- }
- }
- }
- }
- }
- .agent-horizontal-list {
- display: flex;
- gap: 10px;
- padding: 8px 0;
- overflow-x: auto;
- align-items: center;
- flex-shrink: 0;
- border-radius: 0 0 4px 4px;
- border-top: none;
- background-color: rgba(10, 132, 255, 0.05);
- }
- .agent-chip {
- display: flex;
- align-items: center;
- gap: 10px;
- padding: 8px 12px 8px 20px;
- background: rgba(10, 132, 255, 0.08);
- border-radius: 10px;
- border: 1px solid rgba(63, 80, 106, 0.5);
- min-width: 140px;
- cursor: pointer;
- transition: all 0.2s;
- position: relative;
- .chip-body {
- display: flex;
- align-items: start;
- gap: 8px;
- flex-direction: column;
- }
- .chip-border {
- position: absolute;
- left: 10px;
- top: 16px;
- width: 5px;
- height: 35px;
- border: 2px solid #0a84ff;
- pointer-events: none;
- border-right: none;
- }
- .chip-icon {
- width: 24px;
- height: 24px;
- background-image: var(--img-chat-thinking-bg);
- background-repeat: no-repeat;
- background-size: 100% 100%;
- }
- .chip-name {
- font-size: 13px;
- font-weight: 500;
- line-height: 1.4;
- color: #e0e6ed;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- width: 100px;
- }
- .chip-status {
- font-size: 11px;
- font-weight: 400;
- line-height: 1.3;
- color: #8b949e;
- position: absolute;
- top: 10px;
- right: 10px;
- }
- &.active {
- background-color: rgba(10, 132, 255, 0.12);
- box-shadow: 0 6px 18px rgba(10, 132, 255, 0.06);
- border-color: #0a84ff;
- .chip-status {
- color: #0a84ff;
- }
- }
- }
- }
- </style>
|