mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 01:26:00 +08:00
fix: azure openai model parameters wrong when using hosting credentials (#1993)
This commit is contained in:
parent
ebd11e7482
commit
bf7045566d
@ -60,7 +60,22 @@ class ProviderConfiguration(BaseModel):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
if self.using_provider_type == ProviderType.SYSTEM:
|
if self.using_provider_type == ProviderType.SYSTEM:
|
||||||
return self.system_configuration.credentials
|
restrict_models = []
|
||||||
|
for quota_configuration in self.system_configuration.quota_configurations:
|
||||||
|
if self.system_configuration.current_quota_type != quota_configuration.quota_type:
|
||||||
|
continue
|
||||||
|
|
||||||
|
restrict_models = quota_configuration.restrict_models
|
||||||
|
|
||||||
|
copy_credentials = self.system_configuration.credentials.copy()
|
||||||
|
if restrict_models:
|
||||||
|
for restrict_model in restrict_models:
|
||||||
|
if (restrict_model.model_type == model_type
|
||||||
|
and restrict_model.model == model
|
||||||
|
and restrict_model.base_model_name):
|
||||||
|
copy_credentials['base_model_name'] = restrict_model.base_model_name
|
||||||
|
|
||||||
|
return copy_credentials
|
||||||
else:
|
else:
|
||||||
if self.custom_configuration.models:
|
if self.custom_configuration.models:
|
||||||
for model_configuration in self.custom_configuration.models:
|
for model_configuration in self.custom_configuration.models:
|
||||||
|
@ -296,7 +296,7 @@ LLM_BASE_MODELS = [
|
|||||||
name='frequency_penalty',
|
name='frequency_penalty',
|
||||||
**PARAMETER_RULE_TEMPLATE[DefaultParameterName.FREQUENCY_PENALTY],
|
**PARAMETER_RULE_TEMPLATE[DefaultParameterName.FREQUENCY_PENALTY],
|
||||||
),
|
),
|
||||||
_get_max_tokens(default=512, min_val=1, max_val=128000),
|
_get_max_tokens(default=512, min_val=1, max_val=4096),
|
||||||
ParameterRule(
|
ParameterRule(
|
||||||
name='seed',
|
name='seed',
|
||||||
label=I18nObject(
|
label=I18nObject(
|
||||||
@ -369,7 +369,7 @@ LLM_BASE_MODELS = [
|
|||||||
name='frequency_penalty',
|
name='frequency_penalty',
|
||||||
**PARAMETER_RULE_TEMPLATE[DefaultParameterName.FREQUENCY_PENALTY],
|
**PARAMETER_RULE_TEMPLATE[DefaultParameterName.FREQUENCY_PENALTY],
|
||||||
),
|
),
|
||||||
_get_max_tokens(default=512, min_val=1, max_val=128000),
|
_get_max_tokens(default=512, min_val=1, max_val=4096),
|
||||||
ParameterRule(
|
ParameterRule(
|
||||||
name='seed',
|
name='seed',
|
||||||
label=I18nObject(
|
label=I18nObject(
|
||||||
|
@ -22,7 +22,7 @@ parameter_rules:
|
|||||||
use_template: max_tokens
|
use_template: max_tokens
|
||||||
default: 512
|
default: 512
|
||||||
min: 1
|
min: 1
|
||||||
max: 128000
|
max: 4096
|
||||||
- name: seed
|
- name: seed
|
||||||
label:
|
label:
|
||||||
zh_Hans: 种子
|
zh_Hans: 种子
|
||||||
|
@ -21,7 +21,7 @@ parameter_rules:
|
|||||||
use_template: max_tokens
|
use_template: max_tokens
|
||||||
default: 512
|
default: 512
|
||||||
min: 1
|
min: 1
|
||||||
max: 128000
|
max: 4096
|
||||||
- name: seed
|
- name: seed
|
||||||
label:
|
label:
|
||||||
zh_Hans: 种子
|
zh_Hans: 种子
|
||||||
|
Loading…
x
Reference in New Issue
Block a user