feat(gummy): 支持通过设置添加 API KEY

- 更新 main-gummy.py 以支持 API KEY 参数
- 修改 electron-builder.yml 以调整 Gummy 可执行文件路径
This commit is contained in:
himeditator mac
2025-07-08 21:05:43 +08:00
parent 7e953db6bd
commit cbbaaa95a3
17 changed files with 99 additions and 53 deletions

View File

@@ -43,36 +43,51 @@
<a-switch v-model:checked="currentTranslation" />
<span style="display:inline-block;width:20px;"></span>
<div style="display: inline-block;">
<span class="switch-label">{{ $t('engine.customEngine') }}</span>
<a-switch v-model:checked="currentCustomized" />
<span class="switch-label">{{ $t('engine.showMore') }}</span>
<a-switch v-model:checked="showMore" />
</div>
</div>
<div v-show="currentCustomized">
<a-card size="small" :title="$t('engine.custom.title')">
<template #extra>
<a-popover>
<template #content>
<p class="customize-note">{{ $t('engine.custom.note') }}</p>
</template>
<a><InfoCircleOutlined />{{ $t('engine.custom.attention') }}</a>
</a-popover>
</template>
<div class="input-item">
<span class="input-label">{{ $t('engine.custom.app') }}</span>
<a-input
class="input-area"
v-model:value="currentCustomizedApp"
></a-input>
</div>
<div class="input-item">
<span class="input-label">{{ $t('engine.custom.command') }}</span>
<a-input
class="input-area"
v-model:value="currentCustomizedCommand"
></a-input>
</div>
</a-card>
</div>
<a-card size="small" :title="$t('engine.custom.title')" v-show="showMore">
<div class="input-item">
<span class="input-label">{{ $t('engine.apikey') }}</span>
<a-input
class="input-area"
type="password"
v-model:value="currentAPI_KEY"
/>
</div>
<div class="input-item">
<span style="margin-right:5px;">{{ $t('engine.customEngine') }}</span>
<a-switch v-model:checked="currentCustomized" />
</div>
<div v-show="currentCustomized">
<a-card size="small" :title="$t('engine.custom.title')">
<template #extra>
<a-popover>
<template #content>
<p class="customize-note">{{ $t('engine.custom.note') }}</p>
</template>
<a><InfoCircleOutlined />{{ $t('engine.custom.attention') }}</a>
</a-popover>
</template>
<div class="input-item">
<span class="input-label">{{ $t('engine.custom.app') }}</span>
<a-input
class="input-area"
v-model:value="currentCustomizedApp"
></a-input>
</div>
<div class="input-item">
<span class="input-label">{{ $t('engine.custom.command') }}</span>
<a-input
class="input-area"
v-model:value="currentCustomizedCommand"
></a-input>
</div>
</a-card>
</div>
</a-card>
</a-card>
<div style="height: 20px;"></div>
</template>
@@ -86,6 +101,7 @@ import { InfoCircleOutlined } from '@ant-design/icons-vue';
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const showMore = ref(false)
const engineControl = useEngineControlStore()
const { platform, captionEngine, audioType, changeSignal } = storeToRefs(engineControl)
@@ -95,7 +111,7 @@ const currentTargetLang = ref('zh')
const currentEngine = ref<'gummy'>('gummy')
const currentAudio = ref<0 | 1>(0)
const currentTranslation = ref<boolean>(false)
const currentAPI_KEY = ref<string>('')
const currentCustomized = ref<boolean>(false)
const currentCustomizedApp = ref('')
const currentCustomizedCommand = ref('')
@@ -115,7 +131,7 @@ function applyChange(){
engineControl.engine = currentEngine.value
engineControl.audio = currentAudio.value
engineControl.translation = currentTranslation.value
engineControl.API_KEY = currentAPI_KEY.value
engineControl.customized = currentCustomized.value
engineControl.customizedApp = currentCustomizedApp.value
engineControl.customizedCommand = currentCustomizedCommand.value
@@ -134,7 +150,7 @@ function cancelChange(){
currentEngine.value = engineControl.engine
currentAudio.value = engineControl.audio
currentTranslation.value = engineControl.translation
currentAPI_KEY.value = engineControl.API_KEY
currentCustomized.value = engineControl.customized
currentCustomizedApp.value = engineControl.customizedApp
currentCustomizedCommand.value = engineControl.customizedCommand

View File

@@ -46,6 +46,8 @@ export default {
"systemOutput": "System Audio Output (Speaker)",
"systemInput": "System Audio Input (Microphone)",
"enableTranslation": "Translation",
"showMore": "More Settings",
"apikey": "API KEY",
"customEngine": "Custom Engine",
custom: {
"title": "Custom Caption Engine",

View File

@@ -46,6 +46,8 @@ export default {
"systemOutput": "システムオーディオ出力(スピーカー)",
"systemInput": "システムオーディオ入力(マイク)",
"enableTranslation": "翻訳",
"showMore": "詳細設定",
"apikey": "API KEY",
"customEngine": "カスタムエンジン",
custom: {
"title": "カスタムキャプションエンジン",

View File

@@ -46,6 +46,8 @@ export default {
"systemOutput": "系统音频输出(扬声器)",
"systemInput": "系统音频输入(麦克风)",
"enableTranslation": "启用翻译",
"showMore": "更多设置",
"apikey": "API KEY",
"customEngine": "自定义引擎",
custom: {
"title": "自定义字幕引擎",

View File

@@ -16,7 +16,7 @@ export const useEngineControlStore = defineStore('engineControl', () => {
const captionEngine = ref(engines[useGeneralSettingStore().uiLanguage])
const audioType = ref(audioTypes[useGeneralSettingStore().uiLanguage])
const API_KEY = ref<string>('')
const engineEnabled = ref(false)
const sourceLang = ref<string>('en')
const targetLang = ref<string>('zh')
@@ -37,6 +37,7 @@ export const useEngineControlStore = defineStore('engineControl', () => {
engine: engine.value,
audio: audio.value,
translation: translation.value,
API_KEY: API_KEY.value,
customized: customized.value,
customizedApp: customizedApp.value,
customizedCommand: customizedCommand.value
@@ -51,6 +52,7 @@ export const useEngineControlStore = defineStore('engineControl', () => {
audio.value = controls.audio
engineEnabled.value = controls.engineEnabled
translation.value = controls.translation
API_KEY.value = controls.API_KEY
customized.value = controls.customized
customizedApp.value = controls.customizedApp
customizedCommand.value = controls.customizedCommand
@@ -108,6 +110,7 @@ export const useEngineControlStore = defineStore('engineControl', () => {
engine, // 字幕引擎
audio, // 选择音频
translation, // 是否启用翻译
API_KEY, // API KEY
customized, // 是否使用自定义字幕引擎
customizedApp, // 自定义字幕引擎的应用程序
customizedCommand, // 自定义字幕引擎的命令

View File

@@ -9,6 +9,7 @@ export interface Controls {
engine: 'gummy',
audio: 0 | 1,
translation: boolean,
API_KEY: string,
customized: boolean,
customizedApp: string,
customizedCommand: string