feat(chat): add LibreChat-inspired chat interface with MongoDB persistence

Implement full chat functionality with persistent sessions and messages
stored in MongoDB, LLM completion via Ollama (with multi-provider
dispatch support), markdown rendering, and a model selector.

- Add ChatSession/ChatMessage models with serde attributes for MongoDB
  ObjectId handling (skip_serializing_if empty, alias _id)
- Add CRUD server functions: list/create/rename/delete sessions,
  list/save messages, non-streaming chat completion
- Add raw Document collection accessor for BSON ObjectId -> String
  conversion in read paths
- Add SSE streaming endpoint (Axum handler) for future streaming support
- Add provider dispatch client (Ollama, OpenAI, Anthropic, HuggingFace)
- Add frontend components: ChatSidebar with namespace grouping,
  ChatModelSelector, ChatMessageList, ChatInputBar, ChatBubble with
  pulldown-cmark markdown rendering and StreamingBubble thinking indicator
- Rewrite ChatPage with full signal-based state management
- Add comprehensive CSS for chat UI, markdown prose, animations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-02-20 19:40:31 +01:00
parent 1f9629f111
commit 1a244f8f3d
19 changed files with 2225 additions and 161 deletions

45
Cargo.lock generated
View File

@@ -760,9 +760,11 @@ dependencies = [
name = "dashboard"
version = "0.1.0"
dependencies = [
"async-stream",
"async-stripe",
"axum",
"base64 0.22.1",
"bytes",
"chrono",
"dioxus",
"dioxus-cli-config",
@@ -774,6 +776,7 @@ dependencies = [
"maud",
"mongodb",
"petname",
"pulldown-cmark",
"rand 0.10.0",
"reqwest 0.13.2",
"scraper",
@@ -784,10 +787,12 @@ dependencies = [
"thiserror 2.0.18",
"time",
"tokio",
"tokio-stream",
"tower-http",
"tower-sessions",
"tracing",
"url",
"wasm-bindgen",
"web-sys",
]
@@ -1127,7 +1132,7 @@ dependencies = [
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-streams",
"wasm-streams 0.4.2",
"web-sys",
"xxhash-rust",
]
@@ -1531,7 +1536,7 @@ dependencies = [
"tracing",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-streams",
"wasm-streams 0.4.2",
"web-sys",
]
@@ -3297,6 +3302,24 @@ dependencies = [
"psl-types",
]
[[package]]
name = "pulldown-cmark"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14"
dependencies = [
"bitflags",
"memchr",
"pulldown-cmark-escape",
"unicase",
]
[[package]]
name = "pulldown-cmark-escape"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae"
[[package]]
name = "quinn"
version = "0.11.9"
@@ -3573,7 +3596,7 @@ dependencies = [
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-streams",
"wasm-streams 0.4.2",
"web-sys",
"webpki-roots 1.0.6",
]
@@ -3588,6 +3611,7 @@ dependencies = [
"bytes",
"encoding_rs",
"futures-core",
"futures-util",
"h2 0.4.13",
"http 1.4.0",
"http-body 1.0.1",
@@ -3610,12 +3634,14 @@ dependencies = [
"sync_wrapper",
"tokio",
"tokio-rustls 0.26.4",
"tokio-util",
"tower",
"tower-http",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-streams 0.5.0",
"web-sys",
]
@@ -5147,6 +5173,19 @@ dependencies = [
"web-sys",
]
[[package]]
name = "wasm-streams"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb"
dependencies = [
"futures-util",
"js-sys",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
name = "wasmparser"
version = "0.244.0"