Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for images and audio #1275

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified functional-samples/ai.gemini-in-the-cloud/images/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified functional-samples/ai.gemini-in-the-cloud/images/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified functional-samples/ai.gemini-in-the-cloud/images/icon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified functional-samples/ai.gemini-in-the-cloud/images/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion functional-samples/ai.gemini-in-the-cloud/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"background": {
"service_worker": "background.js"
},
"permissions": ["sidePanel"],
"permissions": ["activeTab", "scripting", "sidePanel"],
"host_permissions": ["<all_urls>"],
"side_panel": {
"default_path": "sidepanel/index.html"
},
Expand Down
144 changes: 72 additions & 72 deletions functional-samples/ai.gemini-in-the-cloud/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions functional-samples/ai.gemini-in-the-cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"private": true,
"devDependencies": {
"@google/generative-ai": "0.15.0",
"rollup": "4.19.0"
"@google/generative-ai": "0.17.1",
"rollup": "4.21.2"
}
}
4 changes: 4 additions & 0 deletions functional-samples/ai.gemini-in-the-cloud/sidepanel/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ button.primary {
color: white;
}

button > img {
vertical-align: middle;
}

button.secondary {
background: #ccc;
color: black;
Expand Down
62 changes: 60 additions & 2 deletions functional-samples/ai.gemini-in-the-cloud/sidepanel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<link rel="stylesheet" type="text/css" href="index.css" />
</head>
<body>
<h1>Google Gemini</h1>
<textarea
id="input-prompt"
placeholder='Type something, e.g. "Write a haiku about Chrome Extensions"'
cols="30"
rows="5"
></textarea>
<ul id="files-list"></ul>
<div>
<input
type="range"
Expand All @@ -25,7 +25,65 @@ <h1>Google Gemini</h1>
>Temperature: <span id="label-temperature">1</span></label
>
</div>
<button id="button-prompt" class="primary" disabled>Run</button>
<div>
<input
type="file"
id="image-file"
accept="image/*"
style="display: none"
/>
<button id="button-add-image" class="primary">
<img
src="/images/screenshot-monitor-24.svg"
width="24"
height="24"
alt="take screenshot"
/>
Add image
</button>
<button id="button-capture-image" class="primary">
<img
src="/images/screenshot-monitor-24.svg"
width="24"
height="24"
alt="capture screenshot"
/>
Take Screenshot
</button>
<input
type="file"
id="audio-file"
accept="audio/wav, audio/mp3"
style="display: none"
/>
<button id="button-record-audio" class="primary" disabled>
<img
src="/images/record-audio-24.svg"
width="24"
height="24"
alt="Upload an audio file"
/>
Record audio
</button>
<button id="button-capture-audio" class="primary">
<img
src="/images/record-audio-24.svg"
width="24"
height="24"
alt="Capture tab audio"
/>
Add audio file
</button>
<button id="button-capture-audio-stop" class="primary" hidden>
Stop recording
</button>
</div>
<div>
<button id="button-prompt" class="primary" disabled type="submit">
Run
</button>
<button id="button-reset" class="primary" type="reset">Reset</button>
</div>
<div id="response" class="text" hidden></div>
<div id="loading" class="text" hidden><span class="blink">...</span></div>
<div id="error" class="text" hidden></div>
Expand Down
Loading