SimpleChatTCRV:Markdown: flexible unwind list
This commit is contained in:
parent
11eab92d08
commit
82d436b537
|
|
@ -339,3 +339,10 @@ their respective functionalities.
|
||||||
|
|
||||||
Add support for base64 encoded pdf passing to ai models, when the models and llama engine gain that capability
|
Add support for base64 encoded pdf passing to ai models, when the models and llama engine gain that capability
|
||||||
in turn using openai file - file-data type sub block within content array or so ...
|
in turn using openai file - file-data type sub block within content array or so ...
|
||||||
|
|
||||||
|
See why the ai streamed response not showing up in TCExternalAi chat session ui, even thou the content is getting
|
||||||
|
appended to its DivStream. IE why it is hidden.
|
||||||
|
|
||||||
|
Markdown if a line which doesnt have any list marker appears at the same offset level as the last list item,
|
||||||
|
that too after a new line before this ambiguous line, then maybe pop out 1 level wrt the list.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,15 +109,23 @@ export class MarkDown {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unwind_list() {
|
/**
|
||||||
while (true) {
|
* Unwind till the specified offset level.
|
||||||
|
* @param {number} unwindTillOffset
|
||||||
|
*/
|
||||||
|
unwind_list(unwindTillOffset=-1) {
|
||||||
|
if (this.in.list.offsets.length == 0) {
|
||||||
|
return { done: true, remaining: 0 }
|
||||||
|
}
|
||||||
|
while (this.in.list.offsets[this.in.list.offsets.length-1] > unwindTillOffset) {
|
||||||
|
this.in.list.offsets.pop()
|
||||||
let popped = this.in.list.endType.pop()
|
let popped = this.in.list.endType.pop()
|
||||||
if (popped == undefined) {
|
this.html += popped;
|
||||||
|
if (this.in.list.offsets.length == 0) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
this.html += popped
|
|
||||||
}
|
}
|
||||||
this.in.list.offsets.length = 0
|
return { done: true, remaining: this.in.list.offsets.length }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -154,20 +162,14 @@ export class MarkDown {
|
||||||
this.in.list.endType.push("</ul>\n")
|
this.in.list.endType.push("</ul>\n")
|
||||||
}
|
}
|
||||||
} else if (lastOffset > curOffset){
|
} else if (lastOffset > curOffset){
|
||||||
while (this.in.list.offsets[this.in.list.offsets.length-1] > curOffset) {
|
this.unwind_list(curOffset)
|
||||||
this.in.list.offsets.pop()
|
|
||||||
let popped = this.in.list.endType.pop()
|
|
||||||
this.html += popped;
|
|
||||||
if (this.in.list.offsets.length == 0) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.html += `<li>${matchList[3]}</li>\n`
|
this.html += `<li>${matchList[3]}</li>\n`
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
if (this.in.list.offsets.length > 0) {
|
if (this.in.list.offsets.length > 0) {
|
||||||
if (emptyTracker.cur > 0) {
|
if (emptyTracker.cur > 0) {
|
||||||
|
// skip empty line
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
let matchOffset = line.match(/^([ ]*)(.*)$/);
|
let matchOffset = line.match(/^([ ]*)(.*)$/);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue