NarratoAI/app/test/test_gemini.py
linyq d67300cdd5 feat(webui): 增加文案生成模型设置和测试连接功能
- 在基本设置中添加新的视觉模型提供商选项
- 实现文本模型连接测试功能,支持 OpenAI、Moonshot、DeepSeek等提供商
- 更新多语言文案,增加新的提示信息
2024-11-27 21:52:39 +08:00

15 lines
393 B
Python

import google.generativeai as genai
from app.config import config
import os
os.environ["HTTP_PROXY"] = config.proxy.get("http")
os.environ["HTTPS_PROXY"] = config.proxy.get("https")
genai.configure(api_key="")
model = genai.GenerativeModel("gemini-1.5-pro")
for i in range(50):
response = model.generate_content("直接回复我文本'当前网络可用'")
print(i, response.text)