mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Resolve diffs in api.py to make /chat endpoint async with new request parameter
This commit is contained in:
6
src/khoj/interface/web/assets/org.min.js
vendored
6
src/khoj/interface/web/assets/org.min.js
vendored
@@ -614,8 +614,10 @@ var Org = (function () {
|
||||
var notBlankNextToken = this.lexer.peekNextToken();
|
||||
if (blankToken && !notBlankNextToken.isListElement())
|
||||
this.lexer.pushToken(blankToken); // Recover blank token only when next line is not listElement.
|
||||
if (notBlankNextToken.indentation <= rootIndentation)
|
||||
break; // end of the list
|
||||
// End of the list if hit less indented line or end of directive
|
||||
if (notBlankNextToken.indentation <= rootIndentation ||
|
||||
(notBlankNextToken.type === Lexer.tokens.directive && notBlankNextToken.endDirective))
|
||||
break;
|
||||
|
||||
var element = this.parseElement(); // recursive
|
||||
if (element)
|
||||
|
||||
@@ -414,6 +414,10 @@
|
||||
border: 1px solid rgb(229, 229, 229);
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -152,7 +152,10 @@ class GithubToJsonl(TextToJsonl):
|
||||
content = ""
|
||||
for chunk in response.iter_content(chunk_size=2048):
|
||||
if chunk:
|
||||
content += chunk.decode("utf-8")
|
||||
try:
|
||||
content += chunk.decode("utf-8")
|
||||
except Exception as e:
|
||||
logger.error(f"Unable to decode chunk from {file_url}")
|
||||
|
||||
return content
|
||||
|
||||
|
||||
@@ -393,7 +393,7 @@ def update(
|
||||
|
||||
|
||||
@api.get("/chat")
|
||||
def chat(
|
||||
async def chat(
|
||||
request: Request,
|
||||
q: Optional[str] = None,
|
||||
client: Optional[str] = None,
|
||||
@@ -436,7 +436,9 @@ def chat(
|
||||
with timer("Searching knowledge base took", logger):
|
||||
result_list = []
|
||||
for query in inferred_queries:
|
||||
result_list.extend(search(query, n=5, r=True, score_threshold=-5.0, dedupe=False))
|
||||
result_list.extend(
|
||||
await search(query, request=request, n=5, r=True, score_threshold=-5.0, dedupe=False)
|
||||
)
|
||||
compiled_references = [item.additional["compiled"] for item in result_list]
|
||||
|
||||
# Switch to general conversation type if no relevant notes found for the given query
|
||||
|
||||
Reference in New Issue
Block a user