diff --git a/tools/server/public_simplechat/docs/changelog.md b/tools/server/public_simplechat/docs/changelog.md index 4680eefd5c..017e975abb 100644 --- a/tools/server/public_simplechat/docs/changelog.md +++ b/tools/server/public_simplechat/docs/changelog.md @@ -299,6 +299,7 @@ Chat Session specific settings * More flexibility to user wrt ExternalAi tool call ie ai calling ai * the user can change the default behaviour of tools being disabled and sliding window of 1 * program restart will reset these back to the default +* Ui module cleanup to avoid duplicated/unneeded boiler plates, including using updated jsdoc annotations * A simple minded basic Markdown to Html logic diff --git a/tools/server/public_simplechat/readme.md b/tools/server/public_simplechat/readme.md index 9763b64f30..8f624d7191 100644 --- a/tools/server/public_simplechat/readme.md +++ b/tools/server/public_simplechat/readme.md @@ -126,7 +126,9 @@ 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 auto trimming of trailing garbage from model outputs +- Optional + - simple minded markdown parsing of chat message text contents (default) + - auto trimming of trailing garbage from model outputs - Follows responsive design to try adapt to any screen size diff --git a/tools/server/public_simplechat/simplechat.css b/tools/server/public_simplechat/simplechat.css index 9b46a30c76..ef1237fee1 100644 --- a/tools/server/public_simplechat/simplechat.css +++ b/tools/server/public_simplechat/simplechat.css @@ -125,8 +125,11 @@ body { word-break: break-word; hyphens: auto; } -.chat-message-content thead { +.chat-message-content thead th { text-align: left; + background-color: lightgray; + /* padding-inline: 1vmin; */ + border-radius: 0.4vmin; } .chat-message-content-live { overflow-wrap: break-word; diff --git a/tools/server/public_simplechat/simplechat.js b/tools/server/public_simplechat/simplechat.js index 72008b936a..5a16d62d1f 100644 --- a/tools/server/public_simplechat/simplechat.js +++ b/tools/server/public_simplechat/simplechat.js @@ -1497,7 +1497,7 @@ class MultiChatUI { } for (const [name, content] of showList) { if (content.length > 0) { - if (name == "content") { + if ((name == "content") && (this.simpleChats[chatId].cfg.chatProps.bMarkdown)) { entry = document.createElement('div') let md = new mMD.MarkDown() md.process(content) @@ -2105,6 +2105,7 @@ export class Config { * * only user messages following the latest system prompt is considered. */ iRecentUserMsgCnt: 5, + bMarkdown: true, bCompletionFreshChatAlways: true, bCompletionInsertStandardRolePrefix: false, bTrimGarbage: true, diff --git a/tools/server/public_simplechat/typemd.mjs b/tools/server/public_simplechat/typemd.mjs index 4020d91e21..100ff04519 100644 --- a/tools/server/public_simplechat/typemd.mjs +++ b/tools/server/public_simplechat/typemd.mjs @@ -4,6 +4,15 @@ // +/** + * A simple minded Markdown to Html convertor, which tries to support + * basic forms of the below in a simple, stupid and some cases in a semi rigid way. + * * headings + * * fenced code blocks / pres + * * unordered list + * * tables + * * horizontal line + */ export class MarkDown { constructor() { @@ -32,9 +41,9 @@ export class MarkDown { } /** - * Try extract a table from markdown content, - * one line at a time. + * Try extract a table from markdown content, one line at a time. * This is a imperfect logic, but should give a rough semblance of a table many a times. + * Purposefully allows for any text beyond table row end | marker to be shown. * @param {string} line */ process_table_line(line) {