refactor: improve model_config implementation based on code review

- Simplify _get_model_config method logic
- Add more descriptive comment about model_config usage
- Clarify when model_config is used (assistant type apps)

Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-22 06:28:35 +00:00
parent 031586cf2c
commit cd1929d52e
2 changed files with 5 additions and 4 deletions

View File

@@ -53,6 +53,8 @@ class AsyncDifyServiceClient:
}
# Add model_config if provided
# model_config allows overriding model settings (temperature, max_tokens, etc.)
# for assistant type apps in Dify's open-source version
if model_config is not None:
payload['model_config'] = model_config

View File

@@ -41,12 +41,11 @@ class DifyServiceAPIRunner(runner.RequestRunner):
"""获取模型配置参数
Returns:
模型配置字典如果未配置则返回None
模型配置字典,如果未配置或为空则返回None
"""
model_config = self.pipeline_config['ai']['dify-service-api'].get('model-config')
if model_config:
return model_config
return None
# Return None if model_config is None or empty dict to avoid sending unnecessary parameters
return model_config if model_config else None
def _process_thinking_content(
self,