ref https://developer.chrome.com/docs/ai/built-in
Now only have simple "tell me a joke" and chatbot function.
Make a demo using chrome built-in Gemini Nano. Need chrome version > v127.x, now in Dev or Canary channel, may release on stable chanel at Jun 17, 2024, if release schedule on time.
After install AI built-in chrome version, NEED turn on these flags:
- chrome://flags/#prompt-api-for-gemini-nano
- chrome://flags/#optimization-guide-on-device-model
Then click Optimization Guide On Device Model
in chrome://components/ to download model.
Finally, you could play AI API in dev console, or install this extension built by this repo.
First, run the development server:
pnpm dev # run dev environment
For further guidance, visit plasmo Documentation
Keep exploring...
window.ai
- canCreateGenericSession(): boolean
- canCreateTextSession(): boolean
- createGenericSession(): AITextSession
- createTextSession(): AITextSession
- defaultGenericSessionOptions: {}
- defaultTextSessionOptions: {}
AITextSession {
execute(text: string): ...
executeStreaming(text: string): ...
prompt(text: string): string
promptStreaming(text: string): ...
destroy(): void
}
- one click to generate text
- chatbot in sidepanel
- translate page
- summary page content
- operate page with prompt
- query page content
- more...