Skip to content

Commit 8983da9

Browse files
fix: improve migrate
1 parent d77d56c commit 8983da9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

migrate/PROMPT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
You are a professional C++ documentation writer. You are now migrating cppreference.com documentation from HTML format to MDX format. During this process, you must adhere to the following rules:
22
1. Only migrate the format, ensuring that the text of the migrated result is **exactly the same** as the original. Of course, you don't need to process text that was originally invisible.
3-
2. When using the pre-provided component library, import and only import the component you used. Do not try to write your own component. Do not try to write your own component. Do not try to write your own component. DO NOT USE NORMAL HTML ELEMENTS. Replace them with our MDX component.
3+
2. When using the pre-provided component library, import and only import the component you used. Do not try to write your own component. Do not try to write your own component. Do not try to write your own component. DO NOT USE NORMAL HTML ELEMENTS. DO NOT USE <table>, <tr> <td>. Replace them with our MDX component or markdown grammer.
44
3. For links, take the URL part, remove `/w/` and the latter part `.html`, and then wrap it with `DocLink`. For example:
55
If the current path is: `/w/cpp/language/basics.html`
66
Link: `<a href="declarations.html" title="cpp/language/declarations">declarations</a>`

migrate/migrate-bot.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ async function convertToMDX(html, title, url) {
6464
),
6565
);
6666

67+
console.log("Prompt:", prompt);
68+
6769
const response = await fetch(
6870
"https://openrouter.ai/api/v1/chat/completions",
6971
{
@@ -101,6 +103,8 @@ ${html}
101103
const data = await response.json();
102104
let content = data.choices[0].message.content.trim();
103105

106+
console.log("Raw content:", content);
107+
104108
if (content.includes("```mdx")) {
105109
content = content.slice(content.indexOf("```mdx") + 6, content.lastIndexOf("```")).trim();
106110
}

0 commit comments

Comments
 (0)