Skip to content

Commit 71e084d

Browse files
committed
Github Action 部署CF
1 parent 706bb42 commit 71e084d

File tree

7 files changed

+61
-19
lines changed

7 files changed

+61
-19
lines changed

.github/workflow/cf-deploy.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Deploy Worker
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
repository_dispatch:
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
name: Deploy
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Build & Deploy Worker
15+
uses: cloudflare/wrangler-action@v3
16+
with:
17+
apiToken: ${{ secrets.CF_API_TOKEN }}
18+
accountId: ${{ secrets.CF_ACCOUNT_ID }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,4 @@ dist
171171

172172
.dev.vars
173173
.wrangler/
174+
deno.lock

README.MD

+13
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@
2323

2424
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/tech-shrimp/gemini-playground)
2525

26+
## 本地调试
27+
28+
Windows 安装Deno:
29+
> irm https://deno.land/install.ps1 | iex
30+
31+
Mac/Linux 安装Deno:
32+
> curl -fsSL https://deno.land/install.sh | sh
33+
34+
启动项目:
35+
36+
>cd 项目目录 <br>
37+
>deno run --allow-net --allow-read src/deno_index.ts
38+
2639

2740
## 使用方法
2841

src/static/css/style.css

+5-5
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ body {
481481
width: 300px;
482482
}
483483

484-
#voice-select {
485-
padding: 8px;
484+
#voice-select #response-type-select{
485+
padding: 4px;
486486
border: 1px solid #ccc;
487487
border-radius: 4px;
488488
}
@@ -520,7 +520,7 @@ body {
520520
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
521521
}
522522

523-
#voice-select, #sample-rate-input, #system-instruction {
523+
#system-instruction {
524524
padding: var(--spacing-md);
525525
border: 1px solid var(--border-color);
526526
border-radius: var(--border-radius);
@@ -595,13 +595,13 @@ body {
595595
}
596596
}
597597

598-
.fps-container {
598+
.setting-container {
599599
display: flex;
600600
align-items: center;
601601
gap: var(--spacing-md);
602602
}
603603

604-
.fps-label {
604+
.setting-label {
605605
font-size: 12px;
606606
font-weight: bold;
607607
}

src/static/index.html

+21-11
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,29 @@
2121
</div>
2222
<div id="config-container" class="hidden-mobile">
2323
<div class="config-wrapper">
24-
<select id="voice-select">
25-
<option value="Puck">Puck (Male)</option>
26-
<option value="Charon">Charon (Male)</option>
27-
<option value="Fenrir">Fenrir (Male)</option>
28-
<option value="Kore">Kore (Female)</option>
29-
<option value="Aoede" selected>Aoede (Female)</option>
30-
</select>
31-
<div class="fps-container">
32-
<span class="fps-label">FPS: </span>
33-
<input type="number" id="fps-input" placeholder="Video FPS" value="2" min="1" max="30" step="1"/>
24+
<div class="setting-container">
25+
<span class="setting-label">Sound: </span>
26+
<select id="voice-select">
27+
<option value="Puck">Puck (Male)</option>
28+
<option value="Charon">Charon (Male)</option>
29+
<option value="Fenrir">Fenrir (Male)</option>
30+
<option value="Kore">Kore (Female)</option>
31+
<option value="Aoede" selected>Aoede (Female)</option>
32+
</select>
33+
</div>
34+
<div class="setting-container">
35+
<span class="setting-label">Response Type: </span>
36+
<select id="response-type-select">
37+
<option value="text">Text</option>
38+
<option value="audio" selected>Audio</option>
39+
</select>
40+
</div>
41+
<div class="setting-container">
42+
<span class="setting-label">Video FPS: </span>
43+
<input type="number" id="fps-input" placeholder="Video FPS" value="1" min="1" max="30" step="1"/>
3444
<span class="fps-help">Higher FPS need more network bandwidth</span>
3545
</div>
36-
<textarea id="system-instruction" placeholder="Enter custom system instructions..." rows="3"></textarea>
46+
<textarea id="system-instruction" placeholder="Enter custom system instructions..." rows="6"></textarea>
3747
<button id="apply-config">Confirm</button>
3848
</div>
3949
</div>

src/static/js/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const configContainer = document.getElementById('config-container');
3535
const systemInstructionInput = document.getElementById('system-instruction');
3636
systemInstructionInput.value = CONFIG.SYSTEM_INSTRUCTION.TEXT;
3737
const applyConfigButton = document.getElementById('apply-config');
38-
38+
const responseTypeSelect = document.getElementById('response-type-select');
3939

4040
// Load saved values from localStorage
4141
const savedApiKey = localStorage.getItem('gemini_api_key');
@@ -256,7 +256,7 @@ async function connectToWebsocket() {
256256
const config = {
257257
model: CONFIG.API.MODEL_NAME,
258258
generationConfig: {
259-
responseModalities: "audio",
259+
responseModalities: responseTypeSelect.value,
260260
speechConfig: {
261261
voiceConfig: {
262262
prebuiltVoiceConfig: {

src/static/js/video/screen-recorder.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class ScreenRecorder {
2424
this.captureInterval = null;
2525
this.previewElement = null;
2626
this.options = {
27-
fps: 5, // Lower FPS for screen sharing
27+
fps: 2, // Lower FPS for screen sharing
2828
quality: 0.8,
2929
width: 1280,
3030
height: 720,

0 commit comments

Comments
 (0)