fix: load persisted plugin config (#2208)

Co-authored-by: RockChinQ <rockchinq@gmail.com>
This commit is contained in:
Nody the lobster
2026-05-16 03:51:45 -04:00
committed by GitHub
parent 17bbc8bf10
commit 1bd9c334aa

View File

@@ -7,8 +7,10 @@ import httpx
import uuid import uuid
import os import os
import posixpath import posixpath
import sqlalchemy
from .....core import taskmgr from .....core import taskmgr
from .....entity.persistence import plugin as persistence_plugin
from .. import group from .. import group
from langbot_plugin.runtime.plugin.mgr import PluginInstallSource from langbot_plugin.runtime.plugin.mgr import PluginInstallSource
@@ -148,7 +150,15 @@ class PluginsRouterGroup(group.RouterGroup):
return self.http_status(404, -1, 'plugin not found') return self.http_status(404, -1, 'plugin not found')
if quart.request.method == 'GET': if quart.request.method == 'GET':
return self.success(data={'config': plugin['plugin_config']}) result = await self.ap.persistence_mgr.execute_async(
sqlalchemy.select(persistence_plugin.PluginSetting.config)
.where(persistence_plugin.PluginSetting.plugin_author == author)
.where(persistence_plugin.PluginSetting.plugin_name == plugin_name)
)
persisted_config = result.scalar_one_or_none()
config = persisted_config if persisted_config is not None else plugin['plugin_config']
return self.success(data={'config': config})
elif quart.request.method == 'PUT': elif quart.request.method == 'PUT':
data = await quart.request.json data = await quart.request.json