feat(rvw): complete tenant portal polish and ops assignment fixes
Finalize RVW tenant portal UX and reliability updates by aligning login/profile interactions, stabilizing SMS code sends in weak-network scenarios, and fixing multi-tenant assignment payload handling to prevent runtime errors. Refresh RVW status and deployment checklist docs with SAE routing, frontend image build, and post-release validation guidance. Made-with: Cursor
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import { MethodologyReview, MethodologyStatus } from '../types/index.js';
|
||||
import { jsonrepair } from 'jsonrepair';
|
||||
|
||||
/**
|
||||
* 从LLM响应中解析JSON
|
||||
@@ -14,13 +15,27 @@ export function parseJSONFromLLMResponse<T>(content: string): T {
|
||||
// 1. 尝试直接解析
|
||||
return JSON.parse(content) as T;
|
||||
} catch {
|
||||
// 1.1 先尝试 jsonrepair(处理尾逗号、引号缺失等常见脏 JSON)
|
||||
try {
|
||||
const repaired = jsonrepair(content);
|
||||
return JSON.parse(repaired) as T;
|
||||
} catch {
|
||||
// 继续后续提取策略
|
||||
}
|
||||
|
||||
// 2. 尝试提取```json代码块
|
||||
const jsonMatch = content.match(/```json\s*\n?([\s\S]*?)\n?```/);
|
||||
if (jsonMatch) {
|
||||
try {
|
||||
return JSON.parse(jsonMatch[1].trim()) as T;
|
||||
} catch {
|
||||
// 继续尝试其他方法
|
||||
// 尝试修复代码块 JSON
|
||||
try {
|
||||
const repaired = jsonrepair(jsonMatch[1].trim());
|
||||
return JSON.parse(repaired) as T;
|
||||
} catch {
|
||||
// 继续尝试其他方法
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +45,12 @@ export function parseJSONFromLLMResponse<T>(content: string): T {
|
||||
try {
|
||||
return JSON.parse(objectMatch[1]) as T;
|
||||
} catch {
|
||||
// 继续尝试其他方法
|
||||
try {
|
||||
const repaired = jsonrepair(objectMatch[1]);
|
||||
return JSON.parse(repaired) as T;
|
||||
} catch {
|
||||
// 继续尝试其他方法
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +59,12 @@ export function parseJSONFromLLMResponse<T>(content: string): T {
|
||||
try {
|
||||
return JSON.parse(arrayMatch[1]) as T;
|
||||
} catch {
|
||||
// 失败
|
||||
try {
|
||||
const repaired = jsonrepair(arrayMatch[1]);
|
||||
return JSON.parse(repaired) as T;
|
||||
} catch {
|
||||
// 失败
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user