feat: add百炼

This commit is contained in:
2025-06-21 14:01:33 +08:00
parent 3cd3be6024
commit 00a23af998
10 changed files with 113 additions and 8 deletions

12
src/utils/json.ts Normal file
View File

@@ -0,0 +1,12 @@
/**
* 尝试从字符串中提取JSON对象
*/
export const getJsonFromString = (str: string) => {
try {
const jsonMatch = str.match(/```json\s*([\s\S]*?)\s*```/);
if (jsonMatch && jsonMatch[1]) {
return JSON.parse(jsonMatch[1]);
}
} catch (error) {}
return null;
};