mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 13:18:18 +00:00
Fix escape sequence usage in strings. Remove unneeded import of os
Rename /config API method to config to match it's purpose. UI is anyway too generic, and not what it is doing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Standard Packages
|
||||
import sys, json, yaml, os
|
||||
import sys, json, yaml
|
||||
import time
|
||||
from typing import Optional
|
||||
from pathlib import Path
|
||||
@@ -38,12 +38,14 @@ web_directory = this_directory / 'interface/web/'
|
||||
app.mount("/static", StaticFiles(directory=web_directory), name="static")
|
||||
templates = Jinja2Templates(directory=web_directory)
|
||||
|
||||
|
||||
# Controllers
|
||||
@app.get("/", response_class=FileResponse)
|
||||
def index():
|
||||
return FileResponse(web_directory / "index.html")
|
||||
|
||||
@app.get('/config', response_class=HTMLResponse)
|
||||
def ui(request: Request):
|
||||
def config(request: Request):
|
||||
return templates.TemplateResponse("config.html", context={'request': request})
|
||||
|
||||
@app.get('/config/data', response_model=FullConfig)
|
||||
|
||||
@@ -194,7 +194,7 @@ def makelist(filename):
|
||||
n.setHeading(prtysrch.group(2))
|
||||
|
||||
# Set SOURCE property to a file+heading based org-mode link to the entry
|
||||
escaped_heading = n.Heading().replace("[","\[").replace("]","\]")
|
||||
escaped_heading = n.Heading().replace("[","\\[").replace("]","\\]")
|
||||
n.properties['SOURCE'] = f'[[file:{normalize_filename(filename)}::*{escaped_heading}]]'
|
||||
|
||||
return nodelist
|
||||
|
||||
@@ -32,7 +32,7 @@ class DateFilter:
|
||||
return query, entries, embeddings
|
||||
|
||||
# remove date range filter from query
|
||||
query = re.sub(f'\s+{self.date_regex}', ' ', query)
|
||||
query = re.sub(rf'\s+{self.date_regex}', ' ', query)
|
||||
query = re.sub(r'\s{2,}', ' ', query).strip() # remove multiple spaces
|
||||
|
||||
# find entries containing any dates that fall with date range specified in query
|
||||
|
||||
Reference in New Issue
Block a user