From daddcd34da4a65fd37a16d8f25c100bd9839b21f Mon Sep 17 00:00:00 2001 From: carry <2641257231@qq.com> Date: Wed, 9 Apr 2025 10:28:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(db):=20=E4=B8=BA=20promptStore=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=A9=BA=E6=95=B0=E6=8D=AE=E5=BA=93=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 initialize_prompt_store 函数中增加空数据库检查和初始化逻辑 - 为默认模板添加 id 字段,设置为 0 --- db/prompt_store.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db/prompt_store.py b/db/prompt_store.py index c5cd057..5433102 100644 --- a/db/prompt_store.py +++ b/db/prompt_store.py @@ -43,9 +43,11 @@ def initialize_prompt_store(db: TinyDB) -> None: """ # 检查数据库是否为空 if not db.all(): # 如果数据库中没有数据 - db.insert(promptTempleta(name="default", - description="默认提示词模板", - content="""项目名为:{ project_name } + db.insert(promptTempleta( + id=0, + name="default", + description="默认提示词模板", + content="""项目名为:{ project_name } 请依据以下该项目官方文档的部分内容,创造合适的对话数据集用于微调一个了解该项目的小模型的语料,要求兼顾文档中间尽可能多的信息点,使用中文 文档节选:{ content } 按照如下json格式返回:{ json }""").model_dump())