Skip to content

Commit c441663

Browse files
committed
Merge branch 'master' of github.com:khoj-ai/khoj into features/add-support-for-mermaidjs
2 parents ec02757 + 85c34a5 commit c441663

File tree

22 files changed

+655
-163
lines changed

22 files changed

+655
-163
lines changed

.github/workflows/desktop.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,39 +60,39 @@ jobs:
6060
6161
- name: ⏫ Upload Mac ARM App
6262
if: startsWith(github.ref, 'refs/tags/')
63-
uses: actions/upload-artifact@v3
63+
uses: actions/upload-artifact@v4
6464
with:
6565
if-no-files-found: warn
6666
name: khoj-${{ github.ref_name }}-arm64.dmg
6767
path: src/interface/desktop/khoj-${{ github.ref_name }}-arm64.dmg
6868

6969
- name: ⏫ Upload Mac x64 App
7070
if: startsWith(github.ref, 'refs/tags/')
71-
uses: actions/upload-artifact@v3
71+
uses: actions/upload-artifact@v4
7272
with:
7373
if-no-files-found: warn
7474
name: khoj-${{ github.ref_name }}-x64.dmg
7575
path: src/interface/desktop/khoj-${{ github.ref_name }}-x64.dmg
7676

7777
- name: ⏫ Upload Windows App
7878
if: startsWith(github.ref, 'refs/tags/')
79-
uses: actions/upload-artifact@v3
79+
uses: actions/upload-artifact@v4
8080
with:
8181
if-no-files-found: warn
8282
name: khoj-${{ github.ref_name }}-x64.exe
8383
path: src/interface/desktop/khoj-${{ github.ref_name }}-x64.exe
8484

8585
- name: ⏫ Upload Debian App
8686
if: startsWith(github.ref, 'refs/tags/')
87-
uses: actions/upload-artifact@v3
87+
uses: actions/upload-artifact@v4
8888
with:
8989
if-no-files-found: warn
9090
name: khoj-${{ github.ref_name }}-x64.deb
9191
path: src/interface/desktop/khoj-${{ github.ref_name }}-x64.deb
9292

9393
- name: ⏫ Upload Linux App Image
9494
if: startsWith(github.ref, 'refs/tags/')
95-
uses: actions/upload-artifact@v3
95+
uses: actions/upload-artifact@v4
9696
with:
9797
if-no-files-found: warn
9898
name: khoj-${{ github.ref_name }}-x64.AppImage

.github/workflows/github_pages_deploy.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121
# 👇 Build steps
2222
- name: Set up Node.js
23-
uses: actions/setup-node@v3
23+
uses: actions/setup-node@v4
2424
with:
2525
node-version: 18.x
2626
cache: yarn
@@ -35,12 +35,12 @@ jobs:
3535
yarn build
3636
# 👆 Build steps
3737
- name: Setup Pages
38-
uses: actions/configure-pages@v3
38+
uses: actions/configure-pages@v5
3939
- name: Upload artifact
40-
uses: actions/upload-pages-artifact@v2
40+
uses: actions/upload-pages-artifact@v3
4141
with:
4242
# 👇 Specify build output path
4343
path: documentation/build
4444
- name: Deploy to GitHub Pages
4545
id: deployment
46-
uses: actions/deploy-pages@v2
46+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ jobs:
3535
yarn run build --if-present
3636
3737
- name: ⏫ Upload Obsidian Plugin main.js
38-
uses: actions/upload-artifact@v3
38+
uses: actions/upload-artifact@v4
3939
with:
4040
if-no-files-found: error
4141
name: main.js
4242
path: src/interface/obsidian/main.js
4343

4444
- name: ⏫ Upload Obsidian Plugin manifest.json
45-
uses: actions/upload-artifact@v3
45+
uses: actions/upload-artifact@v4
4646
with:
4747
if-no-files-found: error
4848
name: manifest.json
4949
path: src/interface/obsidian/manifest.json
5050

