mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
import { retryFetch } from "./common.js";
|
|
import { PearAPI_CRAWLER, PearAPI_DEEPSEEK } from "../constants/tools.js";
|
|
|
|
/**
|
|
* LLM 爬虫
|
|
* @param summaryLink
|
|
* @returns {Promise<string>}
|
|
*/
|
|
export async function llmRead(summaryLink) {
|
|
const llmCrawler = await retryFetch(PearAPI_CRAWLER.replace("{}", summaryLink));
|
|
return (await llmCrawler.json())?.data;
|
|
}
|
|
|
|
/**
|
|
* DeepSeek对话
|
|
* @param content
|
|
* @param prompt
|
|
* @returns {Promise<string>}
|
|
*/
|
|
export async function deepSeekChat(content, prompt) {
|
|
const deepseekFreeSummary = await fetch(PearAPI_DEEPSEEK, {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify({
|
|
"messages": [
|
|
{
|
|
"role": "system",
|
|
"content": prompt
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": content,
|
|
}]
|
|
}),
|
|
});
|
|
return (await deepseekFreeSummary.json())?.message;
|
|
}
|