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
+2 -2
View File
@@ -134,7 +134,7 @@ function getConnectedComponents(nodes, links) {
export function VizTimeFilter() { export function VizTimeFilter() {
const fgRef = useRef(); const fgRef = useRef();
const [selectedNode, setSelectedNode] = useState(null); const [selectedNode, setSelectedNode] = useState(null);
const [inputDate, setInputDate] = useState(Date.now()); const [inputDate, setInputDate] = useState(1682353753000);
const parsedInputDate = useMemo(() => { const parsedInputDate = useMemo(() => {
const d = new Date(inputDate); const d = new Date(inputDate);
@@ -242,7 +242,7 @@ export function VizTimeFilter() {
nodeCanvasObject={(node, ctx) => { nodeCanvasObject={(node, ctx) => {
const label = node.label; const label = node.label;
const fontSize = 16 + 32 * Math.min(node.members.length, 5); const fontSize = 32 + 64 * Math.min(node.members.length, 5);
ctx.font = `${fontSize}px Sans-Serif`; ctx.font = `${fontSize}px Sans-Serif`;
const textWidth = ctx.measureText(label).width; const textWidth = ctx.measureText(label).width;
+11 -12
View File
@@ -98,18 +98,17 @@ def generate_title(texts):
"\n\nTitle:" "\n\nTitle:"
) )
try: try:
# response = client.chat.completions.create( response = client.chat.completions.create(
# model=OPENAI_MODEL, model=OPENAI_MODEL,
# messages=[ messages=[
# {"role": "system", "content": "You are a helpful assistant who creates short, meaningful titles."}, {"role": "system", "content": "You are a helpful assistant who creates short, meaningful titles."},
# {"role": "user", "content": prompt} {"role": "user", "content": prompt}
# ] ]
# ) )
# title = response.choices[0].message.content.strip() title = response.choices[0].message.content.strip()
# if title.lower().startswith("title:"): if title.lower().startswith("title:"):
# title = title[6:].strip() title = title[6:].strip()
# return title return title
return "UNNAMED"
except Exception as e: except Exception as e:
print("Error generating title:", e) print("Error generating title:", e)
return "Untitled Cluster" return "Untitled Cluster"