5151
- name: ⏫ Upload Obsidian Plugin styles.css
52-
uses: actions/upload-artifact@v3
52+
uses: actions/upload-artifact@v4
5353
with:
5454
if-no-files-found: error
5555
name: styles.css

.github/workflows/run_evals.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
134134
- name: Upload Results
135135
if: always() # Upload results even if tests fail
136-
uses: actions/upload-artifact@v3
136+
uses: actions/upload-artifact@v4
137137
with:
138138
name: eval-results-${{ steps.hatch.outputs.version }}-${{ matrix.khoj_mode }}-${{ matrix.dataset }}
139139
path: |

docker-compose.yml

+4-12
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ services:
66
POSTGRES_USER: postgres
77
POSTGRES_PASSWORD: postgres
88
POSTGRES_DB: postgres
9-
networks:
10-
- default
119
volumes:
1210
- khoj_db:/var/lib/postgresql/data/
1311
healthcheck:
@@ -17,14 +15,10 @@ services:
1715
retries: 5
1816
sandbox:
1917
image: ghcr.io/khoj-ai/terrarium:latest
20-
restart: always
21-
networks:
22-
- default
18+
restart: unless-stopped
2319
search:
2420
image: docker.io/searxng/searxng:latest
25-
restart: always
26-
networks:
27-
- default
21+
restart: unless-stopped
2822
volumes:
2923
- khoj_search:/etc/searxng
3024
environment:
@@ -35,7 +29,7 @@ services:
3529
condition: service_healthy
3630
# Use the following line to use the latest version of khoj. Otherwise, it will build from source. Set this to ghcr.io/khoj-ai/khoj-cloud:latest if you want to use the prod image.
3731
image: ghcr.io/khoj-ai/khoj:latest
38-
restart: always
32+
restart: unless-stopped
3933
# Uncomment the following line to build from source. This will take a few minutes. Comment the next two lines out if you want to use the official image.
4034
# build:
4135
# context: .
@@ -45,11 +39,9 @@ services:
4539
# change the port in the args in the build section,
4640
# as well as the port in the command section to match
4741
- "42110:42110"
48-
working_dir: /app
49-
networks:
50-
- default
5142
extra_hosts:
5243
- "host.docker.internal:host-gateway"
44+
working_dir: /app
5345
volumes:
5446
- khoj_config:/root/.khoj/
5547
- khoj_models:/root/.cache/torch/sentence_transformers

