refactor(asl): ASL frontend architecture refactoring with left navigation

- feat: Create ASLLayout component with 7-module left navigation
- feat: Implement Title Screening Settings page with optimized PICOS layout
- feat: Add placeholder pages for Workbench and Results
- fix: Fix nested routing structure for React Router v6
- fix: Resolve Spin component warning in MainLayout
- fix: Add QueryClientProvider to App.tsx
- style: Optimize PICOS form layout (P+I left, C+O+S right)
- style: Align Inclusion/Exclusion criteria side-by-side
- docs: Add architecture refactoring and routing fix reports

Ref: Week 2 Frontend Development
Scope: ASL module MVP - Title Abstract Screening
This commit is contained in:
2025-11-18 21:51:51 +08:00
parent e3e7e028e8
commit 3634933ece
213 changed files with 20054 additions and 442 deletions

View File

@@ -20,10 +20,37 @@ export interface ParseResult<T = any> {
* 3. 带后缀:{ "key": "value" }\n\n以上是提取结果
* 4. 代码块:```json\n{ "key": "value" }\n```
*/
/**
* 清理JSON字符串修复常见格式问题
* @param text - 原始文本
* @returns 清理后的文本
*/
function cleanJSONString(text: string): string {
let cleaned = text;
// 1. 替换中文引号为ASCII引号国际模型常见问题
cleaned = cleaned.replace(/"/g, '"'); // 中文左引号
cleaned = cleaned.replace(/"/g, '"'); // 中文右引号
cleaned = cleaned.replace(/'/g, "'"); // 中文左单引号
cleaned = cleaned.replace(/'/g, "'"); // 中文右单引号
// 2. 替换全角逗号、冒号为半角
cleaned = cleaned.replace(//g, ',');
cleaned = cleaned.replace(//g, ':');
// 3. 移除零宽字符和不可见字符
cleaned = cleaned.replace(/[\u200B-\u200D\uFEFF]/g, '');
return cleaned;
}
export function extractJSON(text: string): string | null {
// 预处理:清理常见格式问题
const cleanedText = cleanJSONString(text);
// 尝试1直接查找 {...} 或 [...]
const jsonPattern = /(\{[\s\S]*\}|\[[\s\S]*\])/;
const match = text.match(jsonPattern);
const match = cleanedText.match(jsonPattern);
if (match) {
return match[1];
@@ -31,7 +58,7 @@ export function extractJSON(text: string): string | null {
// 尝试2查找代码块中的JSON
const codeBlockPattern = /```(?:json)?\s*\n?([\s\S]*?)\n?```/;
const codeMatch = text.match(codeBlockPattern);
const codeMatch = cleanedText.match(codeBlockPattern);
if (codeMatch) {
return codeMatch[1].trim();