Commit Graph

60 Commits

Author SHA1 Message Date
728c7763e2 Add web search enrichment feature with source persistence and UI integration
Introduce optional web search enrichment flow for chat and regenerate requests. New /websearch endpoint calls enrich_prompt via SearXNG and returns enriched_prompt + citation sources.

DB: add sources_json column to chat_messages via ensure_sources_column migration helper.

Backend: persist sources_json for assistant replies (streaming and non-streaming); extend ChatRequest/RegenerateRequest to accept enriched_message and sources; history endpoint returns sources.

Frontend: add toggle for web search, settings for SearXNG URL + engines, and optional enrichment calls in sendMessage/regenerate. Render citation sources as rounded chips labeled with base domain under assistant replies.

Dependencies: add beautifulsoup4, httpx[http2], numpy for enrichment pipeline.
2025-08-27 04:27:18 +02:00
e262e4b4fe Improved codeblock-markdown-parser for a better experiencing when the LLM responds with code in Stream-mode 2025-08-26 05:32:45 +02:00
eb753582c1 Add user‑message collapse/expand feature
Implemented a per‑message collapse state that hides long user messages (>30 lines) with a “Show entire message / Collapse” button.
• Added collapsedUserMsgs map and helper collapseKeyFor to generate stable keys.
• Initialized or updated the collapse map whenever chat sessions or the active session change, preserving user toggles.
• Provided toggleUserMsgCollapse to switch the collapsed state.
• Updated the JSX to render the truncated content with an ellipsis when collapsed and render the expand/collapse button.
• Adjusted CSS for the new expand button: changed color to var(--muted), added align-self: flex-start, removed stray left margin, and retained bold, pointer cursor, and left‑aligned text.
• Minor style tweaks for the button hover effect.
2025-08-26 05:05:43 +02:00
f5d383ec94 Add user editing UI improvements and bubble styling
Implemented an editing state that visually highlights the user message bubble with an accent border and shadow.
  • Updated the message render logic to handle an  CSS class and overlay a textarea that perfectly aligns with the bubble using a hidden shadow element.
  • Re‑worked the  and  styles to apply the accent border, box‑shadow, and transition effects.
  • Adjusted the textarea styling (, ) so it inherits the bubble’s look, respects whitespace, and automatically resizes without extra padding or borders.
  • Added a hidden  to keep the bubble width/height consistent while editing.
  • Included new  button styling for expandable user messages.
  • Minor cleanup of redundant padding, margin, and color definitions in the styles.
  • Updated the JSX to conditionally render the overlay textarea only during editing, ensuring a smooth UX.
  • Added appropriate ARIA attributes and cursor styles for clarity.
2025-08-26 04:49:54 +02:00
7358c924ad upgraded codeblocks 2025-08-26 03:06:47 +02:00
7b4a699e2d Add streaming unread logic, copy button, and improved Markdown rendering
Implemented robust streaming handling for assistant replies: a placeholder message is inserted, unread sessions are flagged when the user is in a different chat, and scroll‑to‑bottom/ tip logic is applied once the stream completes.
  • Added copy‑to‑clipboard support for code blocks with visual feedback.
  • Re‑implemented Markdown to clean trailing whitespace in code blocks, preserve formatting, add copy buttons, and refine table & blockquote handling.
  • Introduced new CSS classes (.codeblock, .codeblock__header, .codeblock__copy, etc.) to style the code block wrapper, header bar, copy button, and pre/code area.
  • Updated the front‑end to wire up the new copy handler, manage pending scroll targets, and keep unread state in sync.
  • Minor cleanup of stray  tags and comments throughout the renderer.
  • Minor fixes to ensure proper scrolling behavior when the user scrolls away from the bottom during streaming.
  • Added descriptive comments and ensured cross‑browser copy functionality via navigator.clipboard.
  • Updated the markdown renderer to keep raw newlines for copy‑paste fidelity and to escape HTML entities correctly.
  • Adjusted CSS to match existing theme variables and provide smooth copy button transitions.
2025-08-26 02:56:56 +02:00
08d27f0007 feat: add message editing and regeneration endpoints
Add PUT /sessions/{session_id}/messages/{index} to edit a user message and prune all subsequent messages.

Add POST /sessions/{session_id}/regenerate to regenerate an assistant response from a given index (supports optional streaming).

Introduce EditMessageRequest and RegenerateRequest schemas.

Update the frontend to: • allow in‑place editing of user messages with an auto‑focusing textarea; • copy messages to clipboard; • regenerate assistant responses via a button.

Add new CSS rules for message options bars and the editing textarea.
2025-08-25 23:56:26 +02:00
d28d88d1f2 feat(ui,markdown): add collapsible 'Thoughts' for <think>, sanitize titles, improve focus UX; refactor table/blockquote render & styles
Backend: HTML-unescape and strip <think>/<thinking> from generated titles; trim and return cleaned value; add debug logs.

Electron: send 'window-focused' from main; expose onWindowFocus in preload.

Frontend: stream-safe AssistantMessageContent with collapsible Thoughts; switch streaming render to React state updates; autofocus textarea on window focus/new chat and when clicking empty chat area; sanitize session title client-side.

Markdown: support blockquotes; allow '-' or '*' bullets; simplify <think> removal to handle streaming; drop table wrapper div (emit <table class='nice'>); theme-aware code block headers/borders.

CSS: rounded 'nice' tables with light inner grid; blockquote styling; Thoughts toggle/panel styles.

Color: brighten Grayscale --accent.

Follow-ups: add IPC listener cleanup; ensure single source of truth for colorSchemes.
2025-08-25 21:13:09 +02:00
41c69abe28 feat: Add streaming chat + scroll persistence; improve markdown & links
Backend
- /chat: support streaming via StreamingResponse; save full reply after stream ends. Non-stream path unchanged.
- ChatRequest: add stream flag (default false).
- GenerateTitleRequest: add model and use it instead of hardcoded llama3.
- ollama_client.chat_stream(): new async generator parsing Ollama streaming JSON (both formats).
- Remove response_model from /chat to allow streaming; non-stream still returns { reply }.

Electron
- Open external links in system browser (setWindowOpenHandler, shell.openExternal).
- New IPC: update-settings, open-external-link.
- Set minimum window size; preload exposes updateSettings and openExternalLink.

Frontend (React)
- Streaming UI with live chunking; sticky-bottom only when user at bottom.
- Per-session scroll persistence and robust restore.
- New message tip to jump to latest reply when scrolled up.
- Disable Send while sending; spinner.
- General Settings: stream output toggle; propagate model/stream changes.
- Apply color scheme at boot; extract colorSchemes helper.
- Sidebar UX tweaks and unread badges.

Markdown/rendering
- Code blocks: language title bar and wrapper.
- Tables: GitHub-style parsing, per-cell borders, rounded wrapper, spacing, alignment.
- Headings: remove blank line after h1-h4.
- <hr>: handle after tables; strip following whitespace.
- Links: target=_blank with icon and URL tooltip.

Styles
- Add styles for code/table wrappers, new-message tip, toggle, spinner; hover/active vars; narrower sidebar.

API notes / breaking changes
- /chat accepts stream=true and returns text/plain streamed chunks.
- generate-title now requires a model.
- Non-stream /chat response shape unchanged.
2025-08-23 16:45:46 +02:00
191fe98ac0 initial commit 2025-08-22 23:42:34 +02:00