feat: 更新 CodeEditor 组件,重构为懒加载并添加 CodeEditorImpl,优化导入路径

This commit is contained in:
DrSmoothl
2026-04-24 23:10:01 +08:00
parent 3b6d30cd5e
commit 201efe66a1
11 changed files with 234 additions and 188 deletions

View File

@@ -16,7 +16,7 @@ import {
import { Button } from '@/components/ui/button'
import { ScrollArea } from '@/components/ui/scroll-area'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { CodeEditor } from '@/components'
import { CodeEditor } from '@/components/CodeEditor'
import { DynamicConfigForm } from '@/components/dynamic-form'
import { RestartOverlay } from '@/components/restart-overlay'
import { useToast } from '@/hooks/use-toast'

View File

@@ -12,7 +12,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'
import { ListFieldEditor } from '@/components/ListFieldEditor'
import { Alert, AlertDescription } from '@/components/ui/alert'
import { CodeEditor } from '@/components'
import { CodeEditor } from '@/components/CodeEditor'
import { parse as parseToml } from 'smol-toml'
import {
Select,

View File

@@ -37,8 +37,8 @@ import {
type GitStatus,
type MaimaiVersion,
} from '@/lib/plugin-api'
import { MarkdownRenderer } from '@/components/markdown-renderer'
import { PluginStats } from '@/components/plugin-stats'
import { MarkdownRenderer } from '@/components'
import { recordPluginDownload } from '@/lib/plugin-stats'
// 分类名称映射

View File

@@ -16,7 +16,7 @@ import {
Upload,
} from 'lucide-react'
import { CodeEditor } from '@/components'
import { CodeEditor } from '@/components/CodeEditor'
import { MemoryDeleteDialog } from '@/components/memory/MemoryDeleteDialog'
import { MemoryConfigEditor } from '@/components/memory/MemoryConfigEditor'
import { Alert, AlertDescription } from '@/components/ui/alert'

View File

@@ -171,10 +171,14 @@ export function NodeDetailDialog({
</Button>
{onDeleteEntity ? (
<div className="flex flex-col items-end gap-2 rounded-lg border bg-background p-3">
<label className="flex items-center gap-2 text-xs text-muted-foreground">
<Checkbox checked={includeParagraphs} onCheckedChange={(checked) => setIncludeParagraphs(Boolean(checked))} />
</label>
<div className="flex items-center gap-2 text-xs text-muted-foreground">
<Checkbox
checked={includeParagraphs}
onCheckedChange={(checked) => setIncludeParagraphs(Boolean(checked))}
aria-label="删除该实体相关证据段落"
/>
<span></span>
</div>
<Button variant="outline" onClick={() => onDeleteEntity({ includeParagraphs })}>
<Trash2 className="mr-2 h-4 w-4" />
@@ -280,10 +284,14 @@ export function EdgeDetailDialog({
</Button>
{onDeleteEdgeGroup ? (
<div className="flex flex-col items-end gap-2 rounded-lg border bg-background p-3">
<label className="flex items-center gap-2 text-xs text-muted-foreground">
<Checkbox checked={includeParagraphs} onCheckedChange={(checked) => setIncludeParagraphs(Boolean(checked))} />
</label>
<div className="flex items-center gap-2 text-xs text-muted-foreground">
<Checkbox
checked={includeParagraphs}
onCheckedChange={(checked) => setIncludeParagraphs(Boolean(checked))}
aria-label="同时删除支撑段落"
/>
<span></span>
</div>
<Button variant="outline" onClick={() => onDeleteEdgeGroup({ includeParagraphs })}>
<Trash2 className="mr-2 h-4 w-4" />
@@ -371,10 +379,14 @@ export function RelationDetailDialog({
{onDeleteRelation ? (
<div className="rounded-lg border bg-background p-3">
<label className="flex items-center gap-2 text-xs text-muted-foreground">
<Checkbox checked={includeParagraphs} onCheckedChange={(checked) => setIncludeParagraphs(Boolean(checked))} />
</label>
<div className="flex items-center gap-2 text-xs text-muted-foreground">
<Checkbox
checked={includeParagraphs}
onCheckedChange={(checked) => setIncludeParagraphs(Boolean(checked))}
aria-label="同时删除支撑该关系的段落"
/>
<span></span>
</div>
<Button className="mt-3" variant="outline" onClick={() => onDeleteRelation(relation, includeParagraphs)}>
<Trash2 className="mr-2 h-4 w-4" />