Skip to content

Commit a71da0a

Browse files
committed
fix: frontend for suggestedQuestions fixed
Signed-off-by: Kannav02 <[email protected]>
1 parent cd1c3b8 commit a71da0a

File tree

2 files changed

+12
-72
lines changed

2 files changed

+12
-72
lines changed

frontend/nextjs-frontend/app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ export default function Home() {
326326
/>
327327
</div>
328328
)}
329-
{/* <SuggestedQuestions
329+
<SuggestedQuestions
330330
onSelectQuestion={handleSuggestedQuestion}
331331
latestQuestion={
332332
currentThread?.messages[currentThread.messages.length - 1]
@@ -336,7 +336,7 @@ export default function Home() {
336336
currentThread?.messages[currentThread.messages.length - 1]
337337
?.answer || ''
338338
}
339-
/> */}
339+
/>
340340
</div>
341341
<form
342342
onSubmit={handleSubmit}

frontend/nextjs-frontend/components/SuggestedQuestions.tsx

Lines changed: 10 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -19,77 +19,17 @@ export default function SuggestedQuestions({
1919

2020
const fetchSuggestedQuestions = useCallback(async () => {
2121
setIsLoading(true);
22-
const prompt = `If the assistant answer has sufficient knowledge, use it to predict the next 3 suggested questions. Otherwise, strictly restrict to these topics: Given the list of topics related to OpenROAD, suggest 3 relevant questions strictly focused on any of the given topics.
23-
Getting Started with OpenROAD
24-
Building OpenROAD
25-
Getting Started with the OpenROAD Flow - OpenROAD-flow-scripts
26-
Tutorials
27-
Git Quickstart
28-
Man pages
29-
OpenROAD User Guide
30-
Database
31-
GUI
32-
Partition Management
33-
Restructure
34-
Floorplan Initialization
35-
Pin Placement
36-
Chip-level Connections
37-
Macro Placement
38-
Hierarchical Macro Placement
39-
Tapcell Insertion
40-
PDN Generation
41-
Global Placement
42-
Gate Resizing
43-
Detailed Placement
44-
Clock Tree Synthesis
45-
Global Routing
46-
Antenna Checker
47-
Detailed Routing
48-
Metal Fill
49-
Parasitics Extraction
50-
Messages Glossary
51-
Getting Involved
52-
Developer's Guide
53-
Coding Practices
54-
Logger
55-
CI
56-
README Format
57-
Tcl Format
58-
Man pages Test Framework
59-
Code of Conduct
60-
FAQs
61-
62-
Your response must be in this exact JSON format:
63-
{
64-
"questions": [
65-
"",
66-
"",
67-
""
68-
]
69-
}
70-
The first character should be '{' and the last character should be '}'. Do not include any additional text or formatting.`;
71-
7222
try {
73-
const response = await fetch(
74-
`https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=${process.env.GEMINI_API_KEY}`,
75-
{
76-
method: 'POST',
77-
headers: {
78-
'Content-Type': 'application/json',
79-
},
80-
body: JSON.stringify({
81-
contents: [
82-
{
83-
parts: [
84-
{
85-
text: `${prompt}\n\nUser Question: ${latestQuestion}\n\nAssistant Answer: ${assistantAnswer}`,
86-
},
87-
],
88-
},
89-
],
90-
}),
91-
}
92-
);
23+
const response = await fetch('http://localhost:3000/api/suggestedQuestions', {
24+
method: 'POST',
25+
headers: {
26+
'Content-Type': 'application/json',
27+
},
28+
body: JSON.stringify({
29+
latestQuestion,
30+
assistantAnswer,
31+
}),
32+
});
9333

9434
const data = await response.json();
9535
const suggestedQuestionsText = data.candidates[0].content.parts[0].text;

0 commit comments

Comments
 (0)