返回 DeepSeek-Reasonix
mockWorkspaceFile.ts
根目录 / desktop / frontend / src / lib / mockWorkspaceFile.ts
1 import type { FilePreview } from "./types";
2
3 const WORKSPACE_FILE_SAMPLES: Record<string, string> = {
4 "README.md": "# Reasonix\n\nBrowser-dev workspace preview.\n\n- Chat in the center\n- Browse files on the right\n- Keep sessions on the left\n",
5 "go.mod": "module reasonix\n\ngo 1.23\n",
6 "desktop/file.go": "package desktop\n\nfunc main() {\n\tprintln(\"workspace preview\")\n}\n",
7 "internal/event.go": "package internal\n\n// mock file used by the browser dev seam\n",
8 };
9
10 export function mockWorkspaceFile(path: string): FilePreview {
11 const sample = WORKSPACE_FILE_SAMPLES[path];
12 const body = sample ?? `// ${path}\n\nMock file body from browser dev.`;
13 return { path, body, size: sample?.length ?? 42, truncated: false, binary: false };
14 }
15
15 lines TYPESCRIPT