Skip to content

Commit 0da2536

Browse files
committed
fix: content cannot be sent to AI.
1 parent 0556063 commit 0da2536

1 file changed

Lines changed: 39 additions & 41 deletions

File tree

src/components/monacoEditor/MonacoJsonEditor.tsx

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -372,15 +372,11 @@ const MonacoJsonEditor: React.FC<MonacoJsonEditorProps> = ({
372372
}
373373

374374
try {
375-
// 解析 JSON 数据, 不支持 lossless-json 语法
375+
// 不支持 lossless-json 语法
376376
const jsonData = JSON.parse(editorValue);
377377

378-
// 使用 jsonQuery 进行过滤
379378
const filteredData = jsonquery(jsonData, currentFilter);
380379

381-
console.log("jq", currentFilter, jsonData, filteredData);
382-
383-
// 格式化过滤后的数据
384380
const formattedResult = stringifyJson(filteredData, 2);
385381

386382
setFilteredValue(formattedResult);
@@ -1233,6 +1229,8 @@ const MonacoJsonEditor: React.FC<MonacoJsonEditorProps> = ({
12331229

12341230
return false;
12351231
}
1232+
1233+
setCurrentEditorValue(val);
12361234
setShowAiPrompt(true);
12371235

12381236
return true;
@@ -2080,43 +2078,43 @@ const MonacoJsonEditor: React.FC<MonacoJsonEditorProps> = ({
20802078
overflow: "hidden",
20812079
}}
20822080
>
2083-
<div className="flex items-center space-x-3">
2084-
<Icon icon="fluent:warning-28-filled" width={24} />
2085-
<p className="">
2086-
{parseJsonError?.line || 0} 行,第 {parseJsonError?.column || 0}{" "}
2087-
列错误, {parseJsonError?.message}
2088-
</p>
2089-
</div>
2090-
<div className={"flex items-center space-x-2"}>
2091-
<Button
2092-
className="bg-white/20"
2093-
color="primary"
2094-
size="sm"
2095-
startContent={<Icon icon="hugeicons:view" width={16} />}
2096-
onPress={openJsonErrorDetailsModel}
2097-
>
2098-
查看详情
2099-
</Button>
2100-
<Button
2101-
className="bg-white/20"
2102-
color="primary"
2103-
size="sm"
2104-
startContent={<Icon icon="mynaui:tool" width={16} />}
2105-
onPress={autoFix}
2106-
>
2107-
自动修复
2108-
</Button>
2109-
<Button
2110-
className="bg-white/20"
2111-
color="primary"
2112-
size="sm"
2113-
startContent={<Icon icon="mingcute:location-line" width={16} />}
2114-
onPress={goToErrorLine}
2115-
>
2116-
一键定位
2117-
</Button>
2081+
<div className="flex items-center space-x-3">
2082+
<Icon icon="fluent:warning-28-filled" width={24} />
2083+
<p className="">
2084+
{parseJsonError?.line || 0} 行,第{" "}
2085+
{parseJsonError?.column || 0} 列错误, {parseJsonError?.message}
2086+
</p>
2087+
</div>
2088+
<div className={"flex items-center space-x-2"}>
2089+
<Button
2090+
className="bg-white/20"
2091+
color="primary"
2092+
size="sm"
2093+
startContent={<Icon icon="hugeicons:view" width={16} />}
2094+
onPress={openJsonErrorDetailsModel}
2095+
>
2096+
查看详情
2097+
</Button>
2098+
<Button
2099+
className="bg-white/20"
2100+
color="primary"
2101+
size="sm"
2102+
startContent={<Icon icon="mynaui:tool" width={16} />}
2103+
onPress={autoFix}
2104+
>
2105+
自动修复
2106+
</Button>
2107+
<Button
2108+
className="bg-white/20"
2109+
color="primary"
2110+
size="sm"
2111+
startContent={<Icon icon="mingcute:location-line" width={16} />}
2112+
onPress={goToErrorLine}
2113+
>
2114+
一键定位
2115+
</Button>
2116+
</div>
21182117
</div>
2119-
</div>
21202118
)}
21212119
<ErrorModal
21222120
isOpen={jsonErrorDetailsModel}

0 commit comments

Comments
 (0)