分享个Google Gemeni的中转,支持多模态
本家修改之处
修复: Flash 2-0 在所有危害类别上都无视 BLOCK_NONE
修复: HARM_CATEGORY_CIVIC_INTEGRITY
threshold cannot be
5 报错
适配:联网搜索功能
技术爬爬虾Demo: https://play.210718.xyz
本家Demo: https://gemeni-playground.yuen-network.top/
推荐用Deno部署,CF的话香港地区会中转失败
const harmCategory = [
"HARM_CATEGORY_HATE_SPEECH",
"HARM_CATEGORY_SEXUALLY_EXPLICIT",
"HARM_CATEGORY_DANGEROUS_CONTENT",
"HARM_CATEGORY_HARASSMENT",
"HARM_CATEGORY_CIVIC_INTEGRITY",
];
const safetySettings = (modelName) => {
let threshold = modelName?.includes('2.0') ? 'OFF' : 'BLOCK_NONE';
return harmCategory.map(category => ({
category,
threshold: category === "HARM_CATEGORY_CIVIC_INTEGRITY" ? "BLOCK_ONLY_HIGH" : threshold
}));
}
致谢/引用:
网站UI:
Author: ChrisKyle
Project: https://github.com/ViaAnthroposBenevolentia/gemini-2-live-api-demo
MIT License : https://github.com/ViaAnthroposBenevolentia/gemini-2-live-api-demo/blob/main/LICENSE
Gemini转成OpenAI格式:
Author: PublicAffairs
Project: https://github.com/PublicAffairs/openai-gemini
MIT License : https://github.com/PublicAffairs/openai-gemini/blob/main/LICENSE
合拼两者
Author: 技术爬爬虾
Project: https://github.com/tech-shrimp/gemini-playground
License https://github.com/tech-shrimp/gemini-playground/blob/main/LICENSE