remove title:
This commit is contained in:
@@ -89,7 +89,7 @@ def extract_texts_for_cluster(cluster_id):
|
|||||||
# -------------------------------
|
# -------------------------------
|
||||||
def generate_title(texts):
|
def generate_title(texts):
|
||||||
prompt = (
|
prompt = (
|
||||||
"Summarize the following texts into a concise 2 - 4 word title that captures the main theme:\n\n"
|
"Summarize the following texts into a concise 3 - 6 word title that captures the main theme:\n\n"
|
||||||
+ "\n".join(f"- {t}" for t in texts) +
|
+ "\n".join(f"- {t}" for t in texts) +
|
||||||
"\n\nTitle:"
|
"\n\nTitle:"
|
||||||
)
|
)
|
||||||
@@ -100,7 +100,9 @@ def generate_title(texts):
|
|||||||
{"role": "user", "content": prompt}
|
{"role": "user", "content": prompt}
|
||||||
])
|
])
|
||||||
title = response.choices[0].message.content.strip()
|
title = response.choices[0].message.content.strip()
|
||||||
print(title)
|
|
||||||
|
if title.lower().startswith("title:"):
|
||||||
|
title = title[6:].strip()
|
||||||
return title
|
return title
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Error generating title:", e)
|
print("Error generating title:", e)
|
||||||
|
|||||||
Reference in New Issue
Block a user