Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(agent-skills): use res.text() for text/markdown endpoint (GAP-1 critical bug)

diegosouzapw4797c08018df
diff --git a/src/app/(dashboard)/dashboard/agent-skills/AgentSkillsPageClient.tsx b/src/app/(dashboard)/dashboard/agent-skills/AgentSkillsPageClient.tsx
index 6eadae3dc5..e70d5b7d10 100644
--- a/src/app/(dashboard)/dashboard/agent-skills/AgentSkillsPageClient.tsx
+++ b/src/app/(dashboard)/dashboard/agent-skills/AgentSkillsPageClient.tsx
@@ -95,8 +95,8 @@ export function AgentSkillsPageClient(): JSX.Element {
try {
const res = await fetch(`/api/agent-skills/${id}/raw`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
- const json = (await res.json()) as { body: string };
- setMarkdownCache((prev) => new Map(prev).set(id, json.body ?? ""));
+ const body = await res.text();
+ setMarkdownCache((prev) => new Map(prev).set(id, body));
} catch {
setMarkdownCache((prev) => {
const next = new Map(prev);
diff --git a/tests/unit/agent-skills-page.test.tsx b/tests/unit/agent-skills-page.test.tsx
index 656eb75f00..df7acfe2ec 100644
--- a/tests/unit/agent-skills-page.test.tsx
+++ b/tests/unit/agent-skills-page.test.tsx
@@ -106,9 +106,9 @@ function mockFetch(skills: AgentSkill[], coverage: SkillCoverage, rawMarkdown =
});
}
if (/\/api\/agent-skills\/.+\/raw/.test(urlStr)) {
- return new Response(JSON.stringify({ body: rawMarkdown }), {
+ return new Response(rawMarkdown, {
status: 200,
- headers: { "Content-Type": "application/json" },
+ headers: { "Content-Type": "text/markdown; charset=utf-8" },
});
}
return new Response(JSON.stringify({}), { status: 404 });