Add api management module to let users set their api more easily.

This commit is contained in:
WITHOUTNAMESES 2025-05-19 01:38:47 +08:00
parent 6cb5f23487
commit c8d11ac4c3
6 changed files with 153 additions and 5 deletions

View File

@ -906,6 +906,69 @@ with right_panel:
params.stroke_color = st.color_picker(tr("Stroke Color"), "#000000")
with stroke_cols[1]:
params.stroke_width = st.slider(tr("Stroke Width"), 0.0, 10.0, 1.5)
with st.expander(tr("Click to show API Key management"), expanded=False):
st.subheader(tr("Manage Pexels and Pixabay API Keys"))
col1, col2 = st.tabs(["Pexels API Keys", "Pixabay API Keys"])
with col1:
st.subheader("Pexels API Keys")
if config.app["pexels_api_keys"]:
st.write(tr("Current Keys:"))
for key in config.app["pexels_api_keys"]:
st.code(key)
else:
st.info(tr("No Pexels API Keys currently"))
new_key = st.text_input(tr("Add Pexels API Key"), key="pexels_new_key")
if st.button(tr("Add Pexels API Key")):
if new_key and new_key not in config.app["pexels_api_keys"]:
config.app["pexels_api_keys"].append(new_key)
config.save_config()
st.success(tr("Pexels API Key added successfully"))
elif new_key in config.app["pexels_api_keys"]:
st.warning(tr("This API Key already exists"))
else:
st.error(tr("Please enter a valid API Key"))
if config.app["pexels_api_keys"]:
delete_key = st.selectbox(
tr("Select Pexels API Key to delete"), config.app["pexels_api_keys"], key="pexels_delete_key"
)
if st.button(tr("Delete Selected Pexels API Key")):
config.app["pexels_api_keys"].remove(delete_key)
config.save_config()
st.success(tr("Pexels API Key deleted successfully"))
with col2:
st.subheader("Pixabay API Keys")
if config.app["pixabay_api_keys"]:
st.write(tr("Current Keys:"))
for key in config.app["pixabay_api_keys"]:
st.code(key)
else:
st.info(tr("No Pixabay API Keys currently"))
new_key = st.text_input(tr("Add Pixabay API Key"), key="pixabay_new_key")
if st.button(tr("Add Pixabay API Key")):
if new_key and new_key not in config.app["pixabay_api_keys"]:
config.app["pixabay_api_keys"].append(new_key)
config.save_config()
st.success(tr("Pixabay API Key added successfully"))
elif new_key in config.app["pixabay_api_keys"]:
st.warning(tr("This API Key already exists"))
else:
st.error(tr("Please enter a valid API Key"))
if config.app["pixabay_api_keys"]:
delete_key = st.selectbox(
tr("Select Pixabay API Key to delete"), config.app["pixabay_api_keys"], key="pixabay_delete_key"
)
if st.button(tr("Delete Selected Pixabay API Key")):
config.app["pixabay_api_keys"].remove(delete_key)
config.save_config()
st.success(tr("Pixabay API Key deleted successfully"))
start_button = st.button(tr("Generate Video"), use_container_width=True, type="primary")
if start_button:

View File

@ -100,6 +100,23 @@
"Hide Log": "Protokoll ausblenden",
"Hide Basic Settings": "Basis-Einstellungen ausblenden\n\nWenn diese Option deaktiviert ist, wird die Basis-Einstellungen-Leiste nicht auf der Seite angezeigt.\n\nWenn Sie sie erneut anzeigen möchten, setzen Sie `hide_config = false` in `config.toml`",
"LLM Settings": "**LLM-Einstellungen**",
"Video Source Settings": "**Videoquellen-Einstellungen**"
"Video Source Settings": "**Videoquellen-Einstellungen**",
"Click to show API Key management": "Klicken Sie hier, um die API-Schlüsselverwaltung anzuzeigen",
"Manage Pexels and Pixabay API Keys": "Pexels- und Pixabay-API-Schlüssel verwalten",
"Current Keys:": "Aktuelle Schlüssel:",
"No Pexels API Keys currently": "Derzeit keine Pexels-API-Schlüssel",
"Add Pexels API Key": "Pexels-API-Schlüssel hinzufügen",
"Pexels API Key added successfully": "Pexels-API-Schlüssel erfolgreich hinzugefügt",
"This API Key already exists": "Dieser API-Schlüssel existiert bereits",
"Please enter a valid API Key": "Bitte geben Sie einen gültigen API-Schlüssel ein",
"Select Pexels API Key to delete": "Wählen Sie den zu löschenden Pexels-API-Schlüssel aus",
"Delete Selected Pexels API Key": "Ausgewählten Pexels-API-Schlüssel löschen",
"Pexels API Key deleted successfully": "Pexels-API-Schlüssel erfolgreich gelöscht",
"No Pixabay API Keys currently": "Derzeit keine Pixabay-API-Schlüssel",
"Add Pixabay API Key": "Pixabay-API-Schlüssel hinzufügen",
"Pixabay API Key added successfully": "Pixabay-API-Schlüssel erfolgreich hinzugefügt",
"Select Pixabay API Key to delete": "Wählen Sie den zu löschenden Pixabay-API-Schlüssel aus",
"Delete Selected Pixabay API Key": "Ausgewählten Pixabay-API-Schlüssel löschen",
"Pixabay API Key deleted successfully": "Pixabay-API-Schlüssel erfolgreich gelöscht"
}
}

View File

@ -100,6 +100,23 @@
"Hide Log": "Hide Log",
"Hide Basic Settings": "Hide Basic Settings\n\nHidden, the basic settings panel will not be displayed on the page.\n\nIf you need to display it again, please set `hide_config = false` in `config.toml`",
"LLM Settings": "**LLM Settings**",
"Video Source Settings": "**Video Source Settings**"
"Video Source Settings": "**Video Source Settings**",
"Click to show API Key management": "Click to show API Key management",
"Manage Pexels and Pixabay API Keys": "Manage Pexels and Pixabay API Keys",
"Current Keys:": "Current Keys:",
"No Pexels API Keys currently": "No Pexels API Keys currently",
"Add Pexels API Key": "Add Pexels API Key",
"Pexels API Key added successfully": "Pexels API Key added successfully",
"This API Key already exists": "This API Key already exists",
"Please enter a valid API Key": "Please enter a valid API Key",
"Select Pexels API Key to delete": "Select Pexels API Key to delete",
"Delete Selected Pexels API Key": "Delete Selected Pexels API Key",
"Pexels API Key deleted successfully": "Pexels API Key deleted successfully",
"No Pixabay API Keys currently": "No Pixabay API Keys currently",
"Add Pixabay API Key": "Add Pixabay API Key",
"Pixabay API Key added successfully": "Pixabay API Key added successfully",
"Select Pixabay API Key to delete": "Select Pixabay API Key to delete",
"Delete Selected Pixabay API Key": "Delete Selected Pixabay API Key",
"Pixabay API Key deleted successfully": "Pixabay API Key deleted successfully"
}
}

View File

@ -100,6 +100,23 @@
"Hide Log": "Ocultar Log",
"Hide Basic Settings": "Ocultar Configurações Básicas\n\nOculto, o painel de configurações básicas não será exibido na página.\n\nSe precisar exibi-lo novamente, defina `hide_config = false` em `config.toml`",
"LLM Settings": "**Configurações do LLM**",
"Video Source Settings": "**Configurações da Fonte do Vídeo**"
"Video Source Settings": "**Configurações da Fonte do Vídeo**",
"Click to show API Key management": "Clique para mostrar o gerenciamento de chaves de API",
"Manage Pexels and Pixabay API Keys": "Gerenciar chaves de API do Pexels e Pixabay",
"Current Keys:": "Chaves atuais:",
"No Pexels API Keys currently": "Nenhuma chave de API do Pexels atualmente",
"Add Pexels API Key": "Adicionar chave de API do Pexels",
"Pexels API Key added successfully": "Chave de API do Pexels adicionada com sucesso",
"This API Key already exists": "Esta chave de API já existe",
"Please enter a valid API Key": "Por favor, insira uma chave de API válida",
"Select Pexels API Key to delete": "Selecione a chave de API do Pexels para excluir",
"Delete Selected Pexels API Key": "Excluir chave de API do Pexels selecionada",
"Pexels API Key deleted successfully": "Chave de API do Pexels excluída com sucesso",
"No Pixabay API Keys currently": "Nenhuma chave de API do Pixabay atualmente",
"Add Pixabay API Key": "Adicionar chave de API do Pixabay",
"Pixabay API Key added successfully": "Chave de API do Pixabay adicionada com sucesso",
"Select Pixabay API Key to delete": "Selecione a chave de API do Pixabay para excluir",
"Delete Selected Pixabay API Key": "Excluir chave de API do Pixabay selecionada",
"Pixabay API Key deleted successfully": "Chave de API do Pixabay excluída com sucesso"
}
}

View File

@ -100,6 +100,23 @@
"Hide Log": "Ẩn Nhật Ký",
"Hide Basic Settings": "Ẩn Cài Đặt Cơ Bản\n\nẨn, thanh cài đặt cơ bản sẽ không hiển thị trên trang web.\n\nNếu bạn muốn hiển thị lại, vui lòng đặt `hide_config = false` trong `config.toml`",
"LLM Settings": "**Cài Đặt LLM**",
"Video Source Settings": "**Cài Đặt Nguồn Video**"
"Video Source Settings": "**Cài Đặt Nguồn Video**",
"Click to show API Key management": "Nhấn để hiển thị quản lý API Key",
"Manage Pexels and Pixabay API Keys": "Quản lý API Key của Pexels và Pixabay",
"Current Keys:": "Các Key hiện tại:",
"No Pexels API Keys currently": "Hiện không có API Key Pexels",
"Add Pexels API Key": "Thêm API Key Pexels",
"Pexels API Key added successfully": "Thêm API Key Pexels thành công",
"This API Key already exists": "API Key này đã tồn tại",
"Please enter a valid API Key": "Vui lòng nhập API Key hợp lệ",
"Select Pexels API Key to delete": "Chọn API Key Pexels để xóa",
"Delete Selected Pexels API Key": "Xóa API Key Pexels đã chọn",
"Pexels API Key deleted successfully": "Xóa API Key Pexels thành công",
"No Pixabay API Keys currently": "Hiện không có API Key Pixabay",
"Add Pixabay API Key": "Thêm API Key Pixabay",
"Pixabay API Key added successfully": "Thêm API Key Pixabay thành công",
"Select Pixabay API Key to delete": "Chọn API Key Pixabay để xóa",
"Delete Selected Pixabay API Key": "Xóa API Key Pixabay đã chọn",
"Pixabay API Key deleted successfully": "Xóa API Key Pixabay thành công"
}
}

View File

@ -100,6 +100,23 @@
"Hide Log": "隐藏日志",
"Hide Basic Settings": "隐藏基础设置\n\n隐藏后基础设置面板将不会显示在页面中。\n\n如需要再次显示请在 `config.toml` 中设置 `hide_config = false`",
"LLM Settings": "**大模型设置**",
"Video Source Settings": "**视频源设置**"
"Video Source Settings": "**视频源设置**",
"Click to show API Key management": "点击以显示 API Key 管理功能",
"Manage Pexels and Pixabay API Keys": "管理 Pexels 和 Pixabay API Keys",
"Current Keys:": "当前 Keys:",
"No Pexels API Keys currently": "暂无 Pexels API Keys",
"Add Pexels API Key": "新增 Pexels API Key",
"Pexels API Key added successfully": "Pexels API Key 添加成功",
"This API Key already exists": "这个 Key 已经存在",
"Please enter a valid API Key": "请输入一个有效的 Key",
"Select Pexels API Key to delete": "选择要删除的 Pexels API Key",
"Delete Selected Pexels API Key": "删除选定的 Pexels API Key",
"Pexels API Key deleted successfully": "Pexels API Key 删除成功",
"No Pixabay API Keys currently": "暂无 Pixabay API Keys",
"Add Pixabay API Key": "新增 Pixabay API Key",
"Pixabay API Key added successfully": "Pixabay API Key 添加成功",
"Select Pixabay API Key to delete": "选择要删除的 Pixabay API Key",
"Delete Selected Pixabay API Key": "删除选定的 Pixabay API Key",
"Pixabay API Key deleted successfully": "Pixabay API Key 删除成功"
}
}