mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 05:39:12 +00:00
Add endpoint for regenerating directly from the config page and add music content-type
This commit is contained in:
@@ -7,7 +7,10 @@
|
|||||||
</head>
|
</head>
|
||||||
<body class="khoj-configure">
|
<body class="khoj-configure">
|
||||||
<header>
|
<header>
|
||||||
|
<div>
|
||||||
<h1>Configure Khoj</h1>
|
<h1>Configure Khoj</h1>
|
||||||
|
<p>Check out our <a href="https://github.com/debanjum/khoj">source code on Github</a></p>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h2>Ready?</h2>
|
<h2>Ready?</h2>
|
||||||
<div id="actions">
|
<div id="actions">
|
||||||
@@ -31,5 +34,11 @@
|
|||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
grid-gap: 12px;
|
grid-gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 600px) {
|
||||||
|
header {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -14,11 +14,16 @@
|
|||||||
<button onclick="window.location.href='/config/content_type/ledger';">
|
<button onclick="window.location.href='/config/content_type/ledger';">
|
||||||
Configure Ledger
|
Configure Ledger
|
||||||
</button>
|
</button>
|
||||||
|
<button onclick="window.location.href='/config/content_type/music';">
|
||||||
|
Configure Org Music
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<h2>Processors</h2>
|
<h2>Processors</h2>
|
||||||
<button onclick="window.location.href='/config/processor/conversation/';">
|
<button onclick="window.location.href='/config/processor/conversation/';">
|
||||||
Configure Conversation
|
Configure Conversation
|
||||||
</button>
|
</button>
|
||||||
|
<h1>Finalize</h1>
|
||||||
|
<button id="regenerate" type="submit">Regenerate</button>
|
||||||
<style>
|
<style>
|
||||||
body.khoj-configure {
|
body.khoj-configure {
|
||||||
padding: 0 10%
|
padding: 0 10%
|
||||||
@@ -28,5 +33,39 @@
|
|||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
grid-gap: 12px;
|
grid-gap: 12px;
|
||||||
}
|
}
|
||||||
|
button#regenerate {
|
||||||
|
background-color: #4CAF50;
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
padding: 15px 32px;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<script>
|
||||||
|
var regenerate = document.getElementById("regenerate");
|
||||||
|
regenerate.addEventListener("click", function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
regenerate.disabled = true;
|
||||||
|
regenerate.innerHTML = "Regenerating...";
|
||||||
|
fetch('/api/update?force=true&client=web', {
|
||||||
|
method: 'GET',
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
console.log('Success:', data);
|
||||||
|
alert("Regenerated!");
|
||||||
|
regenerate.disabled = false;
|
||||||
|
regenerate.innerHTML = "Regenerate";
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
alert("Regeneration was not successful. Check debug logs.");
|
||||||
|
regenerate.disabled = false;
|
||||||
|
regenerate.innerHTML = "Regenerate";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ logger = logging.getLogger("khoj")
|
|||||||
web_client = APIRouter()
|
web_client = APIRouter()
|
||||||
templates = Jinja2Templates(directory=constants.web_directory)
|
templates = Jinja2Templates(directory=constants.web_directory)
|
||||||
|
|
||||||
VALID_CONTENT_TYPES = ["org", "ledger", "image", "music", "markdown", "pdf"]
|
VALID_CONTENT_TYPES = ["org", "ledger", "music", "markdown", "pdf"]
|
||||||
|
|
||||||
|
|
||||||
# Create Routes
|
# Create Routes
|
||||||
|
|||||||
Reference in New Issue
Block a user