666ghj commited on
Commit
1df794d
·
1 Parent(s): 597ea6f

Add Report Agent Tools Card to Step5Interaction component

Browse files
frontend/src/components/Step5Interaction.vue CHANGED
@@ -148,6 +148,73 @@
148
  <!-- Chat Mode -->
149
  <div v-if="activeTab === 'chat'" class="chat-container">
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  <!-- Agent Profile Card -->
152
  <div v-if="chatTarget === 'agent' && selectedAgent" class="agent-profile-card">
153
  <div class="profile-card-header">
@@ -361,6 +428,7 @@ const showAgentDropdown = ref(false)
361
  const selectedAgent = ref(null)
362
  const selectedAgentIndex = ref(null)
363
  const showFullProfile = ref(true)
 
364
 
365
  // Chat State
366
  const chatInput = ref('')
@@ -471,11 +539,31 @@ const renderMarkdown = (content) => {
471
  html = html.replace(/^## (.+)$/gm, '<h3 class="md-h3">$1</h3>')
472
  html = html.replace(/^# (.+)$/gm, '<h2 class="md-h2">$1</h2>')
473
  html = html.replace(/^> (.+)$/gm, '<blockquote class="md-quote">$1</blockquote>')
474
- html = html.replace(/^- (.+)$/gm, '<li class="md-li">$1</li>')
475
- html = html.replace(/(<li class="md-li">[\s\S]*?<\/li>)(\s*<li)/g, '$1$2')
476
- html = html.replace(/(<li class="md-li">.*<\/li>)+/g, '<ul class="md-ul">$&</ul>')
477
- html = html.replace(/^\d+\. (.+)$/gm, '<li class="md-oli">$1</li>')
478
- html = html.replace(/(<li class="md-oli">.*<\/li>)+/g, '<ol class="md-ol">$&</ol>')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
479
  html = html.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
480
  html = html.replace(/\*(.+?)\*/g, '<em>$1</em>')
481
  html = html.replace(/_(.+?)_/g, '<em>$1</em>')
@@ -488,6 +576,9 @@ const renderMarkdown = (content) => {
488
  html = html.replace(/(<\/h[2-5]>)<\/p>/g, '$1')
489
  html = html.replace(/<p class="md-p">(<ul|<ol|<blockquote|<pre|<hr)/g, '$1')
490
  html = html.replace(/(<\/ul>|<\/ol>|<\/blockquote>|<\/pre>)<\/p>/g, '$1')
 
 
 
491
 
492
  return html
493
  }
@@ -1286,6 +1377,158 @@ watch(() => props.simulationId, (newId) => {
1286
  overflow: hidden;
1287
  }
1288
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1289
  /* Agent Profile Card */
1290
  .agent-profile-card {
1291
  border-bottom: 1px solid #E5E7EB;
@@ -1653,10 +1896,10 @@ watch(() => props.simulationId, (newId) => {
1653
  }
1654
 
1655
  .message-text {
1656
- padding: 12px 16px;
1657
  border-radius: 12px;
1658
  font-size: 14px;
1659
- line-height: 1.6;
1660
  }
1661
 
1662
  .chat-message.user .message-text {
@@ -1671,11 +1914,19 @@ watch(() => props.simulationId, (newId) => {
1671
  border-bottom-left-radius: 4px;
1672
  }
1673
 
 
 
 
 
 
 
 
 
1674
  /* Typing Indicator */
1675
  .typing-indicator {
1676
  display: flex;
1677
  gap: 4px;
1678
- padding: 12px 16px;
1679
  background: #F3F4F6;
1680
  border-radius: 12px;
1681
  border-bottom-left-radius: 4px;
 
148
  <!-- Chat Mode -->
149
  <div v-if="activeTab === 'chat'" class="chat-container">
150
 
151
+ <!-- Report Agent Tools Card -->
152
+ <div v-if="chatTarget === 'report_agent'" class="report-agent-tools-card">
153
+ <div class="tools-card-header">
154
+ <div class="tools-card-avatar">R</div>
155
+ <div class="tools-card-info">
156
+ <div class="tools-card-name">Report Agent - Chat</div>
157
+ <div class="tools-card-subtitle">报告生成智能体的快速对话版本,可调用 4 种专业工具</div>
158
+ </div>
159
+ <button class="tools-card-toggle" @click="showToolsDetail = !showToolsDetail">
160
+ <svg :class="{ 'is-expanded': showToolsDetail }" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">
161
+ <polyline points="6 9 12 15 18 9"></polyline>
162
+ </svg>
163
+ </button>
164
+ </div>
165
+ <div v-if="showToolsDetail" class="tools-card-body">
166
+ <div class="tools-grid">
167
+ <div class="tool-item tool-purple">
168
+ <div class="tool-icon-wrapper">
169
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">
170
+ <path d="M9 18h6M10 22h4M12 2a7 7 0 0 0-4 12.5V17a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-2.5A7 7 0 0 0 12 2z"></path>
171
+ </svg>
172
+ </div>
173
+ <div class="tool-content">
174
+ <div class="tool-name">InsightForge 深度归因</div>
175
+ <div class="tool-desc">对齐现实世界种子数据与模拟环境状态,结合Global/Local Memory机制,提供跨时空的深度归因分析</div>
176
+ </div>
177
+ </div>
178
+ <div class="tool-item tool-blue">
179
+ <div class="tool-icon-wrapper">
180
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">
181
+ <circle cx="12" cy="12" r="10"></circle>
182
+ <path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
183
+ </svg>
184
+ </div>
185
+ <div class="tool-content">
186
+ <div class="tool-name">PanoramaSearch 全景追踪</div>
187
+ <div class="tool-desc">基于图结构的广度遍历算法,重构事件传播路径,捕获全量信息流动的拓扑结构</div>
188
+ </div>
189
+ </div>
190
+ <div class="tool-item tool-orange">
191
+ <div class="tool-icon-wrapper">
192
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">
193
+ <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon>
194
+ </svg>
195
+ </div>
196
+ <div class="tool-content">
197
+ <div class="tool-name">QuickSearch 快速检索</div>
198
+ <div class="tool-desc">基于 GraphRAG 的即时查询接口,优化索引效率,用于快速提取具体的节点属性与离散事实</div>
199
+ </div>
200
+ </div>
201
+ <div class="tool-item tool-green">
202
+ <div class="tool-icon-wrapper">
203
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">
204
+ <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
205
+ <circle cx="9" cy="7" r="4"></circle>
206
+ <path d="M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75"></path>
207
+ </svg>
208
+ </div>
209
+ <div class="tool-content">
210
+ <div class="tool-name">InterviewSubAgent 虚拟访谈</div>
211
+ <div class="tool-desc">自主式访谈,能够并行与模拟世界中个体进行多轮对话,采集非结构化的观点数据与心理状态</div>
212
+ </div>
213
+ </div>
214
+ </div>
215
+ </div>
216
+ </div>
217
+
218
  <!-- Agent Profile Card -->
219
  <div v-if="chatTarget === 'agent' && selectedAgent" class="agent-profile-card">
220
  <div class="profile-card-header">
 
428
  const selectedAgent = ref(null)
429
  const selectedAgentIndex = ref(null)
430
  const showFullProfile = ref(true)
431
+ const showToolsDetail = ref(true)
432
 
433
  // Chat State
434
  const chatInput = ref('')
 
539
  html = html.replace(/^## (.+)$/gm, '<h3 class="md-h3">$1</h3>')
540
  html = html.replace(/^# (.+)$/gm, '<h2 class="md-h2">$1</h2>')
541
  html = html.replace(/^> (.+)$/gm, '<blockquote class="md-quote">$1</blockquote>')
542
+
543
+ // 处理列表 - 支持子列表
544
+ html = html.replace(/^(\s*)- (.+)$/gm, (match, indent, text) => {
545
+ const level = Math.floor(indent.length / 2)
546
+ return `<li class="md-li" data-level="${level}">${text}</li>`
547
+ })
548
+ html = html.replace(/^(\s*)(\d+)\. (.+)$/gm, (match, indent, num, text) => {
549
+ const level = Math.floor(indent.length / 2)
550
+ return `<li class="md-oli" data-level="${level}">${text}</li>`
551
+ })
552
+
553
+ // 包装无序列表
554
+ html = html.replace(/(<li class="md-li"[^>]*>.*?<\/li>\s*)+/g, '<ul class="md-ul">$&</ul>')
555
+ // 包装有序列表
556
+ html = html.replace(/(<li class="md-oli"[^>]*>.*?<\/li>\s*)+/g, '<ol class="md-ol">$&</ol>')
557
+
558
+ // 清理列表项之间的所有空白
559
+ html = html.replace(/<\/li>\s+<li/g, '</li><li')
560
+ // 清理列表开始标签后的空白
561
+ html = html.replace(/<ul class="md-ul">\s+/g, '<ul class="md-ul">')
562
+ html = html.replace(/<ol class="md-ol">\s+/g, '<ol class="md-ol">')
563
+ // 清理列表结束标签前的空白
564
+ html = html.replace(/\s+<\/ul>/g, '</ul>')
565
+ html = html.replace(/\s+<\/ol>/g, '</ol>')
566
+
567
  html = html.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
568
  html = html.replace(/\*(.+?)\*/g, '<em>$1</em>')
569
  html = html.replace(/_(.+?)_/g, '<em>$1</em>')
 
576
  html = html.replace(/(<\/h[2-5]>)<\/p>/g, '$1')
577
  html = html.replace(/<p class="md-p">(<ul|<ol|<blockquote|<pre|<hr)/g, '$1')
578
  html = html.replace(/(<\/ul>|<\/ol>|<\/blockquote>|<\/pre>)<\/p>/g, '$1')
579
+ // 清理列表前后的 <br> 标签
580
+ html = html.replace(/<br>(<ul|<ol)/g, '$1')
581
+ html = html.replace(/(<\/ul>|<\/ol>)<br>/g, '$1')
582
 
583
  return html
584
  }
 
1377
  overflow: hidden;
1378
  }
1379
 
1380
+ /* Report Agent Tools Card */
1381
+ .report-agent-tools-card {
1382
+ border-bottom: 1px solid #E5E7EB;
1383
+ background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
1384
+ }
1385
+
1386
+ .tools-card-header {
1387
+ display: flex;
1388
+ align-items: center;
1389
+ gap: 12px;
1390
+ padding: 14px 20px;
1391
+ }
1392
+
1393
+ .tools-card-avatar {
1394
+ width: 44px;
1395
+ height: 44px;
1396
+ min-width: 44px;
1397
+ min-height: 44px;
1398
+ background: linear-gradient(135deg, #1F2937 0%, #374151 100%);
1399
+ color: #FFFFFF;
1400
+ border-radius: 50%;
1401
+ display: flex;
1402
+ align-items: center;
1403
+ justify-content: center;
1404
+ font-size: 18px;
1405
+ font-weight: 600;
1406
+ flex-shrink: 0;
1407
+ box-shadow: 0 2px 8px rgba(31, 41, 55, 0.2);
1408
+ }
1409
+
1410
+ .tools-card-info {
1411
+ flex: 1;
1412
+ min-width: 0;
1413
+ }
1414
+
1415
+ .tools-card-name {
1416
+ font-size: 15px;
1417
+ font-weight: 600;
1418
+ color: #1F2937;
1419
+ margin-bottom: 2px;
1420
+ }
1421
+
1422
+ .tools-card-subtitle {
1423
+ font-size: 12px;
1424
+ color: #6B7280;
1425
+ }
1426
+
1427
+ .tools-card-toggle {
1428
+ width: 28px;
1429
+ height: 28px;
1430
+ background: #FFFFFF;
1431
+ border: 1px solid #E5E7EB;
1432
+ border-radius: 6px;
1433
+ cursor: pointer;
1434
+ display: flex;
1435
+ align-items: center;
1436
+ justify-content: center;
1437
+ color: #6B7280;
1438
+ transition: all 0.2s ease;
1439
+ flex-shrink: 0;
1440
+ }
1441
+
1442
+ .tools-card-toggle:hover {
1443
+ background: #F9FAFB;
1444
+ border-color: #D1D5DB;
1445
+ }
1446
+
1447
+ .tools-card-toggle svg {
1448
+ transition: transform 0.3s ease;
1449
+ }
1450
+
1451
+ .tools-card-toggle svg.is-expanded {
1452
+ transform: rotate(180deg);
1453
+ }
1454
+
1455
+ .tools-card-body {
1456
+ padding: 0 20px 16px 20px;
1457
+ }
1458
+
1459
+ .tools-grid {
1460
+ display: grid;
1461
+ grid-template-columns: repeat(2, 1fr);
1462
+ gap: 10px;
1463
+ }
1464
+
1465
+ .tool-item {
1466
+ display: flex;
1467
+ gap: 10px;
1468
+ padding: 12px;
1469
+ background: #FFFFFF;
1470
+ border-radius: 10px;
1471
+ border: 1px solid #E5E7EB;
1472
+ transition: all 0.2s ease;
1473
+ }
1474
+
1475
+ .tool-item:hover {
1476
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
1477
+ }
1478
+
1479
+ .tool-icon-wrapper {
1480
+ width: 32px;
1481
+ height: 32px;
1482
+ min-width: 32px;
1483
+ border-radius: 8px;
1484
+ display: flex;
1485
+ align-items: center;
1486
+ justify-content: center;
1487
+ flex-shrink: 0;
1488
+ }
1489
+
1490
+ .tool-purple .tool-icon-wrapper {
1491
+ background: rgba(139, 92, 246, 0.1);
1492
+ color: #8B5CF6;
1493
+ }
1494
+
1495
+ .tool-blue .tool-icon-wrapper {
1496
+ background: rgba(59, 130, 246, 0.1);
1497
+ color: #3B82F6;
1498
+ }
1499
+
1500
+ .tool-orange .tool-icon-wrapper {
1501
+ background: rgba(249, 115, 22, 0.1);
1502
+ color: #F97316;
1503
+ }
1504
+
1505
+ .tool-green .tool-icon-wrapper {
1506
+ background: rgba(34, 197, 94, 0.1);
1507
+ color: #22C55E;
1508
+ }
1509
+
1510
+ .tool-content {
1511
+ flex: 1;
1512
+ min-width: 0;
1513
+ }
1514
+
1515
+ .tool-name {
1516
+ font-size: 12px;
1517
+ font-weight: 600;
1518
+ color: #1F2937;
1519
+ margin-bottom: 4px;
1520
+ }
1521
+
1522
+ .tool-desc {
1523
+ font-size: 11px;
1524
+ color: #6B7280;
1525
+ line-height: 1.4;
1526
+ display: -webkit-box;
1527
+ -webkit-line-clamp: 2;
1528
+ -webkit-box-orient: vertical;
1529
+ overflow: hidden;
1530
+ }
1531
+
1532
  /* Agent Profile Card */
1533
  .agent-profile-card {
1534
  border-bottom: 1px solid #E5E7EB;
 
1896
  }
1897
 
1898
  .message-text {
1899
+ padding: 10px 14px;
1900
  border-radius: 12px;
1901
  font-size: 14px;
1902
+ line-height: 1.5;
1903
  }
1904
 
1905
  .chat-message.user .message-text {
 
1914
  border-bottom-left-radius: 4px;
1915
  }
1916
 
1917
+ .message-text :deep(.md-p) {
1918
+ margin: 0;
1919
+ }
1920
+
1921
+ .message-text :deep(.md-p:last-child) {
1922
+ margin-bottom: 0;
1923
+ }
1924
+
1925
  /* Typing Indicator */
1926
  .typing-indicator {
1927
  display: flex;
1928
  gap: 4px;
1929
+ padding: 10px 14px;
1930
  background: #F3F4F6;
1931
  border-radius: 12px;
1932
  border-bottom-left-radius: 4px;