Update app.py
Browse files
app.py
CHANGED
|
@@ -94,10 +94,11 @@ async def generate_query(request: QueryRequest):
|
|
| 94 |
if not is_valid:
|
| 95 |
raise HTTPException(status_code=400, detail="La query generata non è valida rispetto al file RDF fornito.")
|
| 96 |
|
| 97 |
-
|
| 98 |
-
explanation
|
|
|
|
| 99 |
|
| 100 |
-
return {"query": response.replace("
|
| 101 |
|
| 102 |
# Endpoint per verificare se il server è attivo
|
| 103 |
@app.get("/")
|
|
|
|
| 94 |
if not is_valid:
|
| 95 |
raise HTTPException(status_code=400, detail="La query generata non è valida rispetto al file RDF fornito.")
|
| 96 |
|
| 97 |
+
# Correzione f-string: usiamo `.replace()` in modo sicuro
|
| 98 |
+
explanation = f"La query generata è: {response.replace('\\n', ' ').strip()}. "
|
| 99 |
+
explanation += "Questa query è stata progettata per estrarre informazioni specifiche dai dati RDF, consentendo di rispondere alla tua domanda. Risultati ottenuti da questa query possono includere dettagli come entità, relazioni o attributi collegati al contesto fornito."
|
| 100 |
|
| 101 |
+
return {"query": response.replace("\\n", " ").strip(), "explanation": explanation}
|
| 102 |
|
| 103 |
# Endpoint per verificare se il server è attivo
|
| 104 |
@app.get("/")
|