Spaces:
Sleeping
Sleeping
Commit
·
2b24b35
1
Parent(s):
8be84bc
Finito
Browse files
backend/main.py
CHANGED
@@ -691,10 +691,10 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
|
|
691 |
prompt = PromptTemplate.from_template(
|
692 |
f"{settings.assistant_role}\n\n"
|
693 |
"{context}\n"
|
694 |
-
"Now answer the user
|
695 |
"Question: {question}\n"
|
696 |
"Your answer should: \n"
|
697 |
-
"1. Be at least **4
|
698 |
"2. Explain concepts clearly in full sentences \n"
|
699 |
"3. Cite any document you draw on by including its ID in [brackets] inline \n"
|
700 |
"4. Provide any high-level conclusions or recommendations at the end \n"
|
@@ -773,8 +773,10 @@ async def ask_rag(
|
|
773 |
req: RAGRequest,
|
774 |
rag_chain = Depends(rag_chain_depender)
|
775 |
):
|
|
|
776 |
try:
|
777 |
result = await rag_chain.ainvoke({"question": req.query})
|
|
|
778 |
if not isinstance(result, dict):
|
779 |
result2 = await rag_chain.acall({"question": req.query})
|
780 |
raise ValueError(f"Expected dict from chain, got {type(result)} and acall(): {result2} with type {type(result2)}")
|
@@ -941,7 +943,7 @@ def get_stats(request: Request):
|
|
941 |
@app.get("/api/project/{project_id}/organizations")
|
942 |
def get_project_organizations(project_id: str):
|
943 |
df = app.state.df
|
944 |
-
sel = df.filter(pl.col("id")==project_id)
|
945 |
if sel.is_empty():
|
946 |
raise HTTPException(status_code=404, detail="Project not found")
|
947 |
|
|
|
691 |
prompt = PromptTemplate.from_template(
|
692 |
f"{settings.assistant_role}\n\n"
|
693 |
"{context}\n"
|
694 |
+
"Now answer the user's question thoroughly:"
|
695 |
"Question: {question}\n"
|
696 |
"Your answer should: \n"
|
697 |
+
"1. Be at least **4-6 sentences** long \n"
|
698 |
"2. Explain concepts clearly in full sentences \n"
|
699 |
"3. Cite any document you draw on by including its ID in [brackets] inline \n"
|
700 |
"4. Provide any high-level conclusions or recommendations at the end \n"
|
|
|
773 |
req: RAGRequest,
|
774 |
rag_chain = Depends(rag_chain_depender)
|
775 |
):
|
776 |
+
logger.info("Starting to answer")
|
777 |
try:
|
778 |
result = await rag_chain.ainvoke({"question": req.query})
|
779 |
+
logger.info("Results retrieved")
|
780 |
if not isinstance(result, dict):
|
781 |
result2 = await rag_chain.acall({"question": req.query})
|
782 |
raise ValueError(f"Expected dict from chain, got {type(result)} and acall(): {result2} with type {type(result2)}")
|
|
|
943 |
@app.get("/api/project/{project_id}/organizations")
|
944 |
def get_project_organizations(project_id: str):
|
945 |
df = app.state.df
|
946 |
+
sel = df.filter(pl.col("id")==int(project_id))
|
947 |
if sel.is_empty():
|
948 |
raise HTTPException(status_code=404, detail="Project not found")
|
949 |
|
frontend/src/components/ProjectExplorer.tsx
CHANGED
@@ -298,7 +298,7 @@ const ProjectExplorer: React.FC<ProjectExplorerProps> = ({
|
|
298 |
</Box>
|
299 |
<HStack>
|
300 |
<Input
|
301 |
-
placeholder="Ask something
|
302 |
value={question}
|
303 |
onChange={(e) => setQuestion(e.target.value)}
|
304 |
onKeyDown={(e) => {
|
@@ -308,13 +308,17 @@ const ProjectExplorer: React.FC<ProjectExplorerProps> = ({
|
|
308 |
}
|
309 |
}}
|
310 |
isDisabled={loading}
|
|
|
311 |
/>
|
312 |
<Button
|
313 |
onClick={askChatbot}
|
314 |
colorScheme="blue"
|
315 |
aria-label="Ask the chatbot"
|
316 |
isLoading={loading}
|
317 |
-
loadingText="Waiting
|
|
|
|
|
|
|
318 |
>
|
319 |
Send
|
320 |
</Button>
|
|
|
298 |
</Box>
|
299 |
<HStack>
|
300 |
<Input
|
301 |
+
placeholder="Ask something…"
|
302 |
value={question}
|
303 |
onChange={(e) => setQuestion(e.target.value)}
|
304 |
onKeyDown={(e) => {
|
|
|
308 |
}
|
309 |
}}
|
310 |
isDisabled={loading}
|
311 |
+
size="md" // ← make the input a touch taller
|
312 |
/>
|
313 |
<Button
|
314 |
onClick={askChatbot}
|
315 |
colorScheme="blue"
|
316 |
aria-label="Ask the chatbot"
|
317 |
isLoading={loading}
|
318 |
+
loadingText="Waiting…"
|
319 |
+
size="md"
|
320 |
+
px={6}
|
321 |
+
py={4}
|
322 |
>
|
323 |
Send
|
324 |
</Button>
|