documentation/docs/advanced/admin.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ For each AI Model API you [add](http://localhost:42110/server/admin/database/aim
4747
![example configuration for ai model api](/img/example_openai_processor_config.png)
4848

4949
### Search Model Configs
50-
Search models are used to generate vector embeddings of your documents for natural language search and chat. You can choose any [embeddings models on HuggingFace](https://huggingface.co/models?pipeline_tag=sentence-similarity) to try, use for your to create vector embeddings of your documents for natural language search and chat.
50+
Search models are used to generate vector embeddings of your documents for natural language search and chat. You can choose any [embeddings models on HuggingFace](https://huggingface.co/models?pipeline_tag=sentence-similarity) to create vector embeddings of your documents for natural language search and chat.
5151

5252
<img src="/img/example_search_model_admin_settings.png" alt="Example Search Model Settings" style={{width: 500}} />
5353

@@ -64,11 +64,14 @@ Add speech to text models with these settings. Khoj currently only supports whis
6464
### Voice Model Options
6565
Add text to speech models with these settings. Khoj currently supports models from [ElevenLabs](https://elevenlabs.io/).
6666

67+
### Reflective Questions
68+
This is a static list of starter question suggestions for each user. It is not current used in any client app. It used to be shown on the web app home page. We may turn it into a dynamic list of starter questions personalized to each users, say based on their recent conversations or synced knowledge base.
69+
6770
## User Data
6871
- Users, Entrys, Conversations, Subscriptions, Github configs, Notion configs, User search configs, User conversation configs, User voice configs
6972

7073
## Miscellaneous Data
7174
- Process Locks: Persistent Locks for Automations
7275
- Client Applications:
7376

74-
Client applications allow you to setup third party applications that can query your Khoj server using a client application ID + secret. The secret would go in a bearer token.
77+
Client applications allow you to setup third party applications that can query your Khoj server using a client application ID + secret. The secret would go in a bearer token.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Github integration
22

3-
The Github integration allows you to index as many repositories as you want. It's currently default configured to index Issues, Commits, and all Markdown/Org files in each repository. For large repositories, this takes a fairly long time, but it works well for smaller projects.
3+
:::warning[Unmaintained]
4+
The Github integration is not maintained. We are considering deprecating it. It doesn't seem used by many folks and its cumbersome for us to maintain.
5+
:::
6+
7+
The Github integration allows you to index as many repositories as you want. It's currently default configured to index all Markdown/Org/Text files in each repository. For large repositories, this takes a fairly long time, but it works well for smaller projects.
48

59
# Configure your settings
610

@@ -9,6 +13,6 @@ The Github integration allows you to index as many repositories as you want. It'
913
## Use the Github plugin
1014

1115
1. Generate a [classic PAT (personal access token)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) from [Github](https://github.com/settings/tokens) with `repo` and `admin:org` scopes at least.
12-
2. Navigate to [https://app.khoj.dev/settings#github](https://app.khoj.dev/settings#github) to configure your Github settings. Enter in your PAT, along with details for each repository you want to index.
16+
2. Navigate to [https://app.khoj.dev/settings#github](https://app.khoj.dev/settings/content/github) to configure your Github settings. Enter in your PAT, along with details for each repository you want to index.
1317
3. Click `Save`. Go back to the settings page and click `Configure`.
1418
4. Go to [https://app.khoj.dev/](https://app.khoj.dev/) and start searching!

src/interface/obsidian/src/main.ts

+39-4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ export default class Khoj extends Plugin {
3434
callback: () => { this.activateView(KhojView.CHAT); }
3535
});
3636

37+
// Add sync command to manually sync new changes
38+
this.addCommand({
39+
id: 'sync',
40+
name: 'Sync new changes',
41+
callback: async () => {
42+
this.settings.lastSync = await updateContentIndex(
43+
this.app.vault,
44+
this.settings,
45+
this.settings.lastSync,
46+
false,
47+
true
48+
);
49+
}
50+
});
51+
3752
this.registerView(KhojView.CHAT, (leaf) => new KhojChatView(leaf, this.settings));
3853

3954
// Create an icon in the left ribbon.
@@ -44,12 +59,32 @@ export default class Khoj extends Plugin {
4459
// Add a settings tab so the user can configure khoj
4560
this.addSettingTab(new KhojSettingTab(this.app, this));
4661

47-
// Add scheduled job to update index every 60 minutes
62+
// Start the sync timer
63+
this.startSyncTimer();
64+
}
65+
66+
// Method to start the sync timer
67+
private startSyncTimer() {
68+
// Clean up the old timer if it exists
69+
if (this.indexingTimer) {
70+
clearInterval(this.indexingTimer);
71+
}
72+
73+
// Start a new timer with the configured interval
4874
this.indexingTimer = setInterval(async () => {
4975
if (this.settings.autoConfigure) {
50-
this.settings.lastSync = await updateContentIndex(this.app.vault, this.settings, this.settings.lastSync);
76+
this.settings.lastSync = await updateContentIndex(
77+
this.app.vault,
78+
this.settings,
79+
this.settings.lastSync
80+
);
5181
}
52-
}, 60 * 60 * 1000);
82+
}, this.settings.syncInterval * 60 * 1000); // Convert minutes to milliseconds
83+
}
84+
85+
// Public method to restart the timer (called from settings)
86+
public restartSyncTimer() {
87+
this.startSyncTimer();
5388
}
5489

5590
async loadSettings() {
@@ -62,7 +97,7 @@ export default class Khoj extends Plugin {
6297
}
6398

6499
async saveSettings() {
65-
this.saveData(this.settings);
100+
await this.saveData(this.settings);
66101
}
67102

68103
async onunload() {

0 commit comments

Comments
 (0)