mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-31 00:23:52 +00:00
Update lollms_client_js.js
This commit is contained in:
parent
542e0273a1
commit
0604760e15
@ -974,7 +974,8 @@ async summarizeText(
|
||||
maxSummarySize = 512,
|
||||
callback = null,
|
||||
chunkSummaryPostProcessing = null,
|
||||
summaryMode = "SEQUENTIAL"
|
||||
summaryMode = "SEQUENTIAL",
|
||||
reformat=false
|
||||
) {
|
||||
console.log("Tokenizing:")
|
||||
console.log(text)
|
||||
@ -982,6 +983,7 @@ async summarizeText(
|
||||
let tk = await this.tokenize(text);
|
||||
let prevLen = tk.length;
|
||||
let documentChunks = null;
|
||||
console.log(`Text size: ${prevLen}`)
|
||||
|
||||
while (tk.length > maxSummarySize && (documentChunks === null || documentChunks.length > 1)) {
|
||||
this.stepStart(`Compressing ${docName}...`);
|
||||
@ -1004,6 +1006,18 @@ async summarizeText(
|
||||
this.stepEnd(`Compressing ${docName}...`);
|
||||
if (dtkLn <= 10) break; // it is not summarizing
|
||||
}
|
||||
if(reformat){
|
||||
text = await this.lollms.generate(
|
||||
[
|
||||
this.lollms.system_message(),
|
||||
`${text}`,
|
||||
this.lollms.system_message(),
|
||||
summaryInstruction,
|
||||
"Do not add any extra comments.",
|
||||
this.lollms.system_message() + answerStart
|
||||
].join("\n"),
|
||||
);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user