base things
This commit is contained in:
parent
74dedda7f5
commit
e4d947ca0a
|
@ -0,0 +1,13 @@
|
|||
from qdrant_client import QdrantClient
|
||||
|
||||
from code_search.config import QDRANT_URL, QDRANT_API_KEY
|
||||
|
||||
|
||||
class CodeSearcher:
|
||||
|
||||
def __init__(self, collection_name):
|
||||
self.collection_name = collection_name
|
||||
self.client = QdrantClient(url=QDRANT_URL, api_key=QDRANT_API_KEY)
|
||||
|
||||
def search(self, query, limit=10):
|
||||
pass
|
|
@ -1,5 +0,0 @@
|
|||
import os
|
||||
|
||||
CODE_DIR = os.path.dirname(__file__)
|
||||
ROOT_DIR = os.path.dirname(CODE_DIR)
|
||||
DATA_DIR = os.path.join(ROOT_DIR, "data")
|
|
@ -1,22 +0,0 @@
|
|||
import os
|
||||
|
||||
from fastapi import FastAPI
|
||||
from starlette.staticfiles import StaticFiles
|
||||
|
||||
from demo_template.config import ROOT_DIR
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/api/predict")
|
||||
async def predict(query: str):
|
||||
return {
|
||||
"result": query
|
||||
}
|
||||
|
||||
app.mount("/", StaticFiles(directory=os.path.join(ROOT_DIR, 'frontend', 'dist', 'spa'), html=True))
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
@ -1,6 +1,12 @@
|
|||
<template>
|
||||
<q-page>
|
||||
<div class="q-pa-md q-col-gutter-sm items-stretch">
|
||||
<div class="row justify-evenly">
|
||||
<div class="col-8">
|
||||
<h2>Source Code Search</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row justify-evenly">
|
||||
<div class="col-10 simple-typeahead">
|
||||
<q-input outlined v-model="query" placeholder="Search" color="black" :input-style="{ fontSize: '16pt' }"
|
||||
|
@ -82,7 +88,7 @@ export default defineComponent({
|
|||
|
||||
data: () => ({
|
||||
query: "",
|
||||
results: fakeData,
|
||||
results: [],
|
||||
showResults: false,
|
||||
}),
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ torch = "^1.13.1"
|
|||
transformers = "^4.26.1"
|
||||
qdrant-client = "^1.0.1"
|
||||
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[build-system]
|
||||
|
|
Loading…
Reference in New Issue