Skip to content

kaichen/chrome-builtin-ai-ext

Repository files navigation

Explore Chrome Built-in AI

ref https://developer.chrome.com/docs/ai/built-in

Now only have simple "tell me a joke" and chatbot function.

chatbot-screen-shot first-function-screen-shot

Enable AI in Chrome

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.

Dev Setup

First, run the development server:

pnpm dev # run dev environment

For further guidance, visit plasmo Documentation

Current API Schema

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
}

Todos

  • one click to generate text
  • chatbot in sidepanel
  • translate page
  • summary page content
  • operate page with prompt
  • query page content
  • more...