mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: 基础模型支持输入
This commit is contained in:
parent
41669a1370
commit
357be32df1
|
|
@ -93,7 +93,9 @@ class AzureModelProvider(IModelProvider):
|
|||
return azure_chat_open_ai
|
||||
|
||||
def get_model_credential(self, model_type, model_name):
|
||||
return model_dict.get(model_name).model_credential
|
||||
if model_name in model_dict:
|
||||
return model_dict.get(model_name).model_credential
|
||||
raise AppApiException(500, f'不支持的模型:{model_name}')
|
||||
|
||||
def get_model_provide_info(self):
|
||||
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))):
|
||||
raise AppApiException(500, f'{model_type} 模型类型不支持')
|
||||
|
||||
if model_name not in model_dict:
|
||||
raise AppApiException(500, f'{model_name} 模型名称不支持')
|
||||
|
||||
for key in ['api_key']:
|
||||
if key not in model_credential:
|
||||
if raise_exception:
|
||||
|
|
@ -107,7 +104,8 @@ class OllamaModelProvider(IModelProvider):
|
|||
def get_model_credential(self, model_type, model_name):
|
||||
if model_name in model_dict:
|
||||
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:
|
||||
return OllamaChatModel(model=model_name, openai_api_base=model_credential.get('api_base'),
|
||||
|
|
|
|||
|
|
@ -64,7 +64,10 @@
|
|||
style="width: 100%"
|
||||
v-model="base_form_data.model_name"
|
||||
class="m-2"
|
||||
placeholder="请选择模型类型"
|
||||
placeholder="请选择基础模型"
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
>
|
||||
<el-option
|
||||
v-for="item in base_model_list"
|
||||
|
|
|
|||
|
|
@ -56,9 +56,12 @@
|
|||
@change="getModelForm($event)"
|
||||
v-loading="base_model_loading"
|
||||
style="width: 100%"
|
||||
v-model="base_form_data.model_name"
|
||||
v-model="form_data.model_name"
|
||||
class="m-2"
|
||||
placeholder="请选择模型类型"
|
||||
placeholder="请选择基础模型"
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
>
|
||||
<el-option
|
||||
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(
|
||||
(ok) => {
|
||||
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