mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-06-27 17:00:17 +08:00
wip
This commit is contained in:
@@ -332,7 +332,7 @@ export const defaultConfig = {
|
||||
|
||||
// advanced
|
||||
|
||||
maxResponseTokenLength: 1000,
|
||||
maxResponseTokenLength: 200000,
|
||||
maxConversationContextLength: 9,
|
||||
temperature: 1,
|
||||
customChatGptWebApiUrl: 'https://chatgpt.com',
|
||||
|
||||
@@ -54,8 +54,8 @@ export default {
|
||||
subtitleContent = replaceHtmlEntities(subtitleContent)
|
||||
|
||||
return await cropText(
|
||||
`Provide a structured summary of the following video in markdown format, focusing on key takeaways and crucial information, and ensuring to include the video title. The summary should be easy to read and concise, yet comprehensive.` +
|
||||
`The video title is "${title}". The subtitle content is as follows:\n${subtitleContent}`,
|
||||
`Provide a structured summary of the content of the following video in markdown format, focusing on key takeaways and crucial information for the viewer Gwern, and ensure to include the video title and completeness of transcript if needed. Ignore promotions, bio's, and other uninteresting parts. The summary should be easy to read and concise, yet comprehensive. You should include key text as markdown quotes after tidying them up.` +
|
||||
`The video title is "${title}". Add a tldr and BLUF. The subtitle content is as follows:\n${subtitleContent}`,
|
||||
)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
|
||||
@@ -31,7 +31,7 @@ const clamp = (v, min, max) => {
|
||||
/** this function will crop text by keeping the beginning and end */
|
||||
export async function cropText(
|
||||
text,
|
||||
maxLength = 4096,
|
||||
maxLength = 200000,
|
||||
startLength = 0,
|
||||
endLength = 0,
|
||||
tiktoken = true,
|
||||
@@ -97,10 +97,10 @@ export async function cropText(
|
||||
|
||||
// Construct the cropped text
|
||||
croppedText = splits.slice(0, middleIndex).join('\n')
|
||||
if (middleIndex !== endStartIndex) {
|
||||
if (croppedTokens > 0) {
|
||||
croppedText += `\n\n**Important disclaimer**, this text is incomplete! ${croppedTokens} or ${
|
||||
(croppedTokens / totalTokens).toFixed(2) * 100
|
||||
}% of tokens have been removed from this location in the text due to lack limited model context\n\n`
|
||||
}% of tokens have been removed from this location in the text due to lack limited model context of ${maxLength}\n\n`
|
||||
}
|
||||
croppedText += splits.slice(endStartIndex).join('\n')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user