-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #953 from RockChinQ/perf/dify-sv-api
perf: 完善 dify api runner
- Loading branch information
Showing
9 changed files
with
249 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from __future__ import annotations | ||
|
||
from .. import migration | ||
|
||
|
||
@migration.migration_class("dify-api-timeout-params", 17) | ||
class DifyAPITimeoutParamsMigration(migration.Migration): | ||
"""迁移""" | ||
|
||
async def need_migrate(self) -> bool: | ||
"""判断当前环境是否需要运行此迁移""" | ||
return 'timeout' not in self.ap.provider_cfg.data['dify-service-api']['chat'] or 'timeout' not in self.ap.provider_cfg.data['dify-service-api']['workflow'] \ | ||
or 'agent' not in self.ap.provider_cfg.data['dify-service-api'] | ||
|
||
async def run(self): | ||
"""执行迁移""" | ||
self.ap.provider_cfg.data['dify-service-api']['chat']['timeout'] = 120 | ||
self.ap.provider_cfg.data['dify-service-api']['workflow']['timeout'] = 120 | ||
self.ap.provider_cfg.data['dify-service-api']['agent'] = { | ||
"api-key": "app-1234567890", | ||
"timeout": 120 | ||
} | ||
|
||
await self.ap.provider_cfg.dump_config() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.