(acc: RetoolAccount, agentId: string)
| 99 | return data.agents as any[]; |
| 100 | } |
| 101 | async function retoolGetThreadId(acc: RetoolAccount, agentId: string) { |
| 102 | const url = `https://${acc.domain_name}/api/agents/${agentId}/threads`; |
| 103 | const resp = await fetch(url, { |
| 104 | method: "POST", |
| 105 | headers: { |
| 106 | "x-xsrf-token": acc.x_xsrf_token, |
| 107 | "Cookie": `accessToken=${acc.accessToken}`, |
| 108 | "Content-Type": "application/json", |
| 109 | }, |
| 110 | body: JSON.stringify({ name: "", timezone: "" }), |
| 111 | }); |
| 112 | if (!resp.ok) throw new Error(`create thread failed ${resp.status}`); |
| 113 | const data = await resp.json(); |
| 114 | return data.id as string; |
| 115 | } |
| 116 | async function retoolSendMessage( |
| 117 | acc: RetoolAccount, |
| 118 | agentId: string, |
no test coverage detected