2(js)await (async () => {
const { sendMessage } = await import("https://scrapbox.io/api/code/takker-dist/scrapbox-chatGPT/mod.js");
const title = "2023/05/06";
const project = "villagepump";
const res2 = await fetch(`/api/pages/${project}/${encodeURIComponent(title)}/text`);
const result = sendMessage(`以下に示すものは、${title}に井戸端というコミュニティに書き込まれたやりとりの一部です。これを要約した上で、あなたが興味深いと思う話題を一つ選び、関心を示した理由を述べてください。\n\n---\n\n${(await res2.text()).slice(0,2000)}`);
if (!result) return;
const res = await result;
if (!res.ok) {
console.error(res.value);
return;
}
for await (const chat of res.value) {
if (chat.message.author.role !== "assistant") continue;
console.debug(chat.message.content.parts);
}
})();