mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 21:29:11 +00:00
Fix, improve displaying chat messages, sources by Khoj in web interface
Pretty pretty json in conversation logs
This commit is contained in:
@@ -219,7 +219,7 @@ def save_chat_session():
|
|||||||
conversation_logfile = resolve_absolute_path(state.processor_config.conversation.conversation_logfile)
|
conversation_logfile = resolve_absolute_path(state.processor_config.conversation.conversation_logfile)
|
||||||
conversation_logfile.parent.mkdir(parents=True, exist_ok=True) # create conversation directory if doesn't exist
|
conversation_logfile.parent.mkdir(parents=True, exist_ok=True) # create conversation directory if doesn't exist
|
||||||
with open(conversation_logfile, "w+", encoding="utf-8") as logfile:
|
with open(conversation_logfile, "w+", encoding="utf-8") as logfile:
|
||||||
json.dump(conversation_log, logfile)
|
json.dump(conversation_log, logfile, indent=2)
|
||||||
|
|
||||||
state.processor_config.conversation.chat_session = None
|
state.processor_config.conversation.chat_session = None
|
||||||
logger.info("📩 Saved current chat session to conversation logs")
|
logger.info("📩 Saved current chat session to conversation logs")
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
function generateReference(reference, index) {
|
function generateReference(reference, index) {
|
||||||
// Generate HTML for Chat Reference
|
// Generate HTML for Chat Reference
|
||||||
return `<sup><abbr title="${reference}" tabindex="0">${index}</abbr></sup>`;
|
let escaped_ref = reference.replaceAll("\"", "\\\"")
|
||||||
|
return `<sup><abbr title="${escaped_ref}" tabindex="0">${index}</abbr></sup>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderMessage(message, by, dt=null) {
|
function renderMessage(message, by, dt=null) {
|
||||||
@@ -179,6 +180,7 @@
|
|||||||
color: #f8fafc;
|
color: #f8fafc;
|
||||||
background: #017eff;
|
background: #017eff;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
white-space: pre-line;
|
||||||
}
|
}
|
||||||
/* add left protrusion to khoj chat bubble */
|
/* add left protrusion to khoj chat bubble */
|
||||||
.chat-message-text.khoj:after {
|
.chat-message-text.khoj:after {
|
||||||
|
|||||||
Reference in New Issue
Block a user