mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 13:19:16 +00:00
Merge branch 'master' of github.com:khoj-ai/khoj into parallelize-search-across-all-asymmetric-text-content-types
Conflicts: - src/khoj/routers/api.py: Use theirs
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0">
|
||||
<title>Khoj</title>
|
||||
<title>Khoj - Search</title>
|
||||
|
||||
<link rel="icon" type="image/png" sizes="128x128" href="/static/assets/icons/favicon-128x128.png">
|
||||
<link rel="manifest" href="/static/khoj.webmanifest">
|
||||
<link rel="stylesheet" href="/static/assets/khoj.css">
|
||||
</head>
|
||||
<script type="text/javascript" src="static/assets/org.min.js"></script>
|
||||
<script type="text/javascript" src="static/assets/markdown-it.min.js"></script>
|
||||
<script type="text/javascript" src="/static/assets/org.min.js"></script>
|
||||
<script type="text/javascript" src="/static/assets/markdown-it.min.js"></script>
|
||||
|
||||
<script>
|
||||
function render_image(item) {
|
||||
@@ -56,6 +57,27 @@
|
||||
}).join("\n") + `</div>`;
|
||||
}
|
||||
|
||||
function render_mutliple(query, data, type) {
|
||||
let org_files = data.filter((item) => item.additional.file.endsWith(".org"));
|
||||
let md_files = data.filter((item) => item.additional.file.endsWith(".md"));
|
||||
let pdf_files = data.filter((item) => item.additional.file.endsWith(".pdf"));
|
||||
|
||||
let html = "";
|
||||
if (org_files.length > 0) {
|
||||
html += render_org(query, org_files, type);
|
||||
}
|
||||
|
||||
if (md_files.length > 0) {
|
||||
html += render_markdown(query, md_files);
|
||||
}
|
||||
|
||||
if (pdf_files.length > 0) {
|
||||
html += render_pdf(query, pdf_files);
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function render_json(data, query, type) {
|
||||
if (type === "markdown") {
|
||||
return render_markdown(query, data);
|
||||
@@ -70,7 +92,7 @@
|
||||
} else if (type === "pdf") {
|
||||
return render_pdf(query, data);
|
||||
} else if (type == "github") {
|
||||
return render_markdown(query, data);
|
||||
return render_mutliple(query, data, type);
|
||||
} else {
|
||||
return `<div id="results-plugin">`
|
||||
+ data.map((item) => `<p>${item.entry}</p>`).join("\n")
|
||||
@@ -197,7 +219,15 @@
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<h1>Khoj</h1>
|
||||
<!--Add Header Logo and Nav Pane-->
|
||||
<div class="khoj-header">
|
||||
<img class="khoj-logo" src="/static/assets/icons/khoj-logo-sideways.svg" alt="Khoj"></img>
|
||||
<nav class="khoj-nav">
|
||||
<a href="/chat">Chat</a>
|
||||
<a class="khoj-nav-selected" href="/">Search</a>
|
||||
<a href="/config">Settings</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<!--Add Text Box To Enter Query, Trigger Incremental Search OnChange -->
|
||||
<input type="text" id="query" class="option" onkeyup=incrementalSearch(event) autofocus="autofocus" placeholder="What is the meaning of life?">
|
||||
@@ -211,7 +241,7 @@
|
||||
|
||||
<!--Add Results Count Input To Set Results Count -->
|
||||
<input type="number" id="results-count" min="1" max="100" value="6" placeholder="results count" onchange="setCountFieldInUrl(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Section to Render Results -->
|
||||
<div id="results"></div>
|
||||
@@ -222,7 +252,7 @@
|
||||
body {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: 1fr 1fr 1fr minmax(80px, 100%);
|
||||
grid-template-rows: 1fr auto auto minmax(80px, 100%);
|
||||
}
|
||||
body > * {
|
||||
grid-column: 1;
|
||||
@@ -232,14 +262,13 @@
|
||||
body {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr min(70vw, 100%) 1fr;
|
||||
grid-template-rows: 1fr 1fr 1fr minmax(80px, 100%);
|
||||
grid-template-rows: 1fr auto auto minmax(80px, 100%);
|
||||
padding-top: 60vw;
|
||||
}
|
||||
body > * {
|
||||
grid-column: 2;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
@@ -255,11 +284,6 @@
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
}
|
||||
h1 {
|
||||
font-weight: 200;
|
||||
color: #017eff;
|
||||
}
|
||||
|
||||
#options {
|
||||
padding: 0;
|
||||
display: grid;
|
||||
@@ -310,7 +334,7 @@
|
||||
text-align: left;
|
||||
white-space: pre-line;
|
||||
}
|
||||
#results-markdown, #results-github {
|
||||
#results-markdown, #results-github {
|
||||
text-align: left;
|
||||
}
|
||||
#results-music,
|
||||
@@ -350,6 +374,11 @@
|
||||
background-color: #ef4444;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
pre {
|
||||
max-width: 100;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user