openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 1.66 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Uu as t}from"./_4____________________________.js";import{$o as n,Da as r,Ea as i,Jn as a,Li as o,Qo as s,Ri as c,Xn as l,Yn as u,cs as d,ct as f,es as p,lt as m,qn as h,ss as g}from"./control-ui-boot-chat-styles-DMRbEm40.js";import{At as _,c as v,d as y,jt as b}from"./markdown-runtime-CtlJb8xA.js";function x(e,i,o=`cold-fragment`){let s=t(e)?.role;if(s!==`user`&&s!==`assistant`||r(e,s))return!1;let u=n(e);if(u.normalizedMessage.content.some(e=>e.type!==`text`&&e.type!==`thinking`&&e.type!==`image`&&e.type!==`canvas`&&!d(e.type)))return!1;let f=s===`assistant`&&u.displayMarkdown&&u.normalizedMessage.content.some(e=>e.type===`image`)?p(e,{...u.normalizedMessage,content:[{type:`text`,text:l(c(e,u.normalizedMessage.content).orderedContent).markdown}]}):u.displayMarkdown;return!!f&&!b(f)&&y(f,a(s,u,u.displayMarkdown,{...i,isStreaming:!1}),o)}function S(){let e=new WeakMap;return(t,n,r)=>{let i=e.get(t);(!i||i.mode!==r)&&(i={mode:r,next:0},e.set(t,i));let a=n instanceof f?n.native:void 0,o=0,s=(e,t)=>{let n=r===`fragment`&&o>=8?`cold-fragment`:r;return o++<i.next?!1:(i.next=o,x(e,t,n))};if(a?.kind===`group`&&!a.group.isStreaming){for(let e of a.group.messages)if(s(e.message,a.options))return!0}else if(a?.kind===`frame`&&a.frame.outcome.kind===`completed`)for(let e of a.frame.parts){if(e.kind!==`group`||e.isStreaming)continue;let t=a.options.renderGroupOptions(e);for(let n of e.messages)if(s(n.message,t))return!0}return e.delete(t),!1}}function C(){return(C=e((()=>{g(),_(),v(),s(),i(),h(),u(),o(),m()})))()}C();export{S as createTranscriptRowPrewarmer,x as prewarmGroupedMessage};