Add cluster titles for time filter
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user