Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
4993629d6d
@ -93,7 +93,9 @@ class AzureModelProvider(IModelProvider):
|
|||||||
return azure_chat_open_ai
|
return azure_chat_open_ai
|
||||||
|
|
||||||
def get_model_credential(self, model_type, model_name):
|
def get_model_credential(self, model_type, model_name):
|
||||||
|
if model_name in model_dict:
|
||||||
return model_dict.get(model_name).model_credential
|
return model_dict.get(model_name).model_credential
|
||||||
|
raise AppApiException(500, f'不支持的模型:{model_name}')
|
||||||
|
|
||||||
def get_model_provide_info(self):
|
def get_model_provide_info(self):
|
||||||
return ModelProvideInfo(provider='model_azure_provider', name='Azure OpenAI', icon=get_file_content(
|
return ModelProvideInfo(provider='model_azure_provider', name='Azure OpenAI', icon=get_file_content(
|
||||||
|
|||||||
@ -28,9 +28,6 @@ class OllamaLLMModelCredential(BaseForm, BaseModelCredential):
|
|||||||
if not any(list(filter(lambda mt: mt.get('value') == model_type, model_type_list))):
|
if not any(list(filter(lambda mt: mt.get('value') == model_type, model_type_list))):
|
||||||
raise AppApiException(500, f'{model_type} 模型类型不支持')
|
raise AppApiException(500, f'{model_type} 模型类型不支持')
|
||||||
|
|
||||||
if model_name not in model_dict:
|
|
||||||
raise AppApiException(500, f'{model_name} 模型名称不支持')
|
|
||||||
|
|
||||||
for key in ['api_key']:
|
for key in ['api_key']:
|
||||||
if key not in model_credential:
|
if key not in model_credential:
|
||||||
if raise_exception:
|
if raise_exception:
|
||||||
@ -107,7 +104,8 @@ class OllamaModelProvider(IModelProvider):
|
|||||||
def get_model_credential(self, model_type, model_name):
|
def get_model_credential(self, model_type, model_name):
|
||||||
if model_name in model_dict:
|
if model_name in model_dict:
|
||||||
return model_dict.get(model_name).model_credential
|
return model_dict.get(model_name).model_credential
|
||||||
raise AppApiException(500, f'不支持的模型:{model_name}')
|
# 如果使用模型不在配置中,则使用默认认证
|
||||||
|
return ollama_llm_model_credential
|
||||||
|
|
||||||
def get_model(self, model_type, model_name, model_credential: Dict[str, object], **model_kwargs) -> BaseChatModel:
|
def get_model(self, model_type, model_name, model_credential: Dict[str, object], **model_kwargs) -> BaseChatModel:
|
||||||
return OllamaChatModel(model=model_name, openai_api_base=model_credential.get('api_base'),
|
return OllamaChatModel(model=model_name, openai_api_base=model_credential.get('api_base'),
|
||||||
|
|||||||
@ -64,7 +64,10 @@
|
|||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
v-model="base_form_data.model_name"
|
v-model="base_form_data.model_name"
|
||||||
class="m-2"
|
class="m-2"
|
||||||
placeholder="请选择模型类型"
|
placeholder="请选择基础模型"
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
default-first-option
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in base_model_list"
|
v-for="item in base_model_list"
|
||||||
|
|||||||
@ -56,9 +56,12 @@
|
|||||||
@change="getModelForm($event)"
|
@change="getModelForm($event)"
|
||||||
v-loading="base_model_loading"
|
v-loading="base_model_loading"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
v-model="base_form_data.model_name"
|
v-model="form_data.model_name"
|
||||||
class="m-2"
|
class="m-2"
|
||||||
placeholder="请选择模型类型"
|
placeholder="请选择基础模型"
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
default-first-option
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in base_model_list"
|
v-for="item in base_model_list"
|
||||||
@ -145,9 +148,6 @@ const list_base_model = (model_type: any) => {
|
|||||||
ModelApi.listBaseModel(providerValue.value.provider, model_type, base_model_loading).then(
|
ModelApi.listBaseModel(providerValue.value.provider, model_type, base_model_loading).then(
|
||||||
(ok) => {
|
(ok) => {
|
||||||
base_model_list.value = ok.data
|
base_model_list.value = ok.data
|
||||||
if (!base_model_list.value.some((item) => item.name === form_data.value.model_name)) {
|
|
||||||
form_data.value.model_name = ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user