File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -22,15 +22,14 @@ class LLMConfig:
22
22
23
23
def create_message_content (text , image_path = None ):
24
24
content = [{"type" : "text" , "text" : text }]
25
-
25
+ image_format = "png" if image_path and image_path . endswith ( ".png" ) else "jpeg"
26
26
if image_path :
27
27
from src .utils import utils
28
28
image_data = utils .encode_image (image_path )
29
29
content .append ({
30
30
"type" : "image_url" ,
31
- "image_url" : {"url" : f"data:image/jpeg ;base64,{ image_data } " }
31
+ "image_url" : {"url" : f"data:image/{ image_format } ;base64,{ image_data } " }
32
32
})
33
-
34
33
return content
35
34
36
35
def get_env_value (key , provider ):
@@ -41,6 +40,7 @@ def get_env_value(key, provider):
41
40
"deepseek" : {"api_key" : "DEEPSEEK_API_KEY" , "base_url" : "DEEPSEEK_ENDPOINT" },
42
41
"mistral" : {"api_key" : "MISTRAL_API_KEY" , "base_url" : "MISTRAL_ENDPOINT" },
43
42
"alibaba" : {"api_key" : "ALIBABA_API_KEY" , "base_url" : "ALIBABA_ENDPOINT" },
43
+ "moonshot" :{"api_key" : "MOONSHOT_API_KEY" , "base_url" : "MOONSHOT_ENDPOINT" },
44
44
}
45
45
46
46
if provider in env_mappings and key in env_mappings [provider ]:
You can’t perform that action at this time.
0 commit comments