From 12d54aff806a8890df095e80827b7a5ca3c4185f Mon Sep 17 00:00:00 2001 From: CaptainB Date: Wed, 20 Nov 2024 10:27:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=E5=8E=BB=E6=8E=89=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=AD=E7=9A=84=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/openai_model_provider/model/image.py | 5 +++-- .../models_provider/impl/qwen_model_provider/model/image.py | 5 +++-- .../impl/tencent_model_provider/model/image.py | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/setting/models_provider/impl/openai_model_provider/model/image.py b/apps/setting/models_provider/impl/openai_model_provider/model/image.py index 2ccb04f69..b1f7a7847 100644 --- a/apps/setting/models_provider/impl/openai_model_provider/model/image.py +++ b/apps/setting/models_provider/impl/openai_model_provider/model/image.py @@ -17,9 +17,10 @@ class OpenAIImage(MaxKBBaseModel, ChatOpenAI): def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs): optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs) return OpenAIImage( - model=model_name, + model_name=model_name, openai_api_base=model_credential.get('api_base'), openai_api_key=model_credential.get('api_key'), - stream_options={"include_usage": True}, + # stream_options={"include_usage": True}, + streaming=True, **optional_params, ) diff --git a/apps/setting/models_provider/impl/qwen_model_provider/model/image.py b/apps/setting/models_provider/impl/qwen_model_provider/model/image.py index 60e209154..57598fe97 100644 --- a/apps/setting/models_provider/impl/qwen_model_provider/model/image.py +++ b/apps/setting/models_provider/impl/qwen_model_provider/model/image.py @@ -13,10 +13,11 @@ class QwenVLChatModel(MaxKBBaseModel, ChatOpenAI): def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs): optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs) chat_tong_yi = QwenVLChatModel( - model=model_name, + model_name=model_name, openai_api_key=model_credential.get('api_key'), openai_api_base='https://dashscope.aliyuncs.com/compatible-mode/v1', - stream_options={"include_usage": True}, + # stream_options={"include_usage": True}, + streaming=True, model_kwargs=optional_params, ) return chat_tong_yi diff --git a/apps/setting/models_provider/impl/tencent_model_provider/model/image.py b/apps/setting/models_provider/impl/tencent_model_provider/model/image.py index eb7a00f61..273fdd52a 100644 --- a/apps/setting/models_provider/impl/tencent_model_provider/model/image.py +++ b/apps/setting/models_provider/impl/tencent_model_provider/model/image.py @@ -17,9 +17,10 @@ class TencentVision(MaxKBBaseModel, ChatOpenAI): def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs): optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs) return TencentVision( - model=model_name, + model_name=model_name, openai_api_base='https://api.hunyuan.cloud.tencent.com/v1', openai_api_key=model_credential.get('api_key'), - stream_options={"include_usage": True}, + # stream_options={"include_usage": True}, + streaming=True, **optional_params, ) From aba33eb00aa01a9296a3871096d064849492e13f Mon Sep 17 00:00:00 2001 From: CaptainB Date: Wed, 20 Nov 2024 10:40:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=90=86=E8=A7=A3=E8=8A=82=E7=82=B9=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=A0=A1=E9=AA=8C=E5=BF=85=E5=A1=AB=E9=A1=B9?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/workflow/nodes/image-understand/index.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/src/workflow/nodes/image-understand/index.vue b/ui/src/workflow/nodes/image-understand/index.vue index 4c7252ad9..6ca722d29 100644 --- a/ui/src/workflow/nodes/image-understand/index.vue +++ b/ui/src/workflow/nodes/image-understand/index.vue @@ -193,6 +193,7 @@ import applicationApi from '@/api/application' import { app } from '@/main' import useStore from '@/stores' import NodeCascader from '@/workflow/common/NodeCascader.vue' +import type { FormInstance } from 'element-plus' const { model } = useStore() @@ -204,6 +205,12 @@ const props = defineProps<{ nodeModel: any }>() const modelOptions = ref(null) const providerOptions = ref>([]) +const aiChatNodeFormRef = ref() +const validate = () => { + return aiChatNodeFormRef.value?.validate().catch((err) => { + return Promise.reject({ node: props.nodeModel, errMessage: err }) + }) +} const wheel = (e: any) => { if (e.ctrlKey === true) { @@ -277,6 +284,8 @@ function submitDialog(val: string) { onMounted(() => { getModel() getProvider() + + set(props.nodeModel, 'validate', validate) })