update_260202-3

This commit is contained in:
lusixing
2026-02-02 22:22:11 -08:00
parent 106c3421e6
commit 9cbd3347f6
9 changed files with 125 additions and 6 deletions

View File

@@ -118,4 +118,51 @@ async def init_db():
)
session.add(gemini_config)
await session.commit()
print("✅ Default Gemini AI configuration created")
print("✅ Default Gemini AI configuration created")
# 4. 检查并初始化 AI Roles
ai_roles_data = [
{
"id": 0,
"name": 'Reflective Assistant',
"description": 'Helps you dive deep into your thoughts and feelings through meaningful reflection.',
"systemPrompt": 'You are a helpful journal assistant. Help the user reflect on their thoughts and feelings.',
"icon": 'journal-outline',
"iconFamily": 'Ionicons',
},
{
"id": 1,
"name": 'Creative Spark',
"description": 'A partner for brainstorming, creative writing, and exploring new ideas.',
"systemPrompt": 'You are a creative brainstorming partner. Help the user explore new ideas, write stories, or look at things from a fresh perspective.',
"icon": 'bulb-outline',
"iconFamily": 'Ionicons',
},
{
"id": 2,
"name": 'Action Planner',
"description": 'Focused on turning thoughts into actionable plans and organized goals.',
"systemPrompt": 'You are a productivity coach. Help the user break down their thoughts into actionable steps and clear goals.',
"icon": 'list-outline',
"iconFamily": 'Ionicons',
},
{
"id": 3,
"name": 'Empathetic Guide',
"description": 'Provides a safe, non-judgmental space for emotional support and empathy.',
"systemPrompt": 'You are a supportive and empathetic friend. Listen to the user\'s concerns and provide emotional support without judgment.',
"icon": 'heart-outline',
"iconFamily": 'Ionicons',
},
]
for role_data in ai_roles_data:
result = await session.execute(
select(models.AIRole).where(models.AIRole.id == role_data["id"])
)
if not result.scalars().first():
new_role = models.AIRole(**role_data)
session.add(new_role)
print(f"✅ AI Role '{role_data['name']}' created")
await session.commit()