-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: refactor Supabase AI API (#273)
* fix: refactor sb_ai * fix: make the API async * fix: clippy
- Loading branch information
Showing
6 changed files
with
124 additions
and
75 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
const core = globalThis.Deno.core; | ||
|
||
class SupabaseAI { | ||
runModel(name, prompt) { | ||
const result = core.ops.op_sb_ai_run_model(name, prompt); | ||
class Session { | ||
model; | ||
|
||
constructor(model) { | ||
this.model = model; | ||
core.ops.op_sb_ai_init_model(model); | ||
} | ||
|
||
async run(prompt) { | ||
const result = await core.ops.op_sb_ai_run_model(this.model, prompt); | ||
return result; | ||
} | ||
} | ||
|
||
export { SupabaseAI }; | ||
export default { Session }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters