mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 21:29:13 +00:00
Include interfaces in pip package. Fix paths to web interface in app
This commit is contained in:
3
setup.py
3
setup.py
@@ -7,7 +7,7 @@ this_directory = Path(__file__).parent
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='khoj-assistant',
|
name='khoj-assistant',
|
||||||
version='0.1',
|
version='0.1.3',
|
||||||
description="A natural language search engine for your personal notes, transactions and images",
|
description="A natural language search engine for your personal notes, transactions and images",
|
||||||
long_description=(this_directory / "Readme.md").read_text(encoding="utf-8"),
|
long_description=(this_directory / "Readme.md").read_text(encoding="utf-8"),
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
@@ -40,6 +40,7 @@ setup(
|
|||||||
"aiofiles == 0.8.0",
|
"aiofiles == 0.8.0",
|
||||||
"dateparser == 1.1.1",
|
"dateparser == 1.1.1",
|
||||||
],
|
],
|
||||||
|
include_package_data=True,
|
||||||
entry_points={"console_scripts": ["khoj = src.main:run"]},
|
entry_points={"console_scripts": ["khoj = src.main:run"]},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import sys, json, yaml, os
|
import sys, json, yaml, os
|
||||||
import time
|
import time
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# External Packages
|
# External Packages
|
||||||
import uvicorn
|
import uvicorn
|
||||||
@@ -31,14 +32,15 @@ processor_config = ProcessorConfigModel()
|
|||||||
config_file = ""
|
config_file = ""
|
||||||
verbose = 0
|
verbose = 0
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
web_directory = f'src/interface/web/'
|
this_directory = Path(__file__).parent
|
||||||
|
web_directory = this_directory / 'interface/web/'
|
||||||
|
|
||||||
app.mount("/static", StaticFiles(directory=web_directory), name="static")
|
app.mount("/static", StaticFiles(directory=web_directory), name="static")
|
||||||
templates = Jinja2Templates(directory=web_directory)
|
templates = Jinja2Templates(directory=web_directory)
|
||||||
|
|
||||||
@app.get("/", response_class=FileResponse)
|
@app.get("/", response_class=FileResponse)
|
||||||
def index():
|
def index():
|
||||||
return FileResponse(web_directory + "index.html")
|
return FileResponse(web_directory / "index.html")
|
||||||
|
|
||||||
@app.get('/config', response_class=HTMLResponse)
|
@app.get('/config', response_class=HTMLResponse)
|
||||||
def ui(request: Request):
|
def ui(request: Request):
|
||||||
@@ -116,7 +118,7 @@ def search(q: str, n: Optional[int] = 5, t: Optional[SearchType] = None, r: Opti
|
|||||||
# query images
|
# query images
|
||||||
query_start = time.time()
|
query_start = time.time()
|
||||||
hits = image_search.query(user_query, results_count, model.image_search)
|
hits = image_search.query(user_query, results_count, model.image_search)
|
||||||
output_directory = f'{os.getcwd()}/{web_directory}/images'
|
output_directory = web_directory / 'images'
|
||||||
query_end = time.time()
|
query_end = time.time()
|
||||||
|
|
||||||
# collate and return results
|
# collate and return results
|
||||||
|
|||||||
Reference in New Issue
Block a user