Add cluster titles for time filter

This commit is contained in:
William Jeynes
2026-04-24 17:57:53 +01:00
parent 9aca9855c0
commit 259f9aee0a
2 changed files with 13 additions and 14 deletions
+11 -12
View File
@@ -98,18 +98,17 @@ def generate_title(texts):
"\n\nTitle:"
)
try:
# response = client.chat.completions.create(
# model=OPENAI_MODEL,
# messages=[
# {"role": "system", "content": "You are a helpful assistant who creates short, meaningful titles."},
# {"role": "user", "content": prompt}
# ]
# )
# title = response.choices[0].message.content.strip()
# if title.lower().startswith("title:"):
# title = title[6:].strip()
# return title
return "UNNAMED"
response = client.chat.completions.create(
model=OPENAI_MODEL,
messages=[
{"role": "system", "content": "You are a helpful assistant who creates short, meaningful titles."},
{"role": "user", "content": prompt}
]
)
title = response.choices[0].message.content.strip()
if title.lower().startswith("title:"):
title = title[6:].strip()
return title
except Exception as e:
print("Error generating title:", e)
return "Untitled Cluster"