mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix: handle extra text in gemini output for dedup workflow (#6771)
This commit is contained in:
@@ -185,8 +185,13 @@ jobs:
|
|||||||
core.info(`Raw duplicates JSON: ${rawJson}`);
|
core.info(`Raw duplicates JSON: ${rawJson}`);
|
||||||
let parsedJson;
|
let parsedJson;
|
||||||
try {
|
try {
|
||||||
const trimmedJson = rawJson.replace(/^```(?:json)?\s*/, '').replace(/\s*```$/, '').trim();
|
const jsonStringMatch = rawJson.match(/{[\s\S]*}/);
|
||||||
parsedJson = JSON.parse(trimmedJson);
|
if (!jsonStringMatch) {
|
||||||
|
core.setFailed(`Could not find JSON object in the output.\nRaw output: ${rawJson}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const jsonString = jsonStringMatch[0];
|
||||||
|
parsedJson = JSON.parse(jsonString);
|
||||||
core.info(`Parsed duplicates JSON: ${JSON.stringify(parsedJson)}`);
|
core.info(`Parsed duplicates JSON: ${JSON.stringify(parsedJson)}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.setFailed(`Failed to parse duplicates JSON from Gemini output: ${err.message}\nRaw output: ${rawJson}`);
|
core.setFailed(`Failed to parse duplicates JSON from Gemini output: ${err.message}\nRaw output: ${rawJson}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user