fix zhipuCV bug (#2215)

### What problem does this PR solve?

#2198  fix zhipuCV bug

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: Zhedong Cen <cenzhedong2@126.com>
This commit is contained in:
黄腾 2024-09-03 15:11:53 +08:00 committed by GitHub
parent f09b204ae4
commit 2871455e4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -293,9 +293,12 @@ class Zhipu4V(Base):
def describe(self, image, max_tokens=1024):
b64 = self.image2base64(image)
prompt = self.prompt(b64)
prompt[0]["content"][1]["type"] = "text"
res = self.client.chat.completions.create(
model=self.model_name,
messages=self.prompt(b64),
messages=prompt,
max_tokens=max_tokens,
)
return res.choices[0].message.content.strip(), res.usage.total_tokens