浏览代码

Fix: correct single base64 image handling in image prompt (#9220)

### What problem does this PR solve?

Correct single base64 image handling in image prompt.


![img_v3_02or_ec4757c2-a9d4-4774-9a76-f7c6be633ebg](https://github.com/user-attachments/assets/872a86bf-e2a8-48d1-9b71-2a0c7a35ba9e)

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.20.1
Yongteng Lei 2 个月前
父节点
当前提交
30ccc4a66c
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5
    1
      rag/llm/cv_model.py

+ 5
- 1
rag/llm/cv_model.py 查看文件

def _image_prompt(self, text, images): def _image_prompt(self, text, images):
if not images: if not images:
return text return text

if isinstance(images, str):
images = [images]

pmpt = [{"type": "text", "text": text}] pmpt = [{"type": "text", "text": text}]
for img in images: for img in images:
pmpt.append({ pmpt.append({
yield ans yield ans
else: else:
for ans in GeminiCV.chat_streamly(self, system, history, gen_conf, images): for ans in GeminiCV.chat_streamly(self, system, history, gen_conf, images):
yield ans
yield ans

正在加载...
取消
保存