SimpleChatTCRV:CMTextFormat: Common flow accounting User and Auto
If user explicitly makes a content text format selection, the same will be used. Else based on session settings, a format will be used. Now when the popover menu is shown, the current message's format type is reflected in the popover menu.
This commit is contained in:
parent
c68316bf07
commit
afd6365ecc
|
|
@ -305,6 +305,7 @@ Chat Session specific settings
|
|||
* lists (ordered, unordered, intermixed at diff leves)
|
||||
accomodate lines without list markers inbetween list items to some extent, hopefully in a sane way.
|
||||
* tables, fenced code blocks, blockquotes
|
||||
* User given control to enable markdown implicitly at a session level, or explicitly set wrt individual msgs.
|
||||
* Rename fetch_web_url_raw to fetch_url_raw, avoids confusion and matchs semantic of access to local and web.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -268,7 +268,8 @@ It is attached to the document object. Some of these can also be updated using t
|
|||
|
||||
* Markdown
|
||||
|
||||
- enabled: whether markdown support is enabled or not.
|
||||
- enabled: whether auto markdown support is enabled or not at a session level.
|
||||
- user can always override explicitly wrt any chat message, as they see fit.
|
||||
- always: if true, all messages text content interpreted as Markdown based text and converted to html for viewing.
|
||||
if false, then interpret only ai assistant's text content as markdown.
|
||||
- htmlSanitize: text content sanitized using browser's dom parser, so html/xml tags get converted to normal visually equivalent text representation, before processing by markdown to html conversion logic.
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
|
||||
<div id="popover-chatmsg" popover="auto">
|
||||
<select id="popover-chatmsg-format">
|
||||
<option>default</option>
|
||||
<option>plain</option>
|
||||
<option>markdown</option>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -133,7 +133,8 @@ A lightweight simple minded ai chat client with a web front-end that supports mu
|
|||
- Client side Sliding window Context control, using `iRecentUserMsgCnt`, helps limit context sent to ai model
|
||||
|
||||
- Optional
|
||||
- simple minded markdown parsing of chat message text contents (default)
|
||||
- simple minded markdown parsing of chat message text contents (default wrt assistant messages/responses)
|
||||
- user can override, if needed globally or at a individual message level
|
||||
- auto trimming of trailing garbage from model outputs
|
||||
|
||||
- Follows responsive design to try adapt to any screen size
|
||||
|
|
|
|||
|
|
@ -277,6 +277,7 @@ export class NSChatMessage {
|
|||
|
||||
class Format {
|
||||
static Text = {
|
||||
Default: "default",
|
||||
Plain: "plain",
|
||||
Html: "html",
|
||||
Markdown: "markdown",
|
||||
|
|
@ -309,7 +310,7 @@ export class ChatMessageEx {
|
|||
}
|
||||
this.uniqId = ChatMessageEx.getUniqId()
|
||||
this.trimmedContent = trimmedContent;
|
||||
this.textFormat = Format.Text.Plain
|
||||
this.textFormat = Format.Text.Default
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -325,7 +326,7 @@ export class ChatMessageEx {
|
|||
clear() {
|
||||
this.ns = new NSChatMessage()
|
||||
this.trimmedContent = undefined;
|
||||
this.textFormat = Format.Text.Plain
|
||||
this.textFormat = Format.Text.Default
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1531,7 +1532,7 @@ class MultiChatUI {
|
|||
for (const [name, stype, content] of showList) {
|
||||
let sftype = stype
|
||||
if (content.length > 0) {
|
||||
if ((name == "content") && (chatSessionMarkdown.enabled)) {
|
||||
if ((name == "content") && (sftype == Format.Text.Default) && (chatSessionMarkdown.enabled)) {
|
||||
if (chatSessionMarkdown.always) {
|
||||
sftype = Format.Text.Markdown
|
||||
} else {
|
||||
|
|
@ -1848,6 +1849,15 @@ class MultiChatUI {
|
|||
|
||||
// ChatMessage edit popover menu
|
||||
|
||||
this.elPopoverChatMsg.addEventListener('beforetoggle', (tev)=>{
|
||||
let chatSession = this.simpleChats[this.curChatId]
|
||||
let index = chatSession.get_chatmessage_index(this.uniqIdChatMsgPO)
|
||||
let chat = chatSession.xchat[index]
|
||||
if (chat.ns.has_content()) {
|
||||
this.elPopoverChatMsgFormatSelect.value = chat.textFormat
|
||||
}
|
||||
})
|
||||
|
||||
this.elPopoverChatMsgDelBtn.addEventListener('click', (ev) => {
|
||||
console.log(`DBUG:SimpleChat:MCUI:ChatMsgPO:Del:${this.curChatId}:${this.uniqIdChatMsgPO}`)
|
||||
this.chatmsg_del_uiupdate(this.curChatId, this.uniqIdChatMsgPO)
|
||||
|
|
|
|||
Loading…
Reference in New Issue