Skip to content

Commit 5184a9b

Browse files
author
FlowVision Dev
committed
feat: 添加 rehype-raw 依赖并更新相关组件样式
1 parent d80ec63 commit 5184a9b

9 files changed

Lines changed: 119 additions & 238 deletions

File tree

packages/frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"react-dom": "^18.3.1",
2020
"react-markdown": "^10.1.0",
2121
"react-resizable-panels": "^4.7.6",
22+
"rehype-raw": "^7.0.0",
2223
"zustand": "^4.5.2"
2324
},
2425
"devDependencies": {

packages/frontend/src/components/Canvas/nodes/DocumentNode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function DocumentNode({ id, data, selected }: NodeProps<FlowNode>) {
3030
</div>
3131
<button
3232
onClick={(e) => { e.stopPropagation(); openEditDialog(id); }}
33-
className="hover:bg-slate-100 rounded-md p-0.5 transition-colors duration-150"
33+
className="node-edit-btn hover:bg-slate-100 rounded-md p-0.5 transition-colors duration-150"
3434
title="编辑节点"
3535
>
3636
<span className="material-symbols-outlined text-sm text-slate-400 hover:text-primary">more_horiz</span>

packages/frontend/src/components/Canvas/nodes/ProcessNode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function ProcessNode({ id, data, selected }: NodeProps<FlowNode>) {
2626
<span className="text-[10px] font-bold text-primary uppercase tracking-tighter">流程</span>
2727
<button
2828
onClick={(e) => { e.stopPropagation(); openEditDialog(id); }}
29-
className="hover:bg-slate-100 rounded-md p-0.5 transition-colors duration-150"
29+
className="node-edit-btn hover:bg-slate-100 rounded-md p-0.5 transition-colors duration-150"
3030
title="编辑节点"
3131
>
3232
<span className="material-symbols-outlined text-sm text-slate-400 hover:text-primary">more_horiz</span>

packages/frontend/src/components/Canvas/nodes/SubprocessNode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function SubprocessNode({ id, data, selected }: NodeProps<FlowNode>) {
3232
</div>
3333
<button
3434
onClick={(e) => { e.stopPropagation(); openEditDialog(id); }}
35-
className="hover:bg-slate-100 rounded-md p-0.5 transition-colors duration-150"
35+
className="node-edit-btn hover:bg-slate-100 rounded-md p-0.5 transition-colors duration-150"
3636
title="编辑节点"
3737
>
3838
<span className="material-symbols-outlined text-sm text-slate-400 hover:text-primary">more_horiz</span>

packages/frontend/src/components/CodePreview/CodePreview.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useMemo, useEffect, useState } from 'react';
22
import Markdown from 'react-markdown';
3+
import rehypeRaw from 'rehype-raw';
34
import { useSettingsStore } from '../../store/settingsStore';
45

56
interface CodePreviewProps {
@@ -171,7 +172,7 @@ function CodePreview({
171172
prose-img:rounded-lg prose-hr:border-outline-variant/30
172173
prose-th:text-on-surface prose-td:text-on-surface/80
173174
prose-li:text-on-surface/80">
174-
<Markdown components={{
175+
<Markdown rehypePlugins={[rehypeRaw]} components={{
175176
a: ({ href, children, ...props }) => {
176177
// 相对链接标记但不阻止显示
177178
const isRelative = href && !href.startsWith('http') && !href.startsWith('mailto:') && !href.startsWith('#');

packages/frontend/src/components/Sidebar/ProjectSidebar.tsx

Lines changed: 3 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -584,69 +584,6 @@ ${fileContextStr}
584584

585585
{/* 可滚动内容区域 */}
586586
<div className="flex-1 min-h-0 overflow-y-auto px-5 py-4">
587-
{/* Agent 工作日志 — 项目分析 */}
588-
{generating && (
589-
<div className="mb-6 rounded-2xl border border-primary/10 bg-white shadow-sm overflow-hidden">
590-
<div className="flex items-center justify-between px-4 py-3 border-b border-slate-100 bg-slate-50/50">
591-
<div className="flex items-center gap-2">
592-
<span className="material-symbols-outlined text-primary text-base">smart_toy</span>
593-
<span className="text-xs font-semibold text-slate-700">Agent 工作日志</span>
594-
</div>
595-
<span className="inline-flex items-center gap-1 rounded-full bg-primary/8 px-2 py-0.5 text-[10px] font-medium text-primary">
596-
<span className="inline-block h-1.5 w-1.5 rounded-full bg-primary animate-pulse"></span>
597-
运行中
598-
</span>
599-
</div>
600-
<div className="px-4 py-3 space-y-3">
601-
<div className="flex items-center gap-2.5">
602-
{analysisStep > 1
603-
? <span className="material-symbols-outlined text-sm text-green-500 shrink-0" style={{ fontVariationSettings: "'FILL' 1" }}>check_circle</span>
604-
: <span className="material-symbols-outlined text-sm text-primary animate-spin shrink-0">progress_activity</span>}
605-
<span className={`text-xs ${analysisStep > 1 ? 'text-slate-500' : 'text-slate-800 font-medium'}`}>获取项目文件上下文</span>
606-
</div>
607-
<div className="flex items-center gap-2.5">
608-
{analysisStep > 2
609-
? <span className="material-symbols-outlined text-sm text-green-500 shrink-0" style={{ fontVariationSettings: "'FILL' 1" }}>check_circle</span>
610-
: analysisStep >= 2
611-
? <span className="material-symbols-outlined text-sm text-primary animate-spin shrink-0">progress_activity</span>
612-
: <span className="w-4 h-4 rounded-full border-2 border-slate-200 shrink-0"></span>}
613-
<span className={`text-xs ${analysisStep > 2 ? 'text-slate-500' : analysisStep >= 2 ? 'text-slate-800 font-medium' : 'text-slate-400'}`}>发送 AI 分析请求</span>
614-
</div>
615-
<div className="flex items-start gap-2.5">
616-
{analysisStep > 3
617-
? <span className="material-symbols-outlined text-sm text-green-500 shrink-0 mt-0.5" style={{ fontVariationSettings: "'FILL' 1" }}>check_circle</span>
618-
: analysisStep >= 3
619-
? <span className="material-symbols-outlined text-sm text-primary animate-spin shrink-0 mt-0.5">progress_activity</span>
620-
: <span className="w-4 h-4 rounded-full border-2 border-slate-200 shrink-0 mt-0.5"></span>}
621-
<div className="flex-1 min-w-0">
622-
<span className={`text-xs ${analysisStep > 3 ? 'text-slate-500' : analysisStep >= 3 ? 'text-slate-800 font-medium' : 'text-slate-400'}`}>AI 分析代码结构</span>
623-
{analysisStep === 3 && streamingOverviewText && (
624-
<div className="mt-1.5 rounded-lg bg-slate-50 px-3 py-2 max-h-28 overflow-y-auto">
625-
<pre className="text-[10px] text-slate-500 leading-relaxed whitespace-pre-wrap break-words font-mono">{streamingOverviewText.slice(-300)}</pre>
626-
</div>
627-
)}
628-
</div>
629-
</div>
630-
<div className="flex items-center gap-2.5">
631-
{analysisStep >= 4
632-
? <span className="material-symbols-outlined text-sm text-green-500 shrink-0" style={{ fontVariationSettings: "'FILL' 1" }}>check_circle</span>
633-
: <span className="w-4 h-4 rounded-full border-2 border-slate-200 shrink-0"></span>}
634-
<span className={`text-xs ${analysisStep >= 4 ? 'text-slate-500' : 'text-slate-400'}`}>解析并生成概览</span>
635-
</div>
636-
</div>
637-
<div className="px-4 py-2 border-t border-slate-100 bg-slate-50/30 flex items-center gap-4 text-[10px] text-slate-400">
638-
<span className="flex items-center gap-1">
639-
<span className="material-symbols-outlined text-[11px]">token</span>
640-
~{Math.max(1, Math.round(streamingOverviewText.length / 4))} tokens
641-
</span>
642-
<span className="flex items-center gap-1">
643-
<span className="material-symbols-outlined text-[11px]">smart_toy</span>
644-
1 次 AI 调用
645-
</span>
646-
</div>
647-
</div>
648-
)}
649-
650587
{/* 项目分析流输出窗口 */}
651588
{generating && streamingOverviewText && (
652589
<div className="mb-6 rounded-2xl border border-primary/10 bg-white shadow-sm overflow-hidden">
@@ -663,67 +600,6 @@ ${fileContextStr}
663600
</div>
664601
)}
665602

666-
{/* Agent 工作日志 — 架构图生成 */}
667-
{generatingCanvas && (
668-
<div className="mb-6 rounded-2xl border border-secondary/15 bg-white shadow-sm overflow-hidden">
669-
<div className="flex items-center justify-between px-4 py-3 border-b border-slate-100 bg-slate-50/50">
670-
<div className="flex items-center gap-2">
671-
<span className="material-symbols-outlined text-secondary text-base">account_tree</span>
672-
<span className="text-xs font-semibold text-slate-700">架构图生成日志</span>
673-
</div>
674-
<span className="inline-flex items-center gap-1 rounded-full bg-secondary/10 px-2 py-0.5 text-[10px] font-medium text-secondary">
675-
<span className="inline-block h-1.5 w-1.5 rounded-full bg-secondary animate-pulse"></span>
676-
运行中
677-
</span>
678-
</div>
679-
<div className="px-4 py-3 space-y-3">
680-
<div className="flex items-center gap-2.5">
681-
{canvasStep > 1
682-
? <span className="material-symbols-outlined text-sm text-green-500 shrink-0" style={{ fontVariationSettings: "'FILL' 1" }}>check_circle</span>
683-
: <span className="material-symbols-outlined text-sm text-secondary animate-spin shrink-0">progress_activity</span>}
684-
<span className={`text-xs ${canvasStep > 1 ? 'text-slate-500' : 'text-slate-800 font-medium'}`}>获取项目文件上下文</span>
685-
</div>
686-
<div className="flex items-center gap-2.5">
687-
{canvasStep > 2
688-
? <span className="material-symbols-outlined text-sm text-green-500 shrink-0" style={{ fontVariationSettings: "'FILL' 1" }}>check_circle</span>
689-
: canvasStep >= 2
690-
? <span className="material-symbols-outlined text-sm text-secondary animate-spin shrink-0">progress_activity</span>
691-
: <span className="w-4 h-4 rounded-full border-2 border-slate-200 shrink-0"></span>}
692-
<span className={`text-xs ${canvasStep > 2 ? 'text-slate-500' : canvasStep >= 2 ? 'text-slate-800 font-medium' : 'text-slate-400'}`}>发送架构图生成请求</span>
693-
</div>
694-
<div className="flex items-start gap-2.5">
695-
{canvasStep > 3
696-
? <span className="material-symbols-outlined text-sm text-green-500 shrink-0 mt-0.5" style={{ fontVariationSettings: "'FILL' 1" }}>check_circle</span>
697-
: canvasStep >= 3
698-
? <span className="material-symbols-outlined text-sm text-secondary animate-spin shrink-0 mt-0.5">progress_activity</span>
699-
: <span className="w-4 h-4 rounded-full border-2 border-slate-200 shrink-0 mt-0.5"></span>}
700-
<div className="flex-1 min-w-0">
701-
<span className={`text-xs ${canvasStep > 3 ? 'text-slate-500' : canvasStep >= 3 ? 'text-slate-800 font-medium' : 'text-slate-400'}`}>AI 生成节点与连线</span>
702-
{canvasStep === 3 && streamingCanvasText && (
703-
<div className="mt-1.5 rounded-lg bg-slate-50 px-3 py-2 max-h-28 overflow-y-auto">
704-
<pre className="text-[10px] text-slate-500 leading-relaxed whitespace-pre-wrap break-words font-mono">{streamingCanvasText.slice(-300)}</pre>
705-
</div>
706-
)}
707-
</div>
708-
</div>
709-
<div className="flex items-center gap-2.5">
710-
<span className="w-4 h-4 rounded-full border-2 border-slate-200 shrink-0"></span>
711-
<span className="text-xs text-slate-400">写入画布</span>
712-
</div>
713-
</div>
714-
<div className="px-4 py-2 border-t border-slate-100 bg-slate-50/30 flex items-center gap-4 text-[10px] text-slate-400">
715-
<span className="flex items-center gap-1">
716-
<span className="material-symbols-outlined text-[11px]">token</span>
717-
~{Math.max(1, Math.round(streamingCanvasText.length / 4))} tokens
718-
</span>
719-
<span className="flex items-center gap-1">
720-
<span className="material-symbols-outlined text-[11px]">smart_toy</span>
721-
1 次 AI 调用
722-
</span>
723-
</div>
724-
</div>
725-
)}
726-
727603
{/* 架构图流输出窗口 */}
728604
{generatingCanvas && streamingCanvasText && (
729605
<div className="mb-6 rounded-2xl border border-secondary/10 bg-white shadow-sm overflow-hidden">
@@ -981,15 +857,15 @@ ${fileContextStr}
981857
<div className="p-3 rounded-xl bg-green-50/50 ghost-border-soft space-y-2 shadow-sm">
982858
<div className="flex items-center justify-between gap-3">
983859
<span className="text-xs text-on-surface-variant truncate">框架</span>
984-
<span className="text-xs font-medium text-on-surface shrink-0 whitespace-nowrap text-right">{displayOverview.testInfo.framework}</span>
860+
<span className="text-xs font-medium text-on-surface text-right break-words min-w-0">{displayOverview.testInfo.framework}</span>
985861
</div>
986862
<div className="flex items-center justify-between gap-3">
987863
<span className="text-xs text-on-surface-variant truncate">覆盖率</span>
988-
<span className="text-xs font-medium text-green-600 shrink-0 whitespace-nowrap text-right">{displayOverview.testInfo.coverage}</span>
864+
<span className="text-xs font-medium text-green-600 text-right break-words min-w-0">{displayOverview.testInfo.coverage}</span>
989865
</div>
990866
<div className="flex items-center justify-between gap-3">
991867
<span className="text-xs text-on-surface-variant truncate">测试文件数</span>
992-
<span className="text-xs font-medium text-on-surface shrink-0 whitespace-nowrap text-right">{displayOverview.testInfo.testFiles}</span>
868+
<span className="text-xs font-medium text-on-surface text-right break-words min-w-0">{displayOverview.testInfo.testFiles}</span>
993869
</div>
994870
</div>
995871
</div>

0 commit comments

Comments
 (0)