mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-30 11:26:23 +02:00
allow image input for rolezero
This commit is contained in:
parent
f84fe76d28
commit
78db50b432
4 changed files with 81 additions and 6 deletions
|
|
@ -820,6 +820,19 @@ def decode_image(img_url_or_b64: str) -> Image:
|
|||
return img
|
||||
|
||||
|
||||
def is_support_image_input(model_name: str) -> bool:
|
||||
# model name can be gpt-4o-2024-08-06
|
||||
support_models = ["gpt-4o", "gpt-4o-mini"] # FIXME: hard code for now
|
||||
return any([m in model_name for m in support_models])
|
||||
|
||||
|
||||
def extract_image_paths(content: str) -> bool:
|
||||
# We require that the path must have a space preceding it, like "xxx /an/absolute/path.jpg xxx"
|
||||
pattern = r"[^\s]+\.(?:png|jpe?g|gif|bmp|tiff)"
|
||||
image_paths = re.findall(pattern, content)
|
||||
return image_paths
|
||||
|
||||
|
||||
def log_and_reraise(retry_state: RetryCallState):
|
||||
logger.error(f"Retry attempts exhausted. Last exception: {retry_state.outcome.exception()}")
|
||||
logger.warning(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue