Chat optimizations
This commit is contained in:
@@ -86,15 +86,15 @@ async def fix_all_posts(apply: bool = False):
|
||||
Args:
|
||||
apply: If True, apply changes to database. If False, just preview.
|
||||
"""
|
||||
logger.info("Loading all customers...")
|
||||
customers = await db.list_customers()
|
||||
logger.info("Loading all users...")
|
||||
users = await db.list_users()
|
||||
|
||||
total_posts = 0
|
||||
posts_with_markdown = 0
|
||||
fixed_posts = []
|
||||
|
||||
for customer in customers:
|
||||
posts = await db.get_generated_posts(customer.id)
|
||||
for user in users:
|
||||
posts = await db.get_generated_posts(user.id)
|
||||
|
||||
for post in posts:
|
||||
total_posts += 1
|
||||
@@ -107,9 +107,12 @@ async def fix_all_posts(apply: bool = False):
|
||||
original = post.post_content
|
||||
converted = convert_markdown_bold(original)
|
||||
|
||||
# Get user display name (email or linkedin name)
|
||||
user_name = user.email or user.linkedin_name or str(user.id)
|
||||
|
||||
fixed_posts.append({
|
||||
'id': post.id,
|
||||
'customer': customer.name,
|
||||
'user': user_name,
|
||||
'topic': post.topic_title,
|
||||
'original': original,
|
||||
'converted': converted,
|
||||
@@ -118,7 +121,7 @@ async def fix_all_posts(apply: bool = False):
|
||||
# Show preview
|
||||
print(f"\n{'='*60}")
|
||||
print(f"Post: {post.topic_title}")
|
||||
print(f"Customer: {customer.name}")
|
||||
print(f"User: {user_name}")
|
||||
print(f"ID: {post.id}")
|
||||
print(f"{'-'*60}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user