mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 03:15:06 +08:00
* fix:Fixed the issue where the rich text processing in the DingTalk API did not account for multiple texts and images, as well as the presence of default line breaks. Also resolved the error in Dify caused by sending only images, which resulted in an empty query. * fix:Considering the various possible scenarios, there are cases where plan_text is empty when there is file content, and there is no file (the message could not be parsed) and the content is empty. * fix:Add the default modifiable prompt input for didify in the ai.yaml file to ensure that the error of query being empty occurs when receiving data. * add: The config migration of Dify * fix:Migration issue * perf: minor fix * chore: minor fix --------- Co-authored-by: Junyan Qin <rockchinq@gmail.com>
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
from .. import migration
|
|
|
|
import sqlalchemy
|
|
|
|
from ...entity.persistence import pipeline as persistence_pipeline
|
|
|
|
|
|
@migration.migration_class(11)
|
|
class DBMigrateDifyApiConfig(migration.DBMigration):
|
|
"""Langflow API config"""
|
|
|
|
async def upgrade(self):
|
|
"""Upgrade"""
|
|
# 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 'base-prompt' not in config['ai']['dify-service-api']:
|
|
config['ai']['dify-service-api']['base-prompt'] = (
|
|
'When the file content is readable, please read the content of this file. When the file is an image, describe the content of this image.',
|
|
)
|
|
|
|
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):
|
|
"""Downgrade"""
|
|
pass
|