PageSourceSearch

https://adelln-omniroute.hf.space/_next/static/chunks/59499.557cd6c588d6e1bc.js

js adelln-omniroute.hf.space collected 2026-10-03 16:37:45 UTC 21,875 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[59499],{59499:(e,t,r)=>{r.r(t),r.d(t,{default:()=>f});var s=r(95155),a=r(12115),n=r(50910),l=r(5989);l.Ik({id:l.Yj().uuid(),name:l.Yj().min(1).max(100),endpoint:l.Yj().min(1),model:l.Yj().min(1),system:l.Yj().max(5e4).nullable(),params_json:l.Yj(),created_at:l.Yj().datetime()}),l.Ik({name:l.Yj().min(1).max(100),endpoint:l.Yj().min(1),model:l.Yj().min(1),system:l.Yj().max(5e4).nullable().optional(),params:l.g1(l.Yj(),l.bz()).default({})}).partial(),l.Ik({id:l.Yj().uuid(),name:l.Yj(),endpoint:l.Yj(),model:l.Yj(),system:l.Yj().nullable(),params:l.g1(l.Yj(),l.bz()),created_at:l.Yj().datetime()});let o=l.Ik({type:l.eu("function"),function:l.Ik({name:l.Yj().min(1).max(64),description:l.Yj().max(1024).optional(),parameters:l.g1(l.Yj(),l.bz())})}),i=l.Ik({type:l.eu("json_schema"),json_schema:l.Ik({name:l.Yj().min(1).max(64),schema:l.g1(l.Yj(),l.bz()),strict:l.zM().optional()})});l.Ik({ttftMs:l.ai().nonnegative().nullable(),totalMs:l.ai().nonnegative().nullable(),tokensOut:l.ai().int().nonnegative(),tokensIn:l.ai().int().nonnegative(),tps:l.ai().nonnegative().nullable(),costUsd:l.ai().nonnegative().nullable()});var c=r(15159);let d={name:"",description:"",parametersRaw:JSON.stringify({type:"object",properties:{},required:[]},null,2)};function x({toolsBuilder:e}){let{tools:t,errors:r,add:n,remove:l,update:o}=e,[i,c]=(0,a.useState)(d),[m,u]=(0,a.useState)(null),[p,b]=(0,a.useState)(null),[h,f]=(0,a.useState)(null);function g(){b(null),f(null)}return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[t.length>0&&(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wider",children:["Tools (",t.length,")"]}),t.map((e,a)=>{let n=p===a,i=r.get(a);return(0,s.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-bg-alt",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"function"}),(0,s.jsx)("code",{className:"text-xs font-mono text-text-main",children:e.function.name}),e.function.description&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[200px]",children:["— ",e.function.description]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[!n&&(0,s.jsx)("button",{onClick:()=>{let e;return e=t[a],void(b(a),f({name:e.function.name,description:e.function.description??"",parametersRaw:JSON.stringify(e.function.parameters,null,2)}))},className:"p-1 rounded text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":`Edit tool ${e.function.name}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"edit"})}),(0,s.jsx)("button",{onClick:()=>l(a),className:"p-1 rounded text-text-muted hover:text-destructive transition-colors","aria-label":`Remove tool ${e.function.name}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]})]}),n&&null!=h&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 p-3 bg-surface",children:[(0,s.jsx)("input",{type:"text",value:h.name,onChange:e=>f({...h,name:e.target.value}),placeholder:"Function name",className:"text-xs bg-bg-alt border border-border rounded px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-primary text-text-main"}),(0,s.jsx)("input",{type:"text",value:h.description,onChange:e=>f({...h,description:e.target.value}),placeholder:"Description (optional)",className:"text-xs bg-bg-alt border border-border rounded px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-primary text-text-main"}),(0,s.jsx)("textarea",{value:h.parametersRaw,onChange:e=>f({...h,parametersRaw:e.target.value}),rows:6,className:"text-xs font-mono bg-bg-alt border border-border rounded px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-primary text-text-main resize-y","aria-label":"JSON schema for parameters"}),i&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:i}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{onClick:()=>(function(e){let t;if(null!=h){try{t=JSON.parse(h.parametersRaw)}catch{return}o(e,{type:"function",function:{name:h.name.trim(),description:h.description.trim()||void 0,parameters:t}}).ok&&(b(null),f(null))}})(a),className:"text-xs px-2.5 py-1 rounded bg-primary text-white hover:bg-primary/90 transition-colors",children:"Save"}),(0,s.jsx)("button",{onClick:g,className:"text-xs px-2.5 py-1 rounded border border-border text-text-muted hover:text-text-main transition-colors",children:"Cancel"})]})]})]},a)})]}),(0,s.jsxs)("div",{className:"border border-border rounded-lg p-3 flex flex-col gap-2 bg-surface",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wider",children:"Add tool"}),(0,s.jsx)("input",{type:"text",value:i.name,onChange:e=>c({...i,name:e.target.value}),placeholder:"Function name *",className:"text-xs bg-bg-alt border border-border rounded px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-primary text-text-main"}),(0,s.jsx)("input",{type:"text",value:i.description,onChange:e=>c({...i,description:e.target.value}),placeholder:"Description (optional)",className:"text-xs bg-bg-alt border border-border rounded px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-primary text-text-main"}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("label",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Parameters (JSON schema)"}),(0,s.jsx)("textarea",{value:i.parametersRaw,onChange:e=>c({...i,parametersRaw:e.target.value}),rows:6,className:"text-xs font-mono bg-bg-alt border border-border rounded px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-primary text-text-main resize-y","aria-label":"JSON schema for parameters"})]}),m&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:m}),(0,s.jsx)("button",{onClick:function(){let e;try{e=JSON.parse(i.parametersRaw)}catch{u("Parameters must be valid JSON");return}let t=n({type:"function",function:{name:i.name.trim(),description:i.description.trim()||void 0,parameters:e}});t.ok?(c(d),u(null)):u(t.error)},className:"text-xs px-3 py-1.5 rounded bg-primary text-white hover:bg-primary/90 transition-colors self-start",children:"+ Add tool"})]})]})}let m={name:"my_schema",schema:{type:"object",properties:{result:{type:"string"}},required:["result"]},strict:!0};function u({structuredOutput:e}){let{enabled:t,schema:r,error:n,setEnabled:l,setSchema:o}=e,[i,c]=(0,a.useState)(JSON.stringify(r??m,null,2)),[d,x]=(0,a.useState)(r?.name??"my_schema"),[p,b]=(0,a.useState)(null);return(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-text-main",children:"JSON mode"}),(0,s.jsx)("span",{className:"text-[11px] text-text-muted",children:"Forces response_format: json_schema"})]}),(0,s.jsx)("button",{role:"switch","aria-checked":t,onClick:()=>l(!t),className:`relative inline-flex w-10 h-5 rounded-full transition-colors ${t?"bg-primary":"bg-text-muted/30"}`,"aria-label":t?"Disable JSON mode":"Enable JSON mode",children:(0,s.jsx)("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${t?"translate-x-5":"translate-x-0"}`})})]}),t&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 border border-border rounded-lg p-3 bg-surface",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("label",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Schema name"}),(0,s.jsx)("input",{type:"text",value:d,onChange:e=>
1x(e.target.value),placeholder:"my_schema",className:"text-xs bg-bg-alt border border-border rounded px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-primary text-text-main"})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("label",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"JSON schema"}),(0,s.jsx)("textarea",{value:i,onChange:e=>c(e.target.value),rows:8,className:"text-xs font-mono bg-bg-alt border border-border rounded px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-primary text-text-main resize-y","aria-label":"JSON schema editor"})]}),(p??n)&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:p??n}),null!=r&&!p&&!n&&(0,s.jsx)("p",{className:"text-xs text-green-600 dark:text-green-400",children:"✓ Schema validated"}),(0,s.jsx)("button",{onClick:function(){let e;try{e=JSON.parse(i)}catch{b("Invalid JSON");return}b(null),o({name:d.trim()||"my_schema",schema:e,strict:!0})},className:"text-xs px-3 py-1.5 rounded border border-border text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-colors self-start",children:"Validate schema"})]})]})}function p({currentStep:e}){let t=(0,n.c)("playground.build"),r=[{num:1,label:t("step1Label")},{num:2,label:t("step2Label")},{num:3,label:t("step3Label")}];return(0,s.jsx)("div",{className:"flex items-center gap-0 px-4 py-3 border-b border-border bg-bg-alt shrink-0",children:r.map((t,r)=>(0,s.jsxs)("div",{className:"flex items-center",children:[r>0&&(0,s.jsx)("div",{className:`h-px w-8 mx-2 transition-colors ${e>t.num?"bg-primary":"bg-border"}`}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:`flex items-center justify-center w-5 h-5 rounded-full text-[11px] font-semibold transition-colors ${e===t.num?"bg-primary text-white":e>t.num?"bg-primary/20 text-primary":"bg-border text-text-muted"}`,children:e>t.num?(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"check"}):t.num}),(0,s.jsx)("span",{className:`text-xs font-medium transition-colors ${e===t.num?"text-text-main":"text-text-muted"}`,children:t.label})]})]},t.num))})}function b({icon:e,title:t,description:r,selected:a,onClick:n}){return(0,s.jsxs)("button",{onClick:n,className:`flex flex-col gap-2 p-4 rounded-xl border-2 text-left transition-all hover:shadow-sm ${a?"border-primary bg-primary/5":"border-border bg-surface hover:border-primary/40"}`,children:[(0,s.jsx)("span",{className:"text-2xl",children:e}),(0,s.jsx)("span",{className:`text-sm font-semibold ${a?"text-primary":"text-text-main"}`,children:t}),(0,s.jsx)("span",{className:"text-xs text-text-muted leading-relaxed",children:r})]})}function h({toolsBuilder:e,structuredOutput:t,running:r,onRun:l,prompt:o,setPrompt:i,result:c}){let d=(0,n.c)("playground"),m=(0,n.c)("playground.build"),[f,g]=(0,a.useState)(1),[j,y]=(0,a.useState)("tools"),v="tools"===j||"both"===j,N="json"===j||"both"===j;function w(){2===f?g(1):3===f&&g(2)}return(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-hidden",children:[(0,s.jsx)(p,{currentStep:f}),1===f&&(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto p-6 flex flex-col gap-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-base font-semibold text-text-main mb-1",children:m("step1Title")}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:m("step1Subtitle")})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[(0,s.jsx)(b,{icon:"\uD83D\uDD27",title:m("modeToolsTitle"),description:m("modeToolsDesc"),selected:"tools"===j,onClick:()=>y("tools")}),(0,s.jsx)(b,{icon:"\uD83D\uDCCB",title:m("modeJsonTitle"),description:m("modeJsonDesc"),selected:"json"===j,onClick:()=>y("json")}),(0,s.jsx)(b,{icon:"\uD83D\uDD27",title:m("modeBothTitle"),description:m("modeBothDesc"),selected:"both"===j,onClick:()=>y("both")})]}),(0,s.jsx)("div",{className:"flex justify-end pt-2",children:(0,s.jsxs)("button",{onClick:function(){g(2)},className:"flex items-center gap-1.5 text-sm px-4 py-2 rounded-lg bg-primary text-white hover:bg-primary/90 transition-colors",children:[m("nextButton"),(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_forward"})]})})]}),2===f&&(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto p-6 flex flex-col gap-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-base font-semibold text-text-main mb-1",children:m("step2Title")}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:m("step2Subtitle")})]}),v&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-3",children:d("toolsLabel")}),(0,s.jsx)(x,{toolsBuilder:e})]}),N&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-3",children:d("structuredOutputLabel")}),(0,s.jsx)(u,{structuredOutput:t})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,s.jsxs)("button",{onClick:w,className:"flex items-center gap-1.5 text-sm px-4 py-2 rounded-lg border border-border text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_back"}),m("backButton")]}),(0,s.jsxs)("button",{onClick:function(){g(3)},className:"flex items-center gap-1.5 text-sm px-4 py-2 rounded-lg bg-primary text-white hover:bg-primary/90 transition-colors",children:[m("nextButton"),(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_forward"})]})]})]}),3===f&&(0,s.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-bg-alt shrink-0",children:[(0,s.jsxs)("button",{onClick:w,className:"flex items-center gap-1 text-xs px-2.5 py-1.5 rounded border border-border text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"arrow_back"}),m("backButton")]}),(0,s.jsx)("div",{className:"w-px h-4 bg-border mx-1"}),(0,s.jsxs)("button",{onClick:l,disabled:r||!o.trim(),className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded bg-primary text-white hover:bg-primary/90 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"play_arrow"}),r?d("running"):m("runButton")]}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-[11px] text-text-muted",children:[v&&e.tools.length>0&&(0,s.jsxs)("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 text-primary",children:[e.tools.length," tool",1!==e.tools.length?"s":""]}),N&&t.enabled&&(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 dark:text-green-400",children:"JSON mode"})]})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:c}),(0,s.jsx)("div",{className:"px-4 py-3 border-t border-border shrink-0",children:(0,s.jsx)("div",{className:"flex items-end gap-2",children:(0,s.jsx)("textarea",{value:o,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),l())},placeholder:m("promptPlaceholder"),rows:2,className:"flex-1 text-sm bg-surface border border-border rounded-lg px-3 py-2 focus:outline-none focus:ring-1 focus:ring-primary text-text-main resize-none"})})})]})]})}function f({configState:e}){let t=(0,n.c)("playground"),r=function(){let[e,t]=(0,a.useState)([]),[r,s]=(0,a.useState)(new Map),n=(0,a.useCallback)(e=>{let r=o.safeParse(e);return r.success?(t(e=>[...e,r.data]),{ok:!0}):{ok:!1,error:r.error.issues.map(e=>e.message).join("; ")}},[]),l=(0,a.useCallback)(e=>{t(t=>{if(e<0||e>=t.length)return t;let r=[...t];return r.splice(e,1),r}),s(t=>{let r=new Map(t);r.delete(e);let s=new Map;return r.forEach((t,r)=>{s.set(r>e?r-1:r,t)}),s})},[]);return{tools:e,errors:r,add:n,remove:l,update:(0,a.useCallback)((e,r)=>{let a=o.safeParse(r);if(!a.success){let t=a.error.issues.map(e=>e.message).join("; ");return s(r=>{let s=new Map(r);return s.set(e,t),s}),{ok:!1,error:t}}return t(t=>{if(e<0||e>=t.length)return t;let r=[...t];return r[e]=a.data,r}),s(t=>{let r=new Map(t);return r.delete(e),r}),{ok:!0}},[]),clear:(0,a.useCallback)(()=>{t([]),s(new Map)},[])}}(),l=function(){let[e,t]=(0,a.useState)(!1),[r,s]=(0,a.useState)(null),[n,l]=(0,a.useState)(null),o=(0,a.useCallback)(e=>{t(e)},[]),c=(0,a.useCallback)(e=>{let t=i.safeParse({type:"json_schema",json_schema:e});t.success?(s(e),l(null)):l(t.error.issues.map(e=>e.message).join("; "))},[]),d=(0,a.useCallback)(e=>{if(null==r)return{valid:!1,error:"No schema set"};let t=e;if("string"==typeof e)try{t=JSON.parse(e)}
1catch{return{valid:!1,error:"Response is not valid JSON"}}if(null==t||"object"!=typeof t||Array.isArray(t))return{valid:!1,error:"Response is not a JSON object"};let s=t,a=r.schema,n=a.properties;if(null!=n&&"object"==typeof n&&!Array.isArray(n)){let e=a.required;if(Array.isArray(e)){for(let t of e)if("string"==typeof t&&!(t in s))return{valid:!1,error:`Response is missing required field: "${t}"`}}}return{valid:!0}},[r]);return{enabled:e,schema:r,error:n,setEnabled:o,setSchema:c,validateResponse:d}}(),[d,x]=(0,a.useState)(""),[m,u]=(0,a.useState)([]),[p,b]=(0,a.useState)(!1),[g,j]=(0,a.useState)([]),[y,v]=(0,a.useState)([]),[N,w]=(0,a.useState)(null),k=(0,a.useRef)(null);async function S(t){k.current?.abort();let s=new AbortController;k.current=s,b(!0),j([]),v([]),w(null);try{let a=await fetch(`${e.baseUrl}/v1/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(function(t){let s={model:e.model,stream:!1,messages:[...e.systemPrompt?[{role:"system",content:e.systemPrompt}]:[],...t.map(e=>"tool"===e.role?{role:"tool",content:e.content,tool_call_id:e.toolCallId??""}:{role:e.role,content:e.content})]};r.tools.length>0&&(s.tools=r.tools),l.enabled&&null!=l.schema&&(s.response_format={type:"json_schema",json_schema:l.schema});let{params:a}=e;return null!=a.temperature&&(s.temperature=a.temperature),null!=a.max_tokens&&(s.max_tokens=a.max_tokens),null!=a.top_p&&(s.top_p=a.top_p),null!=a.presence_penalty&&(s.presence_penalty=a.presence_penalty),null!=a.frequency_penalty&&(s.frequency_penalty=a.frequency_penalty),null!=a.seed&&(s.seed=a.seed),null!=a.stop&&(s.stop=a.stop),s}(t)),signal:s.signal});if(!a.ok){let e=(await a.text().catch(()=>"Unknown error")).slice(0,300);u(t=>[...t,{role:"assistant",content:`Error: ${e}`}]);return}let n=await a.json(),o=n.choices?.[0],i=o?.message;if(null==i)return void u(e=>[...e,{role:"assistant",content:"(empty response)"}]);if(i.tool_calls&&i.tool_calls.length>0)j(i.tool_calls),u(e=>[...e,{role:"assistant",content:i.content??"(tool call)"}]),v(i.tool_calls.map(e=>({toolCallId:e.id,functionName:e.function.name,draft:""})));else{let e=i.content??"";if(u(t=>[...t,{role:"assistant",content:e}]),l.enabled&&null!=l.schema){let t=l.validateResponse(e);w(t)}}}catch(t){if(s.signal.aborted)return;let e=t instanceof Error?t.message:String(t);u(t=>[...t,{role:"assistant",content:`Error: ${e}`}])}finally{b(!1)}}async function C(){if(!d.trim()&&0===m.length)return;let e=[...m,...d.trim()?[{role:"user",content:d}]:[]];d.trim()&&(u(e),x("")),await S(e)}async function _(e){let t=y.find(t=>t.toolCallId===e);if(null==t)return;let r=[...m,{role:"tool",content:t.draft,toolCallId:e}];u(r),v([]),j([]),await S(r)}let O=(0,s.jsxs)("div",{className:"space-y-3",children:[m.map((e,t)=>(0,s.jsx)("div",{className:`flex ${"user"===e.role?"justify-end":"justify-start"}`,children:(0,s.jsx)("div",{className:`max-w-[80%] rounded-xl px-3 py-2 text-sm ${"user"===e.role?"bg-primary text-white":"tool"===e.role?"bg-yellow-500/10 border border-yellow-500/30 text-text-main":"bg-bg-alt border border-border text-text-main"}`,children:"user"===e.role?(0,s.jsx)("span",{className:"whitespace-pre-wrap",children:e.content}):(0,s.jsx)(c.default,{content:e.content})})},t)),g.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:g.map(e=>{let r=y.find(t=>t.toolCallId===e.id);return(0,s.jsxs)("div",{className:"border border-amber-500/40 rounded-lg p-3 bg-amber-500/5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] text-amber-500",children:"function"}),(0,s.jsx)("code",{className:"text-xs font-mono text-text-main",children:e.function.name})]}),(0,s.jsx)("pre",{className:"text-[11px] font-mono text-text-muted bg-bg-alt rounded p-2 overflow-x-auto mb-2 whitespace-pre-wrap break-all",children:e.function.arguments}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("label",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Tool result"}),(0,s.jsx)("textarea",{value:r?.draft??"",onChange:t=>v(r=>r.map(r=>r.toolCallId===e.id?{...r,draft:t.target.value}:r)),rows:3,placeholder:t("enterToolResult"),className:"text-xs font-mono bg-bg-alt border border-border rounded px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-primary text-text-main resize-y"}),(0,s.jsx)("button",{onClick:()=>void _(e.id),className:"text-xs px-2.5 py-1 rounded bg-primary text-white hover:bg-primary/90 transition-colors self-start",children:"Send tool result"})]})]},e.id)})}),null!=N&&(0,s.jsx)("div",{className:`text-xs rounded-lg px-3 py-2 border ${N.valid?"border-green-500/40 bg-green-500/5 text-green-600 dark:text-green-400":"border-destructive/40 bg-destructive/5 text-destructive"}
1`,children:N.valid?"✅ Valid JSON schema response":`❌ ${N.error}`})]});return(0,s.jsx)(h,{toolsBuilder:r,structuredOutput:l,running:p,onRun:()=>void C(),prompt:d,setPrompt:x,result:O})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.