fix: model params
This commit is contained in:
parent
cabd6fb7f5
commit
6f6e823117
@ -52,7 +52,7 @@ class QwenVLModelCredential(BaseForm, BaseModelCredential):
|
|||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
model = provider.get_model(model_type, model_name, model_credential, **model_params)
|
model = provider.get_model(model_type, model_name, model_credential, **model_params)
|
||||||
res = model.stream([HumanMessage(content=[{"type": "text", "text": _('Hello')}])])
|
res = model.stream([HumanMessage(content=[{"type": "text", "text": gettext('Hello')}])])
|
||||||
for chunk in res:
|
for chunk in res:
|
||||||
print(chunk)
|
print(chunk)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class QwenTextToImageModel(MaxKBBaseModel, BaseTextToImage):
|
|||||||
|
|
||||||
def check_auth(self):
|
def check_auth(self):
|
||||||
chat = ChatTongyi(api_key=self.api_key, model_name='qwen-max')
|
chat = ChatTongyi(api_key=self.api_key, model_name='qwen-max')
|
||||||
chat.invoke([HumanMessage([{"type": "text", "text": _('Hello')}])])
|
chat.invoke([HumanMessage([{"type": "text", "text": gettext('Hello')}])])
|
||||||
|
|
||||||
def generate_image(self, prompt: str, negative_prompt: str = None):
|
def generate_image(self, prompt: str, negative_prompt: str = None):
|
||||||
# api_base='https://dashscope.aliyuncs.com/compatible-mode/v1',
|
# api_base='https://dashscope.aliyuncs.com/compatible-mode/v1',
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class AzureOpenAIImageModelCredential(BaseForm, BaseModelCredential):
|
|||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
model = provider.get_model(model_type, model_name, model_credential, **model_params)
|
model = provider.get_model(model_type, model_name, model_credential, **model_params)
|
||||||
res = model.stream([HumanMessage(content=[{"type": "text", "text": _('Hello')}])])
|
res = model.stream([HumanMessage(content=[{"type": "text", "text": gettext('Hello')}])])
|
||||||
for chunk in res:
|
for chunk in res:
|
||||||
print(chunk)
|
print(chunk)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class OpenAIImageModelCredential(BaseForm, BaseModelCredential):
|
|||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
model = provider.get_model(model_type, model_name, model_credential, **model_params)
|
model = provider.get_model(model_type, model_name, model_credential, **model_params)
|
||||||
res = model.stream([HumanMessage(content=[{"type": "text", "text": _('Hello')}])])
|
res = model.stream([HumanMessage(content=[{"type": "text", "text": gettext('Hello')}])])
|
||||||
for chunk in res:
|
for chunk in res:
|
||||||
print(chunk)
|
print(chunk)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class QwenTextToImageModel(MaxKBBaseModel, BaseTextToImage):
|
|||||||
|
|
||||||
def check_auth(self):
|
def check_auth(self):
|
||||||
chat = ChatTongyi(api_key=self.api_key, model_name='qwen-max')
|
chat = ChatTongyi(api_key=self.api_key, model_name='qwen-max')
|
||||||
chat.invoke([HumanMessage([{"type": "text", "text": _('Hello')}])])
|
chat.invoke([HumanMessage([{"type": "text", "text": gettext('Hello')}])])
|
||||||
|
|
||||||
def generate_image(self, prompt: str, negative_prompt: str = None):
|
def generate_image(self, prompt: str, negative_prompt: str = None):
|
||||||
# api_base='https://dashscope.aliyuncs.com/compatible-mode/v1',
|
# api_base='https://dashscope.aliyuncs.com/compatible-mode/v1',
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class ZhiPuTextToImage(MaxKBBaseModel, BaseTextToImage):
|
|||||||
zhipuai_api_key=self.api_key,
|
zhipuai_api_key=self.api_key,
|
||||||
model_name=self.model,
|
model_name=self.model,
|
||||||
)
|
)
|
||||||
chat.invoke([HumanMessage([{"type": "text", "text": _('Hello')}])])
|
chat.invoke([HumanMessage([{"type": "text", "text": gettext('Hello')}])])
|
||||||
|
|
||||||
# self.generate_image('生成一个小猫图片')
|
# self.generate_image('生成一个小猫图片')
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user