mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🐞 fix: 修复哔哩哔哩总结的部分问题
This commit is contained in:
parent
1000d21e2f
commit
261184086d
@ -353,7 +353,13 @@ export class tools extends plugin {
|
|||||||
|
|
||||||
// 如果有ck 并且 有openai的key
|
// 如果有ck 并且 有openai的key
|
||||||
if (this.biliSessData && this.openaiApiKey) {
|
if (this.biliSessData && this.openaiApiKey) {
|
||||||
const prompt = await getBiliGptInputText(title, aid, cid);
|
let prompt;
|
||||||
|
try {
|
||||||
|
prompt = await getBiliGptInputText(title, aid, cid);
|
||||||
|
} catch (err) {
|
||||||
|
logger.error("总结失败,可能是没有弹幕或者网络问题!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const response = await this.chatGptClient.sendMessage(prompt);
|
const response = await this.chatGptClient.sendMessage(prompt);
|
||||||
// 暂时不设计上下文
|
// 暂时不设计上下文
|
||||||
e.reply(response.response);
|
e.reply(response.response);
|
||||||
|
@ -28,7 +28,10 @@ export async function getBiliGptInputText(title, aid, cid, shouldShowTimestamp =
|
|||||||
commonConfig,
|
commonConfig,
|
||||||
);
|
);
|
||||||
const subtitles = (await resp.json()).data.subtitle.subtitles;
|
const subtitles = (await resp.json()).data.subtitle.subtitles;
|
||||||
const res = await fetch(`http:${subtitles[0].subtitle_url}`);
|
const res = await fetch(`http:${subtitles[0]?.subtitle_url}`);
|
||||||
|
if (_.isUndefined(res)) {
|
||||||
|
throw new Error("");
|
||||||
|
}
|
||||||
const subtitlesData = (await res.json()).body;
|
const subtitlesData = (await res.json()).body;
|
||||||
const subtitleTimestamp = reduceBilibiliSubtitleTimestamp(subtitlesData, shouldShowTimestamp);
|
const subtitleTimestamp = reduceBilibiliSubtitleTimestamp(subtitlesData, shouldShowTimestamp);
|
||||||
const inputText = getSmallSizeTranscripts(subtitleTimestamp, subtitleTimestamp);
|
const inputText = getSmallSizeTranscripts(subtitleTimestamp, subtitleTimestamp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user