Move Web client config page to /configure from /config url path

Update docs, clients and error messages to point to /configure
instead of /config
This commit is contained in:
Debanjum Singh Solanky
2024-07-16 15:33:19 +05:30
parent de15a7a3fc
commit a5c16ad600
25 changed files with 39 additions and 40 deletions

View File

@@ -253,7 +253,7 @@ function pushDataToKhoj (regenerate = false) {
console.error(error);
state["completed"] = false;
if (error?.response?.status === 429 && (BrowserWindow.getAllWindows().find(win => win.webContents.getURL().includes('config')))) {
state["error"] = `Looks like you're out of space to sync your files. <a href="https://app.khoj.dev/config">Upgrade your plan</a> to unlock more space.`;
state["error"] = `Looks like you're out of space to sync your files. <a href="https://app.khoj.dev/configure">Upgrade your plan</a> to unlock more space.`;
const win = BrowserWindow.getAllWindows().find(win => win.webContents.getURL().includes('config'));
if (win) win.webContents.send('needsSubscription', true);
} else if (error?.code === 'ECONNREFUSED') {

View File

@@ -182,7 +182,7 @@ window.updateStateAPI.onUpdateState((event, state) => {
window.needsSubscriptionAPI.onNeedsSubscription((event, needsSubscription) => {
console.log("needs subscription", needsSubscription);
if (needsSubscription) {
window.alert("Looks like you're out of space to sync your files. Upgrade your plan to unlock more space here: https://app.khoj.dev/config");
window.alert("Looks like you're out of space to sync your files. Upgrade your plan to unlock more space here: https://app.khoj.dev/configure");
needsSubscriptionElement.style.display = 'block';
}
});

View File

@@ -99,7 +99,7 @@
:type 'boolean)
(defcustom khoj-api-key nil
"API Key to your Khoj. Default at https://app.khoj.dev/config#clients."
"API Key to your Khoj. Default at https://app.khoj.dev/configure#clients."
:group 'khoj
:type 'string)

View File

@@ -201,12 +201,12 @@ export function getBackendStatusMessage(
): string {
// Welcome message with default settings. Khoj cloud always expects an API key.
if (!khojApiKey && khojUrl === 'https://app.khoj.dev')
return `🌈 Welcome to Khoj! Get your API key from ${khojUrl}/config#clients and set it in the Khoj plugin settings on Obsidian`;
return `🌈 Welcome to Khoj! Get your API key from ${khojUrl}/configure#clients and set it in the Khoj plugin settings on Obsidian`;
if (!connectedToServer)
return `Could not connect to Khoj at ${khojUrl}. Ensure your can access it`;
else if (!userEmail)
return `✅ Connected to Khoj. ❗Get a valid API key from ${khojUrl}/config#clients to log in`;
return `✅ Connected to Khoj. ❗Get a valid API key from ${khojUrl}/configure#clients to log in`;
else if (userEmail === 'default@example.com')
// Logged in as default user in anonymous mode
return `✅ Signed in to Khoj`;

View File

@@ -128,7 +128,7 @@ export default function NavMenu(props: NavMenuProps) {
<DropdownMenuSeparator />
<DropdownMenuLabel>Profile</DropdownMenuLabel>
<DropdownMenuItem>
<Link href="/config">Settings</Link>
<Link href="/configure">Configure</Link>
</DropdownMenuItem>
<DropdownMenuItem>
<Link href="https://docs.khoj.dev">Help</Link>
@@ -172,8 +172,8 @@ export default function NavMenu(props: NavMenuProps) {
{userData &&
<>
<MenubarItem>
<Link href="/config">
Settings
<Link href="/configure">
Configure
</Link>
</MenubarItem>
<MenubarSeparator />

View File

@@ -604,7 +604,7 @@ function UserProfileComponent(props: UserProfileProps) {
return (
<div className={styles.profile}>
<Link href="/config" target="_blank" rel="noopener noreferrer">
<Link href="/configure" target="_blank" rel="noopener noreferrer">
<Avatar>
<AvatarImage src={props.userProfile.photo} alt="user profile" />
<AvatarFallback>

View File

@@ -533,7 +533,7 @@ export default function FactChecker() {
<Button disabled={clickedVerify} onClick={() => onClickVerify()}>Verify</Button>
</div>
<h3 className={`mt-4 mb-4`}>
Try with a particular model. You must be <a href="/config" className="font-medium text-blue-600 dark:text-blue-500 hover:underline">subscribed</a> to configure the model.
Try with a particular model. You must be <a href="/configure" className="font-medium text-blue-600 dark:text-blue-500 hover:underline">subscribed</a> to configure the model.
</h3>
</div>
}

View File

@@ -44,7 +44,7 @@ Hi, I am Khoj, your open, personal AI 👋🏽. I can:
- 📚 Understand files you drag & drop here
- 👩🏾‍🚀 Be tuned to your conversation needs via [agents](./agents)
Get the Khoj [Desktop](https://khoj.dev/downloads), [Obsidian](https://docs.khoj.dev/clients/obsidian#setup), [Emacs](https://docs.khoj.dev/clients/emacs#setup) apps to search, chat with your 🖥️ computer docs. You can manage all the files you've shared with me at any time by going to [your settings](/config/content-source/computer/).
Get the Khoj [Desktop](https://khoj.dev/downloads), [Obsidian](https://docs.khoj.dev/clients/obsidian#setup), [Emacs](https://docs.khoj.dev/clients/emacs#setup) apps to search, chat with your 🖥️ computer docs. You can manage all the files you've shared with me at any time by going to [your settings](/configure/content/computer/).
To get started, just start typing below. You can also type / to see a list of commands.
`.trim()
@@ -1333,7 +1333,7 @@ To get started, just start typing below. You can also type / to see a list of co
- 📚 Understand files you drag & drop here
- 👩🏾‍🚀 Be tuned to your conversation needs via [agents](./agents)
Get the Khoj [Desktop](https://khoj.dev/downloads), [Obsidian](https://docs.khoj.dev/clients/obsidian#setup), or [Emacs](https://docs.khoj.dev/clients/emacs#setup) app to keep your files in sync. You can manage all the files you've shared with me at any time by going to [your settings](/config/content-source/computer/).
Get the Khoj [Desktop](https://khoj.dev/downloads), [Obsidian](https://docs.khoj.dev/clients/obsidian#setup), or [Emacs](https://docs.khoj.dev/clients/emacs#setup) app to keep your files in sync. You can manage all the files you've shared with me at any time by going to [your settings](/configure/content/computer/).
To get started, just start typing below. You can also type / to see a list of commands.

View File

@@ -44,7 +44,7 @@
<p class="card-description">Manage files from your computer</p>
</div>
<div class="card-action-row">
<a class="card-button" href="/config/content-source/computer">
<a class="card-button" href="/configure/content/computer">
{% if current_model_state.computer %}
Update
{% else %}
@@ -76,7 +76,7 @@
<p class="card-description">Set repositories to index</p>
</div>
<div class="card-action-row">
<a class="card-button" href="/config/content-source/github">
<a class="card-button" href="/configure/content/github">
{% if current_model_state.github %}
Update
{% else %}
@@ -110,7 +110,7 @@
</div>
<div class="card-action-row">
{% if current_model_state.notion %}
<a class="card-button" href="/config/content-source/notion">
<a class="card-button" href="/configure/content/notion">
Update
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"></path></svg>
</a>
@@ -120,7 +120,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"></path></svg>
</a>
{% else %}
<a class="card-button" href="/config/content-source/notion">
<a class="card-button" href="/configure/content/notion">
Setup
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"></path></svg>
</a>

View File

@@ -34,7 +34,7 @@ Hi, I am Khoj, your open, personal AI 👋🏽. I can:
- 📚 Understand files you drag & drop here
- 👩🏾‍🚀 Be tuned to your conversation needs via [agents](./agents)
Get the Khoj [Desktop](https://khoj.dev/downloads), [Obsidian](https://docs.khoj.dev/clients/obsidian#setup), [Emacs](https://docs.khoj.dev/clients/emacs#setup) apps to search, chat with your 🖥️ computer docs. You can manage all the files you've shared with me at any time by going to [your settings](/config/content-source/computer/).
Get the Khoj [Desktop](https://khoj.dev/downloads), [Obsidian](https://docs.khoj.dev/clients/obsidian#setup), [Emacs](https://docs.khoj.dev/clients/emacs#setup) apps to search, chat with your 🖥️ computer docs. You can manage all the files you've shared with me at any time by going to [your settings](/configure/content/computer/).
To get started, just start typing below. You can also type / to see a list of commands.
`.trim()

View File

@@ -214,7 +214,7 @@
.then(enabled_types => {
// Show warning if no content types are enabled, or just one ("all")
if (enabled_types[0] === "all" && enabled_types.length === 1) {
document.getElementById("results").innerHTML = "<div id='results-error'>To use Khoj search, setup your content plugins on the Khoj <a class='inline-chat-link' href='/config'>settings page</a>.</div>";
document.getElementById("results").innerHTML = "<div id='results-error'>To use Khoj search, setup your content plugins on the Khoj <a class='inline-chat-link' href='/configure'>settings page</a>.</div>";
document.getElementById("query").setAttribute("disabled", "disabled");
document.getElementById("query").setAttribute("placeholder", "Configure Khoj to enable search");
return [];

View File

@@ -36,7 +36,7 @@
{% endif %}
<div id="khoj-nav-menu" class="khoj-nav-dropdown-content">
<div class="khoj-nav-username"> {{ username }} </div>
<a id="settings-nav" class="khoj-nav" href="/config">Settings</a>
<a id="settings-nav" class="khoj-nav" href="/configure">Settings</a>
<a id="github-nav" class="khoj-nav" href="https://github.com/khoj-ai/khoj">GitHub</a>
<a id="help-nav" class="khoj-nav" href="https://docs.khoj.dev" target="_blank">Help</a>
<a class="khoj-nav" href="/auth/logout">Logout</a>

View File

@@ -6,7 +6,6 @@ import os
import threading
import time
import uuid
from random import random
from typing import Any, Callable, List, Optional, Union
import cron_descriptor
@@ -190,7 +189,7 @@ def update(
):
user = request.user.object
if not state.config:
error_msg = f"🚨 Khoj is not configured.\nConfigure it via http://localhost:42110/config, plugins or by editing {state.config_file}."
error_msg = f"🚨 Khoj is not configured.\nConfigure it via http://localhost:42110/configure, plugins or by editing {state.config_file}."
logger.warning(error_msg)
raise HTTPException(status_code=500, detail=error_msg)
try:

View File

@@ -920,7 +920,7 @@ class ApiUserRateLimiter:
)
raise HTTPException(
status_code=429,
detail="We're glad you're enjoying Khoj! You've exceeded your usage limit for today. Come back tomorrow or subscribe to increase your usage limit via [your settings](https://app.khoj.dev/config).",
detail="We're glad you're enjoying Khoj! You've exceeded your usage limit for today. Come back tomorrow or subscribe to increase your usage limit via [your settings](https://app.khoj.dev/configure).",
)
# Add the current request to the cache
@@ -959,7 +959,7 @@ class ConversationCommandRateLimiter:
if not subscribed and count_requests >= self.trial_rate_limit:
raise HTTPException(
status_code=429,
detail=f"We're glad you're enjoying Khoj! You've exceeded your `/{conversation_command.value}` command usage limit for today. Subscribe to increase your usage limit via [your settings](https://app.khoj.dev/config).",
detail=f"We're glad you're enjoying Khoj! You've exceeded your `/{conversation_command.value}` command usage limit for today. Subscribe to increase your usage limit via [your settings](https://app.khoj.dev/configure).",
)
await UserRequests.objects.acreate(user=user, slug=command_slug)
return

View File

@@ -138,7 +138,7 @@ def agent_page(request: Request, agent_slug: str):
return templates.TemplateResponse("agent.html", context=user_config)
@web_client.get("/config", response_class=HTMLResponse)
@web_client.get("/configure", response_class=HTMLResponse)
@requires(["authenticated"], redirect="login_page")
def config_page(request: Request):
user: KhojUser = request.user.object
@@ -147,7 +147,7 @@ def config_page(request: Request):
return templates.TemplateResponse("config.html", context=user_config)
@web_client.get("/config/content-source/github", response_class=HTMLResponse)
@web_client.get("/configure/content/github", response_class=HTMLResponse)
@requires(["authenticated"], redirect="login_page")
def github_config_page(request: Request):
user = request.user.object
@@ -177,7 +177,7 @@ def github_config_page(request: Request):
return templates.TemplateResponse("content_source_github_input.html", context=user_config)
@web_client.get("/config/content-source/notion", response_class=HTMLResponse)
@web_client.get("/configure/content/notion", response_class=HTMLResponse)
@requires(["authenticated"], redirect="login_page")
def notion_config_page(request: Request):
user = request.user.object
@@ -192,7 +192,7 @@ def notion_config_page(request: Request):
return templates.TemplateResponse("content_source_notion_input.html", context=user_config)
@web_client.get("/config/content-source/computer", response_class=HTMLResponse)
@web_client.get("/configure/content/computer", response_class=HTMLResponse)
@requires(["authenticated"], redirect="login_page")
def computer_config_page(request: Request):
user = request.user.object if request.user.is_authenticated else None