Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Added

- **Transparent Stream fades newly streamed words in.** In Transparent Stream mode, newly arriving assistant words now fade in at the prose level as they stream — without animating (or re-flickering) the thinking rows, tool rows, or the transparent event rows. It respects your OS "reduce motion" setting (no fade when reduced motion is on) and is part of the Transparent Stream experience regardless of the "Fade text effect" toggle. Thanks @rodboev. (#5506, #5367)
- **The Preferences default-model setting now uses the rich model picker.** The "Default Model" control in Settings → Preferences was a plain dropdown; it now uses the same searchable, provider-grouped picker as the composer (with a "Custom Model ID" field), so choosing a default model is consistent everywhere. On touch devices the picker no longer pops the keyboard the instant you open it (it still focuses search on desktop and while you're typing), and its label now activates the picker directly. Thanks @rodboev. (#5502, #5497)
- **Scheduled jobs get a preset schedule builder.** The cron job form now has a "Preset" dropdown (Hourly / Daily / Weekdays / Weekly / Monthly, plus Custom) above the Schedule field — pick one and it fills the schedule for you (e.g. Daily → `0 9 * * *`, Hourly → `every 1h`) instead of hand-writing a cron expression. "Custom" keeps the free-text field, and editing an existing job maps its schedule back to the matching preset. Thanks @rodboev. (#5438, #5427)
- **Add a self-hosted provider (Ollama or LM Studio) from Settings.** After onboarding, a new Settings control lets you point WebUI at a local OpenAI-compatible model server (Ollama / LM Studio) by choosing the provider, model, and base URL — no hand-editing `config.yaml`. The base URL is validated (scheme + provider allowlist) and persisted for the agent's provider client. An optional "Test connection" button reuses the existing authenticated onboarding probe to fetch the model list from the URL you enter. Thanks @rodboev. (#5408, #3260)
Expand Down
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ <h2 data-i18n="empty_title">What can I help with?</h2>
<input type="checkbox" id="settingsFadeTextEffect" style="width:15px;height:15px;accent-color:var(--accent)">
<span data-i18n="settings_label_fade_text_effect">Fade text effect</span>
</label>
<div style="font-size:11px;color:var(--muted);margin-top:4px" data-i18n="settings_desc_fade_text_effect">Fade newly streamed words in while the assistant is responding. Similar to OpenWebUI; off by default for maximum performance.</div>
<div style="font-size:11px;color:var(--muted);margin-top:4px" data-i18n="settings_desc_fade_text_effect">Fade newly streamed words in while the assistant is responding. Similar to OpenWebUI; off by default for maximum performance. Transparent Stream always fades prose as part of that mode, regardless of this setting.</div>
</div>
<div class="settings-field">
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
Expand Down
121 changes: 92 additions & 29 deletions static/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2546,10 +2546,10 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
let _streamFadeLastArrivalMs=0;
let _streamFadeArrivalWps=0;
let _streamFadeLatestAnimationEndAt=0;
let _streamFadeAppendOffset=0;
let _streamFadeVisibleWords=0;
let _streamFadeHoldUntilMs=0;
let _streamFadeCurrentMs=200;
let _streamFadeCurrentMs=620;
let _streamFadeDomText='';
let _streamFadeReduceMotionMql=null;
let _streamFadeReduceMotion=false;
let _streamFadeReduceMotionOnChange=null;
Expand All @@ -2560,11 +2560,10 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
? Number((INFLIGHT[activeSid]&&INFLIGHT[activeSid].lastRunJournalSeq)||0)
: 0;
let _lastRunJournalEventId='';
const _STREAM_FADE_MS=200;
const _STREAM_FADE_MAX_MS=350;
const _STREAM_FADE_STAGGER_MS=16;
const _STREAM_FADE_DONE_MAX_MS=320;
const _STREAM_FADE_DONE_DRAIN_MAX_MS=900;
const _STREAM_FADE_MS=620;
const _STREAM_FADE_MAX_MS=900;
const _STREAM_FADE_DONE_MAX_MS=1000;
const _STREAM_FADE_DONE_DRAIN_MAX_MS=1400;
const _anchorApi=(typeof window!=='undefined'&&window.HermesAssistantTurnAnchors)
? window.HermesAssistantTurnAnchors
: null;
Expand Down Expand Up @@ -3669,21 +3668,24 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
function _anchorProseIncrementalNode(key, text){
if(!window.smd || !key || typeof _safeSmdRenderer!=='function') return null;
const value=String(text||'');
const fade=typeof _shouldUseLiveProseFade==='function'&&_shouldUseLiveProseFade();
try{
let st=_anchorProseSmdCache.get(key);
// Self-heal desyncs (edit/sanitize made the text no longer a pure append):
// rebuild the parser+node from scratch, mirroring _smdWrite's guard.
if(st && st.writtenText && !value.startsWith(st.writtenText)) st=null;
if(st && st.fade!==fade) st=null;
if(!st){
const node=document.createElement('div');
node.className='assistant-segment';
node.setAttribute('data-anchor-scene-prose','1');
const body=document.createElement('div');
body.className='msg-body';
if(body.classList) body.classList.toggle('stream-fade-active',fade);
node.appendChild(body);
const baseRenderer=_safeSmdRenderer(body);
const baseRenderer=fade?_streamFadeRenderer(body):_safeSmdRenderer(body);
const renderer=_smdRendererWithoutUnderscoreEmphasis(baseRenderer);
st={node,parser:window.smd.parser(renderer),writtenText:''};
st={node,parser:window.smd.parser(renderer),writtenText:'',fade};
_anchorProseSmdCache.set(key,st);
// Bound memory across turns: keys embed the stream id, so stale entries
// from finished streams age out here.
Expand All @@ -3692,6 +3694,8 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
if(oldest!==key) _anchorProseSmdCache.delete(oldest);
}
}
const body=st.node&&st.node.querySelector&&st.node.querySelector('.msg-body');
if(body&&body.classList) body.classList.toggle('stream-fade-active',fade);
const delta=value.slice(st.writtenText.length);
if(delta){
window.smd.parser_write(st.parser,delta);
Expand Down Expand Up @@ -4114,10 +4118,10 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
_streamFadeLastArrivalMs=0;
_streamFadeArrivalWps=0;
_streamFadeLatestAnimationEndAt=0;
_streamFadeAppendOffset=0;
_streamFadeVisibleWords=0;
_streamFadeHoldUntilMs=0;
_streamFadeCurrentMs=_STREAM_FADE_MS;
_streamFadeDomText='';
}
function _cancelAnimationFramePendingStreamRender(){
if(_pendingRafHandle===null) return;
Expand All @@ -4129,6 +4133,12 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
function _shouldUseStreamFade(){
return window._fadeTextEffect===true;
}
function _shouldUseTransparentStreamFade(){
return typeof isTransparentStream==='function'&&isTransparentStream();
}
function _shouldUseLiveProseFade(){
return !_streamFadeReduceMotionEnabled() && (_shouldUseStreamFade() || _shouldUseTransparentStreamFade());
}
function _streamFadeSkipNode(node){
if(!node||node.nodeType!==1) return false;
const tag=(node.tagName||'').toLowerCase();
Expand Down Expand Up @@ -4187,13 +4197,10 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
const span=document.createElement('span');
span.className='stream-fade-word is-new';
const fadeMs=_streamFadeCurrentMs||_STREAM_FADE_MS;
const delayMs=_streamFadeAppendOffset*_STREAM_FADE_STAGGER_MS;
span.style.animationDelay=delayMs+'ms';
if(fadeMs!==_STREAM_FADE_MS) span.style.setProperty('--stream-fade-ms',fadeMs+'ms');
span.textContent=match[1];
frag.appendChild(span);
_streamFadeAppendOffset+=1;
_streamFadeLatestAnimationEndAt=Math.max(_streamFadeLatestAnimationEndAt,appendStartedAt+delayMs+fadeMs);
_streamFadeLatestAnimationEndAt=Math.max(_streamFadeLatestAnimationEndAt,appendStartedAt+fadeMs);
if(match[2]) frag.appendChild(document.createTextNode(match[2]));
last=match.index+match[0].length;
changed=true;
Expand Down Expand Up @@ -4257,6 +4264,39 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
const m=String(text||'').match(/\S+/g);
return m?m.length:0;
}
function _streamFadeAppendText(el, text){
if(!el) return;
const value=String(text||'');
if(!value) return;
const reduceMotion=_streamFadeReduceMotionEnabled();
const frag=document.createDocumentFragment();
const wordRe=/(\S+)(\s*)/g;
const appendStartedAt=performance.now();
let last=0, match, changed=false;
while((match=wordRe.exec(value))){
if(match.index>last) frag.appendChild(document.createTextNode(value.slice(last,match.index)));
if(reduceMotion){
frag.appendChild(document.createTextNode(match[1]));
}else{
const span=document.createElement('span');
span.className='stream-fade-word is-new';
const fadeMs=_streamFadeCurrentMs||_STREAM_FADE_MS;
if(fadeMs!==_STREAM_FADE_MS) span.style.setProperty('--stream-fade-ms',fadeMs+'ms');
span.textContent=match[1];
frag.appendChild(span);
_streamFadeLatestAnimationEndAt=Math.max(_streamFadeLatestAnimationEndAt,appendStartedAt+fadeMs);
}
if(match[2]) frag.appendChild(document.createTextNode(match[2]));
last=match.index+match[0].length;
changed=true;
}
if(!changed){
frag.appendChild(document.createTextNode(value));
}else if(last<value.length){
frag.appendChild(document.createTextNode(value.slice(last)));
}
el.appendChild(frag);
}
Comment on lines +4267 to +4299

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 _streamFadeAppendText is defined but never called

A grep across static/ finds exactly one occurrence of _streamFadeAppendText — the definition itself. The test also explicitly asserts it is absent from the rendering path ("_streamFadeAppendText(assistantBody,delta)" not in render_block). The ui.js counterpart _appendTransparentFadeText (called from _refreshTransparentFadeProseRow) already covers the transparent-anchor use case, and _streamFadeRenderer's inline add_text handler covers the messages.js path. As written, this function is dead code and may mislead a future contributor into calling it on assistantBody in transparent mode — which the tests explicitly prohibit.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

function _streamFadePauseAfter(text, paragraphBreakIndex){
if(paragraphBreakIndex>=0) return 90;
const trimmed=String(text||'').trimEnd();
Expand Down Expand Up @@ -4360,17 +4400,36 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
const next=_streamFadeNextText(displayText);
if(!next.changed) return next.caughtUp;
assistantBody.classList.add('stream-fade-active');
if(!_smdParser&&window.smd){
if(_smdReconnect){assistantBody.innerHTML='';_smdReconnect=false;}
_smdNewParser(assistantBody,true);
if(!_shouldUseTransparentStreamFade()){
if(!_smdParser&&window.smd){
if(_smdReconnect){assistantBody.innerHTML='';_smdReconnect=false;}
_smdNewParser(assistantBody,true);
}
if(_smdParser){
_smdWrite(next.text,true);
}else{
assistantBody.innerHTML=renderMd ? renderMd(next.text||'') : esc(next.text||'');
_sanitizeSmdLinks(assistantBody);
}
_streamFadeDomText=String(next.text||'');
return next.caughtUp;
}
if(_smdParser){
_streamFadeAppendOffset=0;
_smdWrite(next.text,true);
}else{
assistantBody.innerHTML=renderMd ? renderMd(next.text||'') : esc(next.text||'');
_sanitizeSmdLinks(assistantBody);
_smdEndParser();
assistantBody.textContent='';
_streamFadeDomText='';
}
_smdReconnect=false;
if(!_streamFadeDomText&&assistantBody.textContent){
assistantBody.textContent='';
}
if(!String(next.text||'').startsWith(_streamFadeDomText)){
assistantBody.textContent='';
_streamFadeDomText='';
}
const delta=String(next.text||'').slice(_streamFadeDomText.length);
if(delta) assistantBody.appendChild(document.createTextNode(delta));
_streamFadeDomText=String(next.text||'');
return next.caughtUp;
}
function _streamFadeCurrentDisplayText(){
Expand All @@ -4386,6 +4445,8 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
if(!assistantBody){onDone();return;}
const target=_streamFadeCurrentDisplayText();
const caughtUp=_renderStreamingFadeMarkdown(target);
const anchorProcessText=_streamFadeDomText||target;
if(anchorProcessText) _upsertAnchorProcessProse(anchorProcessText);
scrollIfPinned();
if(caughtUp){
// parser_end can flush pending markdown text; include that final text in
Expand Down Expand Up @@ -4760,12 +4821,14 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
const parsed=_cachedParsed&&_cachedParsedText===assistantText&&_cachedParsedReasoning===liveReasoningText ? _cachedParsed : _parseStreamState();
_cachedParsed=null;
_renderLiveThinking(parsed);
const displayText = segmentStart===0
? parsed.displayText // first segment: uses think-tag stripping
: _stripXmlToolCalls(assistantText.slice(segmentStart));
let anchorProcessText=displayText;
if(assistantBody){
const displayText = segmentStart===0
? parsed.displayText // first segment: uses think-tag stripping
: _stripXmlToolCalls(assistantText.slice(segmentStart));
if(_shouldUseStreamFade()){
if(_shouldUseLiveProseFade()){
const caughtUp=_renderStreamingFadeMarkdown(displayText);
anchorProcessText=_streamFadeDomText||'';
if(!caughtUp&&!_streamFinalized){
setTimeout(()=>_scheduleRender(), 33);
}
Expand All @@ -4790,13 +4853,13 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
assistantBody.innerHTML = renderMd ? renderMd(fallbackText) : esc(fallbackText);
}
}
_upsertAnchorProcessProse(displayText);
if(typeof _syncLiveWorklogReasonsForAnchor==='function') _syncLiveWorklogReasonsForAnchor(assistantRow, displayText);
}
if(anchorProcessText) _upsertAnchorProcessProse(anchorProcessText);
scrollIfPinned();
_throttledSnapshotLiveTurn();
};
const frameIntervalMs=_shouldUseStreamFade()?33:66;
const frameIntervalMs=_shouldUseLiveProseFade()?33:66;
if(sinceLastMs>=frameIntervalMs){
_pendingRafHandle=requestAnimationFrame(_doRender);
} else {
Expand Down Expand Up @@ -5489,7 +5552,7 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
});
sendBrowserNotification('Response complete',_completionPreview||'Task finished',{forceHidden:_wasEverBackgrounded,sid:activeSid});
};
if(_shouldUseStreamFade()&&assistantBody){
if(_shouldUseLiveProseFade()&&assistantBody){
_cancelAnimationFramePendingStreamRender();
_drainStreamFadeBeforeDone(_finishDone);
return;
Expand Down
4 changes: 2 additions & 2 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6905,8 +6905,8 @@ main.main.showing-logs > #mainLogs{display:flex;}
/* OpenWebUI-style streaming word fade (opt-in via Settings → Preferences).
Opacity-only fade with JS-paced word/paragraph reveal. */
.stream-fade-active .stream-fade-word{display:inline;}
.stream-fade-word.is-new{animation:stream-fade-word-in var(--stream-fade-ms,240ms) cubic-bezier(.2,.7,.2,1) both;will-change:opacity;}
@keyframes stream-fade-word-in{0%{opacity:0;}45%{opacity:.45;}100%{opacity:1;}}
.stream-fade-word.is-new{animation:stream-fade-word-in var(--stream-fade-ms,620ms) cubic-bezier(.16,.84,.32,1) both;will-change:opacity;}
@keyframes stream-fade-word-in{0%{opacity:0;}35%{opacity:.18;}70%{opacity:.72;}100%{opacity:1;}}
@media (prefers-reduced-motion: reduce){.stream-fade-word.is-new{animation:none;will-change:auto;}}
[data-live-assistant="1"]:last-child .msg-body.stream-fade-active > :last-child::after,
[data-live-assistant="1"]:last-child .msg-body.stream-fade-active:not(:has(> *))::after{display:none;content:none;}
Expand Down
Loading
Loading