Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ HEADERS = {
|
|
| 14 |
}
|
| 15 |
|
| 16 |
# --- Core API Functions ---
|
| 17 |
-
def query_rag_system(query: str, max_cards: int =
|
| 18 |
"""Query the RAG system with a historical question."""
|
| 19 |
try:
|
| 20 |
payload = {"query": query, "max_cards": max_cards, "include_sources": True}
|
|
@@ -23,7 +23,7 @@ def query_rag_system(query: str, max_cards: int = 5) -> dict:
|
|
| 23 |
except Exception as e:
|
| 24 |
return {"error": str(e)}
|
| 25 |
|
| 26 |
-
def search_cards_semantic(query: str, max_cards: int =
|
| 27 |
"""Perform semantic search on cards."""
|
| 28 |
try:
|
| 29 |
payload = {"query": query, "max_cards": max_cards}
|
|
@@ -96,7 +96,7 @@ def chatbot_respond(message: str, history: List[Tuple[str, str]], search_mode: b
|
|
| 96 |
return "", history
|
| 97 |
|
| 98 |
# Determine max cards based on query complexity
|
| 99 |
-
max_cards =
|
| 100 |
|
| 101 |
if search_mode:
|
| 102 |
# Use semantic search for browsing/exploring
|
|
|
|
| 14 |
}
|
| 15 |
|
| 16 |
# --- Core API Functions ---
|
| 17 |
+
def query_rag_system(query: str, max_cards: int = 10) -> dict:
|
| 18 |
"""Query the RAG system with a historical question."""
|
| 19 |
try:
|
| 20 |
payload = {"query": query, "max_cards": max_cards, "include_sources": True}
|
|
|
|
| 23 |
except Exception as e:
|
| 24 |
return {"error": str(e)}
|
| 25 |
|
| 26 |
+
def search_cards_semantic(query: str, max_cards: int = 10) -> dict:
|
| 27 |
"""Perform semantic search on cards."""
|
| 28 |
try:
|
| 29 |
payload = {"query": query, "max_cards": max_cards}
|
|
|
|
| 96 |
return "", history
|
| 97 |
|
| 98 |
# Determine max cards based on query complexity
|
| 99 |
+
max_cards = 10 if len(message.split()) < 5 else 10
|
| 100 |
|
| 101 |
if search_mode:
|
| 102 |
# Use semantic search for browsing/exploring
|