Skip to content

Commit

Permalink
Merge pull request #24 from AmAzing129/main
Browse files Browse the repository at this point in the history
feat: update the api of chrome built-in ai
  • Loading branch information
jeasonstudio authored Aug 22, 2024
2 parents 3b54223 + 4752a95 commit 31f9054
Show file tree
Hide file tree
Showing 10 changed files with 6,430 additions and 5,277 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-plants-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chrome-ai": minor
---

feat: update the api of chrome built-in ai
6 changes: 3 additions & 3 deletions app/components/outputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export const Outputs = React.forwardRef<
const version = getChromeVersion();
// setIsBrowserSupport(version >= 127);

setIsEnabledFlags(!!('ai' in globalThis));
setIsEnabledFlags(!!globalThis.ai?.assistant);

globalThis.ai?.canCreateTextSession().then((status) => {
setIsEnabledFlags(status === 'readily');
globalThis.ai?.assistant.capabilities().then((cap) => {
setIsEnabledFlags(cap.available === 'readily');
});
}, []);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"access": "public"
},
"dependencies": {
"@ai-sdk/provider": "^0.0.16",
"@ai-sdk/provider": "^0.0.21",
"@mediapipe/tasks-genai": "0.10.14",
"@mediapipe/tasks-text": "0.10.14",
"debug": "^4.3.6"
Expand Down
Loading

0 comments on commit 31f9054

Please sign in to comment.