File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/content/docs/agents/api-reference Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ export class MyAgent extends Agent<Env> {
189189
190190 // 'users' is just an example here: you can create arbitrary tables and define your own schemas
191191 // within each Agent's database using SQL (SQLite syntax).
192- let user = await this .sql ` SELECT * FROM users WHERE id = ${userId } `
192+ let [ user] = this .sql ` SELECT * FROM users WHERE id = ${userId } `
193193 return Response .json (user )
194194 }
195195}
@@ -211,7 +211,7 @@ export class MyAgent extends Agent<Env> {
211211 let userId = new URL (request .url ).searchParams .get (' userId' );
212212 // Supply the type parameter to the query when calling this.sql
213213 // This assumes the results returns one or more User rows with "id", "name", and "email" columns
214- const user = await this .sql <User >` SELECT * FROM users WHERE id = ${userId } ` ;
214+ const [ user] = this .sql <User >` SELECT * FROM users WHERE id = ${userId } ` ;
215215 return Response .json (user )
216216 }
217217}
@@ -242,7 +242,7 @@ export class ReasoningAgent extends Agent<Env> {
242242 async callReasoningModel(prompt : Prompt ) {
243243 let result = this .sql <History >` SELECT * FROM history WHERE user = ${prompt .userId } ORDER BY timestamp DESC LIMIT 1000 ` ;
244244 let context = [];
245- for await (const row of result ) {
245+ for (const row of result ) {
246246 context .push (row .entry );
247247 }
248248
You can’t perform that action at this time.
0 commit comments