openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
4 lines (3 loc) • 1.51 kB
JavaScript
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{Gu as n,Ou as r,li as i,oi as a,xu as o}from"./_4____________________________.js";import{gd as s,vd as c,wC as l,xC as u}from"./_2_____________________________.js";import{Ar as d}from"./deferred-ui-support-DZEPWjAk.js";import{$t as f,Qt as p,Uo as m,is as h,ns as g,qo as _,ts as v}from"./control-ui-boot-chat-styles-DMRbEm40.js";import{n as y,t as b}from"./complete-history-Dj6yyv5c.js";function x(e){let t=n(e)?.role,r=typeof t==`string`?h(t):void 0;return(r===`user`||r===`assistant`)&&!g(e)?r:void 0}function S(e){return x(e)!==void 0}function C(e,t){let n=w(e,t);return n?(d(`chat-${t}-${Date.now()}.md`,n,`text/markdown`),`downloaded`):`empty`}function w(e,t){let a=_(e),o=[],c=new Set;for(let[e,u]of a.entries()){let a=x(u);if(!a)continue;let d=s(u)??``,p=f({kind:`message`,key:`export:`+e,message:u},c).map(e=>s(e.message)??``).filter(e=>e!==d.trim()),m=p.length?[d,...p].filter(Boolean).join(`
`):d;if(!m.trim())continue;let h=a===`user`?l(u)??i(`chat.messages.unattributedSender`):l(u)??t,g=r(n(u)?.timestamp)??``;o.push(`## ${h}${g?` (${g})`:``}`,``,m,``)}return o.length>0?[`# Chat with ${t}`,``,...o].join(`
`):null}function T(){return(T=e((()=>{o(),a(),c(),v(),m(),p(),u()})))()}var E=t({exportCapturedChat:()=>D});async function D(e,t){let n=await y(e,S);if(!e.isCurrent())throw Error(i(`sessionsView.copyTranscriptChanged`));return C(n,t)}function O(){return(O=e((()=>{a(),b(),T()})))()}export{S as a,T as i,O as n,w as r,E as t};