UNPKG

@tencent-ai/codebuddy-code

Version:

Use CodeBuddy, Tencent's AI assistant, right from your terminal. CodeBuddy can understand your codebase, edit files, run terminal commands, and handle entire workflows for you.

1 lines 2.3 kB
"use strict";exports.id=566,exports.ids=[566],exports.modules={19250:(e,t,a)=>{a.a(e,(async(e,n)=>{try{a.d(t,{NH:()=>i.NH,pF:()=>c.pF});var s=a(77146),l=a(89536),r=a(70790),c=a(62875),i=a(82388),m=e([s,l,r,c,i]);[s,l,r,c,i]=m.then?(await m)():m,n()}catch(e){n(e)}}))},90566:(e,t,a)=>{a.a(e,(async(e,n)=>{try{a.r(t),a.d(t,{ChatView:()=>ChatView});var s=a(14083),l=a(96540),r=a(66814),c=a(67886),i=a(26730),m=a(53829),u=a(59505),o=a(19250),d=a(66530),g=a(92709),p=e([s,i,m,u,o,d,g]);[s,i,m,u,o,d,g]=p.then?(await p)():p;const f=2,h={[c.L3.BASH]:5},E=2,y=l.memo((({availableHeight:e})=>{const t=(0,r.i7)(m.Gb,(e=>e.staticKey)),{messageGroups:a,agentState:n}=(0,r.i7)(m.rZ,(e=>({messageGroups:e.messageGroups,agentState:e.agentState}))),c=(0,l.useMemo)((()=>Boolean(n&&"agent_end"!==n)),[n]),i=(0,g.A)(a),[u,o]=(0,l.useState)([]),[p,E]=(0,l.useState)([]),y=(0,l.useMemo)((()=>{const t=p.reduce(((e,t)=>{if("function_call"===t.type)return e+f;if("function_call_result"===t.type){return e+(t.name in h?h[t.name]:2)}return e}),0);return Math.min(t,e)}),[p]);(0,l.useEffect)((()=>{const e=[],t=[];for(const n of a){if(c&&"function_call_group"===n.type){if(!n.messages.find((e=>"function_call"===e.type&&(!!u.find((t=>t.id===e.id))||!(!e.status||!["completed","incomplete"].includes(e.status)))))){t.push(...n.messages);continue}}e.push(...n.messages)}o(e),E(t)}),[a]);const x=l.useMemo((()=>[l.createElement(d.f,{key:"chat-header-box"}),...u.map((e=>l.createElement(g.h,{key:`message-item-${e.type}-${e.id}`,msg:e,expanded:i(e.id)})))]),[u,i]);return l.createElement(l.Fragment,null,l.createElement(s.jC,{key:t,items:x},(e=>e)),p.length?l.createElement(s.az,{flexDirection:"column",height:y,overflow:"hidden"},...p.map((e=>l.createElement(g.h,{key:`message-item-${e.id}-pending`,msg:e,expanded:i(e.id)})))):l.createElement(l.Fragment,null))})),ChatContainer=()=>{const e=(0,r.i7)(m.Gb,(e=>e.terminalHeight)),[t,a]=(0,l.useState)(0);return(0,l.useEffect)((()=>{a(e-E)}),[e]),(0,i.o)(),(0,u.f)(),l.createElement(l.Fragment,null,l.createElement(y,{availableHeight:t}),l.createElement(s.az,{flexDirection:"column"},l.createElement(o.NH,null,l.createElement(o.pF,{availableHeight:t}))))},ChatView=()=>l.createElement(m.N7,null,l.createElement(m.Y5,null,l.createElement(ChatContainer,null)));n()}catch(e){n(e)}}))}};