(path: str)
| 23 | |
| 24 | # 方法 2:本地图片转 base64 |
| 25 | def image_to_data_url(path: str) -> str: |
| 26 | with open(path, "rb") as f: |
| 27 | b64 = base64.b64encode(f.read()).decode() |
| 28 | return f"data:image/jpeg;base64,{b64}" |
| 29 | |
| 30 | resp = client.chat.completions.create( |
| 31 | model="gpt-5", |