Merge branch 'main' of https://github.com/maxkb-dev/maxkb
This commit is contained in:
commit
c06d5cc8b4
@ -17,9 +17,10 @@ class OpenAIImage(MaxKBBaseModel, ChatOpenAI):
|
|||||||
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
||||||
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)
|
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)
|
||||||
return OpenAIImage(
|
return OpenAIImage(
|
||||||
model=model_name,
|
model_name=model_name,
|
||||||
openai_api_base=model_credential.get('api_base'),
|
openai_api_base=model_credential.get('api_base'),
|
||||||
openai_api_key=model_credential.get('api_key'),
|
openai_api_key=model_credential.get('api_key'),
|
||||||
stream_options={"include_usage": True},
|
# stream_options={"include_usage": True},
|
||||||
|
streaming=True,
|
||||||
**optional_params,
|
**optional_params,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -13,10 +13,11 @@ class QwenVLChatModel(MaxKBBaseModel, ChatOpenAI):
|
|||||||
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
||||||
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)
|
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)
|
||||||
chat_tong_yi = QwenVLChatModel(
|
chat_tong_yi = QwenVLChatModel(
|
||||||
model=model_name,
|
model_name=model_name,
|
||||||
openai_api_key=model_credential.get('api_key'),
|
openai_api_key=model_credential.get('api_key'),
|
||||||
openai_api_base='https://dashscope.aliyuncs.com/compatible-mode/v1',
|
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,
|
model_kwargs=optional_params,
|
||||||
)
|
)
|
||||||
return chat_tong_yi
|
return chat_tong_yi
|
||||||
|
|||||||
@ -17,9 +17,10 @@ class TencentVision(MaxKBBaseModel, ChatOpenAI):
|
|||||||
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
||||||
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)
|
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)
|
||||||
return TencentVision(
|
return TencentVision(
|
||||||
model=model_name,
|
model_name=model_name,
|
||||||
openai_api_base='https://api.hunyuan.cloud.tencent.com/v1',
|
openai_api_base='https://api.hunyuan.cloud.tencent.com/v1',
|
||||||
openai_api_key=model_credential.get('api_key'),
|
openai_api_key=model_credential.get('api_key'),
|
||||||
stream_options={"include_usage": True},
|
# stream_options={"include_usage": True},
|
||||||
|
streaming=True,
|
||||||
**optional_params,
|
**optional_params,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -193,6 +193,7 @@ import applicationApi from '@/api/application'
|
|||||||
import { app } from '@/main'
|
import { app } from '@/main'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||||
|
import type { FormInstance } from 'element-plus'
|
||||||
|
|
||||||
const { model } = useStore()
|
const { model } = useStore()
|
||||||
|
|
||||||
@ -204,6 +205,12 @@ const props = defineProps<{ nodeModel: any }>()
|
|||||||
const modelOptions = ref<any>(null)
|
const modelOptions = ref<any>(null)
|
||||||
const providerOptions = ref<Array<Provider>>([])
|
const providerOptions = ref<Array<Provider>>([])
|
||||||
|
|
||||||
|
const aiChatNodeFormRef = ref<FormInstance>()
|
||||||
|
const validate = () => {
|
||||||
|
return aiChatNodeFormRef.value?.validate().catch((err) => {
|
||||||
|
return Promise.reject({ node: props.nodeModel, errMessage: err })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const wheel = (e: any) => {
|
const wheel = (e: any) => {
|
||||||
if (e.ctrlKey === true) {
|
if (e.ctrlKey === true) {
|
||||||
@ -277,6 +284,8 @@ function submitDialog(val: string) {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getModel()
|
getModel()
|
||||||
getProvider()
|
getProvider()
|
||||||
|
|
||||||
|
set(props.nodeModel, 'validate', validate)
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user