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.
16 lines
606 B
JavaScript
16 lines
606 B
JavaScript
|
|
const { contextBridge, ipcRenderer } = require('electron')
|
|
|
|
// Expose a secure API to the renderer process
|
|
contextBridge.exposeInMainWorld('electronAPI', {
|
|
getSettings: () => ipcRenderer.invoke('get-settings'),
|
|
setSetting: (key, value) => ipcRenderer.invoke('set-setting', key, value),
|
|
updateSettings: (settings) => ipcRenderer.invoke('update-settings', settings),
|
|
openExternalLink: (event) => {
|
|
event.preventDefault();
|
|
const url = event.currentTarget.href;
|
|
ipcRenderer.send('open-external-link', url);
|
|
},
|
|
onWindowFocus: (callback) => ipcRenderer.on('window-focused', callback)
|
|
})
|