mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-07 22:36:02 +00:00
* feat(n8n): 添加n8n工作流API支持 添加n8n工作流API作为新的运行器类型,支持通过webhook调用n8n工作流,并提供多种认证方式(Basic、JWT、Header)。新增N8nAuthFormComponent用于处理n8n认证表单联动,并更新相关配置文件和测试用例。 * chore: remove pip mirror url * perf: simplify ret def of pipeline metadata * feat(n8n): raise exc instead of ret as normal msg * perf: add var `user_message_text` * chore(n8n): migration and default config * chore: required database version --------- Co-authored-by: hengwei.wang <@> Co-authored-by: Junyan Qin <rockchinq@gmail.com>
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
from .. import migration
|
|
|
|
import sqlalchemy
|
|
|
|
from ...entity.persistence import pipeline as persistence_pipeline
|
|
|
|
|
|
@migration.migration_class(2)
|
|
class DBMigrateCombineQuoteMsgConfig(migration.DBMigration):
|
|
"""引用消息合并配置"""
|
|
|
|
async def upgrade(self):
|
|
"""升级"""
|
|
# read all pipelines
|
|
pipelines = await self.ap.persistence_mgr.execute_async(sqlalchemy.select(persistence_pipeline.LegacyPipeline))
|
|
|
|
for pipeline in pipelines:
|
|
serialized_pipeline = self.ap.persistence_mgr.serialize_model(persistence_pipeline.LegacyPipeline, pipeline)
|
|
|
|
config = serialized_pipeline['config']
|
|
|
|
if 'misc' not in config['trigger']:
|
|
config['trigger']['misc'] = {}
|
|
|
|
if 'combine-quote-message' not in config['trigger']['misc']:
|
|
config['trigger']['misc']['combine-quote-message'] = False
|
|
|
|
await self.ap.persistence_mgr.execute_async(
|
|
sqlalchemy.update(persistence_pipeline.LegacyPipeline)
|
|
.where(persistence_pipeline.LegacyPipeline.uuid == serialized_pipeline['uuid'])
|
|
.values(
|
|
{
|
|
'config': config,
|
|
'for_version': self.ap.ver_mgr.get_current_version(),
|
|
}
|
|
)
|
|
)
|
|
|
|
async def downgrade(self):
|
|
"""降级"""
|
|
pass
|