bion 在 openwebui使用gemini画图 中发帖
通过OpenWebUI使用newapi的gemini实现绘图功能
编写适配函数处理图像生成请求,关键代码如下:
"""
title: OpenAI兼容API (聊天与画图管道)
author: dingzhen
version: 0.1.0
"""
from pydantic import BaseModel, Field
from typing import (
Optional,
List,
AsyncGenerator,
Dict,
Any,
) # Added Any for Request if not strictly typed
# 尝试导入Request,如果OpenWebUI环境提供FastAPI/Starlette的Request对象
try:
from fastapi import Request
except...