Merge pull request #1066 from lyg09270/master

阿里云百炼平台通用模型和自定义模型应用API支持
This commit is contained in:
Junyan Qin (Chin)
2025-02-12 13:44:19 +08:00
committed by GitHub
8 changed files with 346 additions and 1 deletions

View File

@@ -29,7 +29,8 @@ required_deps = {
"lark_oapi": "lark-oapi",
"discord": "discord.py",
"cryptography": "cryptography",
"gewechat_client": "gewechat-client"
"gewechat_client": "gewechat-client",
"dashscope": "dashscope",
}

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from .. import migration
@migration.migration_class("dashscope-app-api-config", 29)
class DashscopeAppAPICfgMigration(migration.Migration):
"""迁移"""
async def need_migrate(self) -> bool:
"""判断当前环境是否需要运行此迁移"""
return 'dashscope-app-api' not in self.ap.provider_cfg.data
async def run(self):
"""执行迁移"""
self.ap.provider_cfg.data['dashscope-app-api'] = {
"app-type": "agent",
"api-key": "sk-1234567890",
"agent": {
"app-id": "Your_app_id",
"references_quote": "参考资料来自:"
},
"workflow": {
"app-id": "Your_app_id",
"references_quote": "参考资料来自:",
"biz_params": {
"city": "北京",
"date": "2023-08-10"
}
}
}
await self.ap.provider_cfg.dump_config()

View File

@@ -12,6 +12,8 @@ from ..migrations import m020_wecom_config, m021_lark_config, m022_lmstudio_conf
from ..migrations import m026_qqofficial_config, m027_wx_official_account_config, m028_aliyun_requester_config
from ..migrations import m029_dashscope_app_api_config
@stage.stage_class("MigrationStage")
class MigrationStage(stage.BootingStage):
"""迁移阶段