sabaimran
aa23da60a3
Add a notification banner to show temporary messages
2023-12-20 14:22:08 +05:30
Debanjum Singh Solanky
e04fe921eb
Fix first-run, chat error message in obsidian, desktop and web clients
...
- Disable chat input field if getChatHistory had error as Khoj may not
be setup correctly to chat
2023-12-20 14:03:07 +05:30
sabaimran
5ff9df9d4c
Add support per user for configuring the preferred search model from the config page
...
- Honor this setting across the relevant places where embeddings are used
- Convert the VectorField object to have None for dimensions in order to make the search model easily configurable
2023-12-20 13:25:43 +05:30
sabaimran
0f6e4ff683
Add a model that specifies the user's search model configuration
...
- Update all endpoints that generate embeddings to use the new model. Incl. generating text embeddings, creating embeddings for a search query
2023-12-20 09:22:26 +05:30
sabaimran
6dd2b05bf5
Rebase with master
2023-12-19 21:02:49 +05:30
sabaimran
e3557cd8b7
Update the personality prompt to make Khoj aware that users can share data via the desktop app
2023-12-19 16:42:45 +05:30
sabaimran
927e477f68
Ignore typing error in custom action short description
2023-12-19 16:10:58 +05:30
sabaimran
946305d977
Add function to export conversations for debugging
2023-12-19 16:05:20 +05:30
sabaimran
903a01745f
Use 0px for padding for input row buttons in web
2023-12-18 16:09:06 +05:30
sabaimran
5b092d59f4
Ignore dict assignment typing error
2023-12-17 22:34:54 +05:30
sabaimran
03cb86ee46
Update typing and object assignment for new text to image method return
2023-12-17 21:28:33 +05:30
sabaimran
0288804f2e
Render the inferred query along with the image that Khoj returns
2023-12-17 21:02:55 +05:30
sabaimran
49af2148fe
Miscellaneous improvements to image generation
...
- Improve the prompt before sending it for image generation
- Update the help message to include online, image functionality
- Improve styling for the voice, trash buttons
2023-12-17 20:25:35 +05:30
sabaimran
7cb64cb2f9
Add telemetry for image generation conversation command
2023-12-17 18:25:03 +05:30
sabaimran
09544dee09
Add TextToImageModelConfig to the admin page
2023-12-17 16:44:19 +05:30
sabaimran
0459666beb
CSRF Cookie not set error in prod. Try fixing https forwarding for mitigation
2023-12-17 12:55:18 +05:30
sabaimran
61dde8ed89
If text to image config isn't set, send back an error message to the client
2023-12-17 12:54:50 +05:30
sabaimran
3065cea562
Address mypy typing issues
2023-12-16 09:24:26 +05:30
sabaimran
5f6dcf9f2e
Add a rate limiter for the transcribe API endpoint
2023-12-16 09:18:56 +05:30
sabaimran
73a107690d
Add a ConversationCommand rate limiter for the chat endpoint
2023-12-16 09:03:52 +05:30
sabaimran
9b961ed496
Merge pull request #580 from khoj-ai/fix-upgrade-chat-to-create-images
...
Support Image Generation with Khoj
2023-12-07 21:17:58 +05:30
Debanjum Singh Solanky
7504669f2b
Fix rendering image on chat response in obsidian client
2023-12-05 03:48:07 -05:00
Debanjum Singh Solanky
408b7413e9
Use global openai client for transcribe, image
2023-12-05 03:36:33 -05:00
Debanjum Singh Solanky
162b219f2b
Throw unsupported error when server not configured for image, speech-to-text
2023-12-05 01:51:14 -05:00
Debanjum Singh Solanky
8f2f053968
Fix rendering image on chat response in web, desktop client
2023-12-05 01:51:14 -05:00
Debanjum Singh Solanky
d124266923
Reduce promise based nesting in chat JS func used in desktop, web client
...
Use async/await to reduce .then() based nesting to improve code
readability
2023-12-05 01:51:14 -05:00
Debanjum Singh Solanky
6e3f66c0f1
Use base64 encoded image instead of source URL for persistence
...
The source URL returned by OpenAI would expire soon. This would make
the chat sessions contain non-accessible images/messages if using
OpenaI image URL
Get base64 encoded image from OpenAI and store directly in
conversation logs. This resolves the image link expiring issue
2023-12-05 01:51:14 -05:00
Debanjum Singh Solanky
52c5f4170a
Show generated images in the chat modal of the Khoj Obsidian plugin
2023-12-05 01:51:14 -05:00
Debanjum Singh Solanky
8016a57b5e
Show generated images in chat interface on Desktop client
2023-12-05 01:51:14 -05:00
Debanjum Singh Solanky
cc051ceb4b
Show generated images in chat interface on Web client
2023-12-05 01:51:14 -05:00
Debanjum Singh Solanky
252b35b2f0
Support /image slash command to generate images using the chat API
2023-12-05 01:51:14 -05:00
sabaimran
ef21d78c99
Initial changes to support multiple search model configurations
...
- All search models are loaded into memory, and stored in a dictionary indexed by name
- Still need to add database migrations and create a UI for user to select their choice. Presently, it uses the default option
2023-12-05 00:35:40 -05:00
Debanjum Singh Solanky
1d9c1333f2
Configure text to image models available on server
...
- Currently supports OpenAI text to image model, by default dall-e-3
- Allow setting the text to image model via CLI during server setup
2023-12-04 21:27:53 -05:00
Debanjum Singh Solanky
f0222f6d08
Make save_to_conversation_log helper function reusable
...
- Move it out to conversation.utils from generate_chat_response function
- Log new optional intent_type argument to capture type of response
expected. This can be type responses by Khoj e.g speech, image. It
can be used to render responses by Khoj appropriately on clients
- Make user_message_time argument optional, set the time to now by
default if not passed by calling function
2023-12-04 19:42:12 -05:00
sabaimran
d2ddbef08f
Use a unique name for the temp PDF generated
2023-12-04 19:27:00 -05:00
sabaimran
d20746613a
Properly filter out empty PDFs for indexing
2023-12-04 16:15:17 -05:00
Debanjum Singh Solanky
316b7d471a
Handle offline chat model retrieval when no internet
...
Offline chat shouldn't fail on retrieve_model when no internet,
if model was previously downloaded and usable offline
2023-12-04 13:46:25 -05:00
Debanjum Singh Solanky
2b09caa237
Make online results an optional argument to the gpt converse method
2023-12-04 12:15:29 -05:00
Debanjum Singh Solanky
7009793170
Migrate to OpenAI Python library >= 1.0
2023-12-03 18:16:00 -05:00
sabaimran
cc064ea57d
Fix circular import issue
2023-12-03 17:46:44 -05:00
sabaimran
21f8d63e89
If a user subscribes to Khoj with an email address that's not present in the DB, create an account
2023-12-03 17:28:40 -05:00
sabaimran
c5d297a9ed
Recursively search through folders for indexing
2023-12-03 16:17:28 -05:00
Debanjum Singh Solanky
a57d529f39
Fix path to system tray icon of Khoj desktop app
2023-12-03 00:12:50 -08:00
Debanjum Singh Solanky
106cdbe455
Release Khoj version 1.1.0
2023-11-30 20:09:08 -08:00
Debanjum Singh Solanky
10ce4ee11c
Ignore null params type check for markdown renderer in Obsidian client
2023-11-30 20:09:08 -08:00
sabaimran
a5ffa2342f
Add documentation for local setup and fix admin panel bugs
...
- Wasn't able to login to the admin panel when KHOJ_DEBUG was not True. Fix this error so self-hosted users can get unblocked from accessing the admin settings
- Don't force users to set their KHOJ_DJANGO_SECRET_KEY
2023-11-30 17:55:27 -08:00
Debanjum Singh Solanky
d587632700
Clear result before render thinking placeholder emoji in Obsidian chat
2023-11-30 13:53:09 -08:00
Debanjum Singh Solanky
48719ee0dd
Render newline separation in chat references to improve readability
2023-11-30 13:16:48 -08:00
Debanjum Singh Solanky
1a31a2efcf
Render Khoj chat streaming response as md & show refs in Obsidian
...
- Use new style references for Khoj chat modal in Obsidian
- Khoj Chat responses in Obsidian had regressed to not show references
for new questions after modal has been opened. Now even those are
rendered, and use new references style
- Render chat response as markdown while it's being streamed
2023-11-30 13:02:00 -08:00
Debanjum Singh Solanky
0430fa67b6
Show temporary status message when copied to clipboard
2023-11-29 13:49:33 -08:00
Debanjum Singh Solanky
491a1a949a
Render chat responses as markdown in Desktop client too
2023-11-29 13:49:33 -08:00
Debanjum Singh Solanky
20ef5bfc93
Properly stop mediaRecorder stream to clear microphone in-use state
2023-11-29 13:48:35 -08:00
Debanjum Singh Solanky
8faa63c3c6
Convert config page buttons to use stronger yellow
2023-11-28 19:55:43 -08:00
Debanjum Singh Solanky
a6ca2076d5
Open link to Khoj app landing page from nav pane in current tab
2023-11-28 14:20:37 -08:00
Debanjum Singh Solanky
643e018947
Handle if user subscription field doesn't exists in telemetry func
...
Avoid null ref in the method when running Khoj server in anon mode
2023-11-28 14:15:14 -08:00
Debanjum Singh Solanky
110d7646fc
Use milder yellow as primary Khoj theme color for chat, buttons etc.
2023-11-28 14:15:14 -08:00
sabaimran
18254850ab
Set a default value for the khoj django secret key and add additional guidance for setting environment variables on first run
2023-11-28 09:39:44 -08:00
sabaimran
6290b463f5
Compute size of the indexed data only if explicitly requested to avoid heavy load on the DB
2023-11-27 12:05:00 -08:00
sabaimran
eb5e3096e0
Change subscribed scope to premium
2023-11-27 11:39:20 -08:00
sabaimran
6e1ba11e59
Resolve merge conflicts for rendering chat response
2023-11-27 11:33:13 -08:00
Debanjum Singh Solanky
71f2d54258
Render chat response as markdown while streaming on Web, Desktop clients
2023-11-26 20:27:10 -08:00
Debanjum Singh Solanky
9e714d032b
Fix Khoj telemetry server. Add server_version column
2023-11-26 15:05:43 -08:00
Debanjum Singh Solanky
b249bbb5b5
Limit max audio file size allowed for transcription on API endpoint
2023-11-26 14:19:46 -08:00
Debanjum Singh Solanky
a79604b601
Fix return types of offline, online transcribe methods for python 3.9
2023-11-26 06:26:34 -08:00
Debanjum Singh Solanky
06f99ceb3c
Rename /api/speak API endpoint to /api/transcribe
2023-11-26 06:18:44 -08:00
Debanjum Singh Solanky
56a1a61c77
Remove unused button element retrieval code from web, desktop
2023-11-26 06:17:56 -08:00
Debanjum Singh Solanky
877532a167
Speak to Khoj from the Obsidian client
...
- Add transcription button with mic icon
- Collect audio recording on pressing mic
- Process and send audio recording to server for transcription
- Extract the functionality to flash status in chat input for reuse
2023-11-26 06:17:54 -08:00
Debanjum Singh Solanky
cc9eae5d18
Update default chat model to Mistral in GPT4AllProcessor config
2023-11-26 05:55:43 -08:00
Debanjum Singh Solanky
4636390f7f
Transcribe speech to text offline with Whisper
...
- Allow server admin to configure offline speech to text model during
initialization
- Use offline speech to text model to transcribe audio from clients
- Set offline whisper as default speech to text model as no setup api key reqd
2023-11-26 05:55:11 -08:00
Debanjum Singh Solanky
a0a7ab7ec8
Rename conversation.gpt4all package to conversation.offline
2023-11-26 04:19:32 -08:00
Debanjum Singh Solanky
499adf86a0
Move transcription using OpenAI API into independent package
2023-11-26 04:19:32 -08:00
Debanjum Singh Solanky
897170ab15
Use single db migration script for transcribe model, related updates
2023-11-26 04:19:32 -08:00
Debanjum Singh Solanky
28090216f6
Show transcription error status in chatInput placeholder on web, desktop
...
- Extract flashing status message in chat input placeholder into
reusable function
- Use emoji prefixes for status messages
- Improve alt text of transcribe button to indicate what the button does
2023-11-26 04:19:32 -08:00
Debanjum Singh Solanky
fc040825b2
Default to Offline chat with Mistral as minimal setup, no API key reqd.
2023-11-26 01:07:20 -08:00
Debanjum Singh Solanky
5a6547677c
Add type of operation variable in latest migration
2023-11-26 00:38:52 -08:00
Debanjum Singh Solanky
3e252036c3
Remove whitespace: pre-line from chat html, since markdown rendering
2023-11-26 00:27:29 -08:00
Debanjum Singh Solanky
b484795b8e
Merge branch 'master' into add-speak-to-chat
...
- Conflicts:
- src/interface/desktop/chat.html
Combine and use common class names for speak component
- src/khoj/database/adapters/__init__.py
Combine imports
- src/khoj/interface/web/chat.html
Combine and use common class names for speak component
- src/khoj/routers/api.py
Combine imports
2023-11-26 00:26:21 -08:00
sabaimran
6233a957b4
Merge branch 'master' of github.com:khoj-ai/khoj into features/enforce-subscription-status
2023-11-25 22:46:10 -08:00
sabaimran
52b88de7f4
Indicate in the desktop if the user gets rate limited for indexing
2023-11-25 22:31:23 -08:00
Debanjum
e0a59cff68
Delete Conversation History from Web, Desktop, Obsidian Clients ( #551 )
...
Add delete button to clear conversation history from Web, Desktop and Obsidian Khoj clients
Resolves #523
2023-11-25 22:24:12 -08:00
Debanjum Singh Solanky
d0e294d8a5
Clear Conversation History from the Obsidian client
...
- Fix font color for Khoj chat responses in Obsidian. Previous color
had too low a contrast to be readable
2023-11-25 22:16:13 -08:00
sabaimran
b2afbaa315
Add support for rate limiting the amount of data indexed
...
- Add a dependency on the indexer API endpoint that rounds up the amount of data indexed and uses that to determine whether the next set of data should be processed
- Delete any files that are being removed for adminstering the calculation
- Show current amount of data indexed in the config page
2023-11-25 20:28:04 -08:00
Debanjum Singh Solanky
07bf365c7c
Clear any network connections to khoj server via khoj.el on reindex
...
- Ignore errors in deleting network requests to khoj server
- Also delete open network connection to khoj server on auto reindex
Otherwise when server is unreachable a bunch of failed network
connections accrue in the processes list
2023-11-25 20:19:41 -08:00
sabaimran
dd1badae81
Use userwithtoken.user when authenticating with an API key
2023-11-24 22:18:45 -08:00
sabaimran
48b9116195
Fix to use user rather than user_with_token in authenticated credentials
2023-11-24 22:18:00 -08:00
sabaimran
771f9bcfa1
If the user subscription was created over 7 days ago, then their trial is expired
2023-11-24 22:08:32 -08:00
sabaimran
e5b1350523
Enforce API use limits depending on whether the server has billing enabled
...
and whether the given user is subscribed
2023-11-24 21:55:16 -08:00
sabaimran
9c868ee10b
Use the state.billing_enabled field to determine whether to use the subscribed scope
2023-11-24 20:41:19 -08:00
sabaimran
69c8f45830
Use scopes to represent whether the use has a valid subscription in the middleware
2023-11-24 20:29:36 -08:00
Debanjum
25f3f2367e
Handle Server Unavailable Error from Khoj.el ( #568 )
...
- Make auto-update of content index user configurable from khoj.el
- Handle server unavailable error on auto-index schedule job in khoj.el
Resolves #567
2023-11-24 16:46:07 -08:00
Debanjum Singh Solanky
138f4e3f3c
Make auto-update of content index user configurable from khoj.el
2023-11-24 16:40:50 -08:00
Debanjum Singh Solanky
0885fc6c23
Handle server unavailable error on auto-index schedule job in khoj.el
2023-11-24 16:39:44 -08:00
sabaimran
c13953311a
Add reflective questions to admin pages
2023-11-23 14:01:05 -08:00
sabaimran
c42ec32a95
Merge pull request #552 from khoj-ai/features/internet-enabled-search
...
Support internet-enabled, online searching using Serper.dev
2023-11-23 12:34:05 -08:00
sabaimran
c641b8df58
Update desktop package version
2023-11-22 17:54:53 -08:00
sabaimran
a1b2289074
Release Khoj version 1.0.1
2023-11-22 17:52:07 -08:00
sabaimran
b1b037f0ea
Fix URL configuration issues with reorganized subfolders
2023-11-22 17:03:33 -08:00
sabaimran
e0949e232b
Import random in adapters file for selecting reflective question
2023-11-22 07:52:51 -08:00
sabaimran
256e8de40a
Merge with features/internet-enabled-search
2023-11-22 07:25:24 -08:00
Debanjum Singh Solanky
fd60db766e
Clear Conversation History from the Web Client
2023-11-22 03:35:00 -08:00
Debanjum Singh Solanky
d5a4830761
Clear Conversation History from the Desktop Client
2023-11-22 03:35:00 -08:00
Debanjum Singh Solanky
3096544cf2
Create API endpoint to clear user's chat history
2023-11-22 03:34:59 -08:00
Debanjum Singh Solanky
63675b3299
Speak to Khoj from the Desktop client
...
- Use icons to style speech to text recording state
2023-11-22 02:47:17 -08:00
Debanjum Singh Solanky
2951fc92d7
Speak to Khoj from the Web client
...
- Use icons to style speech to text recording state
2023-11-22 02:47:17 -08:00
Debanjum Singh Solanky
cc77bc4076
Create speech to text API endpoint. Use OpenAI whisper for ASR
...
- Wrap audio transcription in try/catch and delete audio file after
processing
- Use configured speech to text model, else handle error
2023-11-22 02:47:06 -08:00
Debanjum Singh Solanky
1ca99b6eb0
Add speech to text model configuration to Database
2023-11-22 02:24:31 -08:00
sabaimran
c652a7fd2d
Move text_to_entries under the new content folder
2023-11-21 22:25:17 -08:00
sabaimran
1e2af083f0
Rename the data_sources module to content
2023-11-21 22:11:32 -08:00
sabaimran
4cb28aeffb
Resolve merge conflicts with master
2023-11-21 22:07:41 -08:00
Debanjum Singh Solanky
4cdfe8fc4f
Re-enable Khoj Obsidian plugin for Mobile, as Khoj cloud is available
2023-11-21 16:33:48 -08:00
Debanjum
5d9d50157e
Clean Logs, Improve Message Rendering and Make Khoj Trusted Host Configurable ( #561 )
...
- Append chat message to chat logs as TextNodes in web, desktop clients
- Simplify Code to Identify Files from Github, Notion on Web, Desktop Client
- Use file source to find entries from github, notion on web, desktop client
- Pass file source to clients via text search API response
- Make Django Logs Follow Khoj Log Format, Verbosity
- Handle image search setup related warning
- Format Django initializing outputs using Khoj logger format
- Use `KHOJ_HOST` env var to set allowed/trusted domains to host Khoj
2023-11-21 15:14:34 -08:00
Debanjum Singh Solanky
9e736d4340
Use KHOJ_DOMAIN for CORS allow_origins list as well
...
- Default to app.khoj.dev
- Remove unnecesary any_path regex in allow_origins. It only cares
about host, paths are not set in origin header
2023-11-21 14:02:04 -08:00
sabaimran
5469e81a87
Use full path for the static directory in FastAPI and reflect deeper nesting of the django app
2023-11-21 13:44:45 -08:00
sabaimran
d199c4c35f
Resovle merge conflicts with matser
2023-11-21 13:35:56 -08:00
Debanjum Singh Solanky
76d041f633
Use KHOJ_HOST env var to set allowed/trusted domains to host Khoj
...
Allows hosting Khoj behind other, non "khoj.dev" domains
2023-11-21 13:11:45 -08:00
Debanjum Singh Solanky
90d463c12a
Append chat message to chat logs as TextNodes in web, desktop clients
2023-11-21 13:10:50 -08:00
Debanjum Singh Solanky
befcbcdd5d
Use file source to find entries from github, notion on web, desktop client
...
This is a more robust mechanism of identification than via file name
including github or notion domain names
2023-11-21 13:10:50 -08:00
Debanjum Singh Solanky
3f0de45ec6
Pass file source to clients via text search API response
...
Source of entry stored in DB is now passed to clients for processing
2023-11-21 13:10:50 -08:00
Debanjum Singh Solanky
4aec581306
Handle image search setup related warning
...
Ideally should rename model_directory to config_directory or some such
but the current image search code will need to be migrated soon. So
changing the variable name and creating a migration script for old
khoj.yml files using model-directory variable isn't worth it
Remove the explicity set of number of threads to use by pytorch. Use
the default used by it.
2023-11-21 13:10:50 -08:00
Debanjum Singh Solanky
b06628ee31
Format Django initializing outputs using Khoj logger format
...
- Collect STDOUT from the `migrate', `collectstatic' commands and
output using the Khoj logger format and verbosity settings
- Only show Django `collectstatic' command output in verbose mode
- Fix showing the Initializing Khoj log line by moving it after logger
level set
2023-11-21 13:10:50 -08:00
sabaimran
341abf03ff
Handle none for search_type and use equals comparator rather than in for determining Notion type
2023-11-21 12:55:09 -08:00
sabaimran
2bb989e9d8
Resolve merge conflicts and fix some import ordering
2023-11-21 12:30:43 -08:00
sabaimran
244b76ffed
Add isort for automatic import sorting and skip main.py because it's a drama queen 👑
2023-11-21 12:20:41 -08:00
Debanjum
8a0d92e2d7
Fix Connectivity Check in Obsidian Client ( #559 ) from dtkav/bugfix-local-connectivity-check
...
Check connection to Khoj server for self-hosted server. This check had regressed during the cloud rearchitecture
2023-11-21 12:05:16 -08:00
sabaimran
0e6f09b241
Merge pull request #562 from khoj-ai/fix/pypi-package-app-not-included
...
Fix PyPi package app reference issue
2023-11-21 11:54:46 -08:00
sabaimran
333cb3445c
Use colon rather than equals to indicate typing
2023-11-21 11:28:51 -08:00
Debanjum Singh Solanky
645fd96634
Search across all content types from Khoj Obsidian client
...
Previously it was only searching for PDF and Markdown files. This was
meant to show only content from current vault as results.
But it has not scaled well as other clients also allow syncing PDF and
markdown files now. So remove this content type filter for now.
A proper solution would limit by using file/dir filters on server or
client side.
2023-11-21 11:19:33 -08:00
sabaimran
a1460a5bf9
Set operations to typed empty list in migration file
2023-11-21 11:14:40 -08:00
sabaimran
71e794c26f
Remove the sys.append line in the main.py file, as it's not required
2023-11-21 10:57:21 -08:00
sabaimran
a474c31e02
Move the django app into the src/khoj folder for better organization and functionality
...
- Our pypi package currently does not work because the django app and associated database is not included. To remedy this issue, move the app into the src/khoj folder. This has the added benefit of improved organization of the codebase, as all server related code is now in a single folder
- Update associated file paths and system references
2023-11-21 10:56:04 -08:00
Debanjum Singh Solanky
c89bd49973
Fix ranking search results on Obsidian
...
It's reversed since score of entries is now a distance metric on
Khoj server. So lesser distance is better. Previously higher score was
better
2023-11-21 01:24:59 -08:00
Daniel Grossmann-Kavanagh
f142999bce
fix khoj local server usage
2023-11-20 17:07:30 -08:00
Debanjum Singh Solanky
c07401cf76
Fix, Improve chat config via CLI on first run by using defaults
...
- Fix setting prompt size for online chat
- generally improve chat config via cli by using default chat model,
prompt size for online and offline chat
2023-11-20 17:01:20 -08:00
sabaimran
b142de15a8
Merge branch 'features/internet-enabled-search' of github.com:khoj-ai/khoj into features/reflective-suggested-questions
2023-11-20 15:56:09 -08:00
sabaimran
a9623ef85a
Add requisite imports in order to instantiate offline model in adapters file
2023-11-20 15:27:42 -08:00
sabaimran
a8f13f334f
Fix merging issues with base after popping the stash
2023-11-20 15:22:50 -08:00
sabaimran
8fa0b69c67
Resolve merge issue with adapters methods
2023-11-20 15:21:06 -08:00
sabaimran
fee99779bf
Add subqueries for internet-connected search results and update client-side code accordingly
...
- Add a wrapper method to help make direct queries to the LLM and determine any intermediate responses needed for handling the request
2023-11-20 15:19:15 -08:00
Debanjum Singh Solanky
d61b0dd55c
Add Khoj Django app package to sys path to load Django module via pip install
2023-11-20 14:55:00 -08:00
sabaimran
b8e6883a81
Merge branch 'master' of github.com:khoj-ai/khoj into features/internet-enabled-search
2023-11-19 16:20:08 -08:00
sabaimran
237195e20e
Make all name-related fields nullable within the GoogleUser
2023-11-19 14:22:32 -08:00
Debanjum
71799add0b
Index Parent Headings of Org-Mode Entries to Improve Search Context ( #548 )
...
### Overview
The parent hierarchy of org-mode entries can store important context.
This change updates OrgNode to track parent headings for each org entry and adds the parent outline for each entry to the index
### Details
- Test search uses ancestor headings as context for improved results
- Add ancestor headings of each org-mode entry to their compiled form
- Track ancestor headings for each org-mode entry in org-node parser
Resolves #85
2023-11-19 13:18:19 -08:00
sabaimran
ef5e9d66c1
Resolve merge conflicts in dependency imports
2023-11-19 11:42:20 -08:00
Debanjum Singh Solanky
c3465d6982
Release Khoj version 1.0.0
2023-11-19 09:50:25 -08:00
Debanjum
736744be3a
Update documentation to reflect new multi-user config scenario ( #550 )
...
- Update docs to show how to use Khoj Cloud
- Move self-hosting Khoj to separate section
- Add page to setup Desktop app
- Set default URL to Khoj Cloud URL in Obsidian, Emacs clients
2023-11-18 18:22:46 -08:00
Debanjum Singh Solanky
e1bf1f0e86
Update default Khoj server URL to Khoj cloud on Emacs, Obsidian clients
2023-11-18 16:25:45 -08:00
Debanjum Singh Solanky
8775ce730a
Use URL fragments to allow jumping to config page sections on Web app
2023-11-18 16:25:45 -08:00
sabaimran
f792b1e301
Remove already defined identical function
2023-11-18 14:08:50 -08:00
sabaimran
e2fff5dc47
Don't explicitly use value to get the model type value
2023-11-18 14:01:01 -08:00
sabaimran
a8a25ceac2
Honor user's chat settings when running the extract questions phase
...
- Add marginally better error handling when GPT gives a messed up respones to the extract questions method
- Remove debug log lines
2023-11-18 13:31:51 -08:00
sabaimran
67156e6aec
Add new logs for debugging issues with chat references
2023-11-18 12:10:50 -08:00
sabaimran
5de2ab6098
Change parse_obj calls to use model_validate per new pydantic specification
2023-11-18 12:10:36 -08:00
sabaimran
6d249645a6
Fix interpretation of the default search type
2023-11-18 00:04:18 -08:00
sabaimran
f180b2ba94
Resolve mypy errors for various data types
2023-11-17 23:26:15 -08:00
sabaimran
3328a41f08
Update types of base config models for pydantic 2.0
2023-11-17 23:08:52 -08:00
sabaimran
f688529150
Update the default configuration for the AppConfig
2023-11-17 19:26:31 -08:00
sabaimran
11ccb92755
Fix formatting of welcome message to use markdown
2023-11-17 18:55:59 -08:00
Debanjum Singh Solanky
ca87b4ede9
Wrap common API query parameters into shared class to deduplicate code
...
- Upgrade FastAPI to >= latest version. Required upgrade of FastAPI.
Earlier version didn't support wrapping common query params in class
- Use per fixture app instead of a global FastAPI app in conftest
- Upgrade minimum required Django version
- Fix no notes chat director test with updated no notes message
No notes message was updated in commit 118f1143
2023-11-17 18:43:49 -08:00
sabaimran
262f3ccb59
Resolve mypy issues with formatting
2023-11-17 17:11:00 -08:00
sabaimran
a7e00898cb
Fix rendering even when no online context references are returned
2023-11-17 16:41:28 -08:00
sabaimran
0fcf234f07
Add support for using serper.dev for online queries
...
- Use the knowledgeGraph, answerBox, peopleAlsoAsk and organic responses of serper.dev to provide online context for queries made with the /online command
- Add it as an additional tool for doing Google searches
- Render the results appropriately in the chat web window
- Pass appropriate reference data down to the LLM
2023-11-17 16:19:11 -08:00
Debanjum Singh Solanky
55785d50c3
Use title, when present, as root ancestor of entries instead of file path
2023-11-17 15:03:27 -08:00
sabaimran
bfbe273ffd
Add some styling to the copy button for programmatic output
2023-11-17 12:18:35 -08:00
sabaimran
9ddf3b58c3
Use the markdown parser for rendering the chat messages in the web interface
2023-11-17 12:14:02 -08:00
sabaimran
a0b12b001a
Provide in-line rendering when output matches certain views
2023-11-17 11:04:36 -08:00
sabaimran
ec06d2c446
Move data indexer files into a separate folder under processor. Update assoc UTs
2023-11-16 17:19:55 -08:00
sabaimran
45a42faec8
Make adjectives more positive for api token generation
2023-11-16 15:55:35 -08:00
sabaimran
118f1143ff
When user tries using the notes slash command without having any data indexed
2023-11-16 12:52:39 -08:00
sabaimran
e8a13f0813
Add multi-user support to Khoj and use Postgres for backend storage ( #549 )
...
- Adds support for multiple users to be connected to the same Khoj instance using their Google login credentials
- Moves storage solution from in-memory json data to a Postgres db. This stores all relevant information, including accounts, embeddings, chat history, server side chat configuration
- Adds the concept of a Khoj server admin for configuring instance-wide settings regarding search model, and chat configuration
- Miscellaneous updates and fixes to the UX, including chat references, colors, and an updated config page
- Adds billing to allow users to subscribe to the cloud service easily
- Adds a separate GitHub action for building the dockerized production (tag `prod`) and dev (tag `dev`) images, separate from the image used for local building. The production image uses `gunicorn` with multiple workers to run the server.
- Updates all clients (Obsidian, Emacs, Desktop) to follow the client/server architecture. The server no longer reads from the file system at all; it only accepts data via the indexer API. In line with that, removes the functionality to configure org, markdown, plaintext, or other file-specific settings in the server. Only leaves GitHub and Notion for server-side configuration.
- Changes license to GNU AGPLv3
Resolves #467
Resolves #488
Resolves #303
Resolves #345
Resolves #195
Resolves #280
Resolves #461
Closes #259
Resolves #351
Resolves #301
Resolves #296
2023-11-16 11:48:01 -08:00
Debanjum Singh Solanky
74403e3536
Add ancestor headings of each org-mode entry to their compiled form
...
Resolves #85
2023-11-16 02:54:41 -08:00
Debanjum Singh Solanky
305c25ae1a
Track ancestor headings for each org-mode entry in org-node parser
2023-11-16 02:39:14 -08:00
Debanjum Singh Solanky
cc05013715
Update first run message on Web app with Chat models setup instructions
...
- Link to Django admin panel for user to create Chat Models on their
Khoj server
- This should only get hit when user is not using Khoj cloud, as Khoj
cloud would already have Chat models configured
2023-11-15 22:44:24 -08:00
Debanjum Singh Solanky
6c1693b8f4
Update first run message on Desktop app with API token setup instructions
...
- Open Web app settings in the default browser via link click
- Open Desktop app settings via link click
2023-11-15 22:44:11 -08:00
Debanjum Singh Solanky
922983bd53
Set max cos distance to 0.18. Test search API query with max distance
2023-11-15 20:26:21 -08:00
Debanjum Singh Solanky
18dbad5edb
Use Sigmoid to normalize cross-encoder score between 0-1
...
- While sigmoid normalization isn't required for reranking.
Normalizing score to distance metrics for both encoder and cross
encoder scores is useful to reason about them
- Softmax wasn't required as don't need probabilities, sigmoid is good
enough to get distance metric
2023-11-15 19:31:59 -08:00
sabaimran
ea144de438
Merge with master
2023-11-15 18:34:46 -08:00
Debanjum Singh Solanky
348cc0cf0e
Use better name for DB adapter func to create user by Google token
2023-11-15 17:31:50 -08:00
Debanjum Singh Solanky
08a057bdd5
Rename SearchModel to SearchModelConfig DB model, Require Cross-Encoder
2023-11-15 17:31:50 -08:00
Debanjum Singh Solanky
0679b2a7bd
Use embeddings model store from state in text to entries
...
Do not need to instantiating it separately. In all other places we're
using the embeddings model store in global state anyway
2023-11-15 17:31:50 -08:00
sabaimran
245a9cbf63
Fix return type of the update_or_create method
2023-11-15 17:31:50 -08:00
sabaimran
bbae7dd83c
Update logic for creating a new user to use aupdate_or_create
2023-11-15 17:31:50 -08:00
sabaimran
8e62af77b9
Update format for return type of the generate token mehtod
2023-11-15 17:03:01 -08:00
sabaimran
4a487aff23
Fix return type of the update_or_create method
2023-11-15 14:35:42 -08:00
sabaimran
b63856ecb4
Update logic for creating a new user to use aupdate_or_create
2023-11-15 12:50:39 -08:00
sabaimran
b8e7488a95
Use a more permissive distance filter for search results from notes
2023-11-15 11:13:47 -08:00
sabaimran
05b7542115
Remove config lock from the state
2023-11-15 10:44:45 -08:00
sabaimran
ecd005cac0
Check if search model is already in DB before creating a new one
2023-11-15 10:41:35 -08:00
Debanjum Singh Solanky
9c6e7bdea2
Upgrade server, desktop app dependencies to resolve CVE bugs
2023-11-15 01:47:53 -08:00
Debanjum Singh Solanky
8f200cf53f
Remove unused parameter from configure_search_type method
2023-11-14 19:09:35 -08:00
Debanjum Singh Solanky
f8e5e118e1
Only create KhojUser on login if doesn't already exist
2023-11-14 19:09:35 -08:00
Debanjum Singh Solanky
3d8d6145f2
Add search model config from khoj.yml to Postgres DB via migration script
2023-11-14 19:09:35 -08:00
Debanjum Singh Solanky
4af194d74b
Make search model configurable on server
...
- Expose ability to modify search model via Django admin interface
- Previously the bi_encoder and cross_encoder models to use were set
in code
- Now it's user configurable but with a default config generated by
default
2023-11-14 19:09:35 -08:00
Debanjum Singh Solanky
e98141f4c3
Subscribe default user to standard plan with a far away renewal date
...
Self hosted users in anonymous mode have all capabilities unlocked
2023-11-14 16:31:39 -08:00
Debanjum Singh Solanky
9d30fda26d
Deduplicate, improve name of prompt templates for GPT4All chat models
...
- Do not pass unused rerank_results parameter to text_search.query method
2023-11-14 16:31:09 -08:00
Debanjum Singh Solanky
795ec9eb55
Add KHOJ_prefix to server admin credentials environment variables
2023-11-14 16:13:13 -08:00
sabaimran
ee005de662
Rename django files URL to server instead of django
2023-11-14 12:36:38 -08:00
sabaimran
20ce3d0c78
Update default docker compose configuration with Khoj local mode
2023-11-14 12:21:26 -08:00
sabaimran
8c36079f74
Add a first run experience to intialize the admin user if none exists and setup chat models
2023-11-13 21:07:12 -08:00
Debanjum Singh Solanky
e9adb58c16
Rate limit calls to the /chat API per user, per day/minute
2023-11-13 19:41:46 -08:00
Debanjum Singh Solanky
33a8eb0470
Log when new user is created
2023-11-13 19:37:24 -08:00
sabaimran
603f838115
Block input text field when waiting for chat response
2023-11-11 17:14:37 -08:00
Debanjum Singh Solanky
9c321ac070
Fix cross encoder to use softmax to convert it to a distance metric
2023-11-11 16:12:24 -08:00
sabaimran
8a824167cf
Merge branch 'fix/imports-and-references' of github.com:khoj-ai/khoj into fix/imports-and-references
2023-11-11 12:59:31 -08:00
sabaimran
fa428932a8
Update URL for downloading the desktop application
2023-11-11 12:59:15 -08:00
Debanjum Singh Solanky
941c7f23a3
Only get text search results above confidence threshold via API
...
- During the migration, the confidence score stopped being used. It
was being passed down from API to some point and went unused
- Remove score thresholding for images as image search confidence
score different from text search model distance score
- Default score threshold of 0.15 is experimentally determined by
manually looking at search results vs distance for a few queries
- Use distance instead of confidence as metric for search result quality
Previously we'd moved text search to a distance metric from a
confidence score.
Now convert even cross encoder, image search scores to distance metric
for consistent results sorting
2023-11-11 04:11:33 -08:00
Debanjum Singh Solanky
e44e6df221
Reduce data dumped in console log from web, desktop app
2023-11-11 02:05:07 -08:00
Debanjum Singh Solanky
f044a89d50
Show status in Save, Reinitialize button of config page on web app
...
- Show non-transient error message in status element if action fails
- On success, just show temporary success message within button
2023-11-11 02:04:58 -08:00
Debanjum Singh Solanky
f17d9da36c
Move Configure, Reinitialize buttons into the Content section on Web app
...
Remove the Results Count button from the web app. It's hanging weirdly
with not much context to its purpose.
Reintroduce it in the Search card when created under the Features section
2023-11-11 02:01:39 -08:00
Debanjum Singh Solanky
325cb0f7fb
Show message in Save button of Github, Notion config save in web app
...
Show the success, failure message only temporarily. Previously it
stuck around after clicking save until page refresh
2023-11-11 02:01:39 -08:00
Debanjum Singh Solanky
b34d4fa741
Save config, update index on save of Github, Notion config in web app
...
Reduce user confusion by joining config update with index updation for
each content type.
So only a single click required to configure any content type instead
of two clicks on two separate pages
2023-11-11 00:33:49 -08:00
Debanjum Singh Solanky
c4364b9100
Weaken asking follow-up qs and q&a mode in notes prompt to OpenAI models
...
- Notes prompt doesn't need to be so tuned to question answering. User
could just want to talk about life. The notes need to be used to
response to those, not necessarily only retrieve answers from notes
- System and notes prompts were forcing asking follow-up questions a
little too much. Reduce strength of follow-up question asking
2023-11-10 23:36:43 -08:00
Debanjum Singh Solanky
cba371678d
Stop OpenAI chat from emitting reference notes directly in chat body
...
The Chat models sometime output reference notes directly in the chat
body in unformatted form, specifically as Notes:\n['. Prevent that.
Reference notes are shown in clean, formatted form anyway
2023-11-10 23:36:43 -08:00
Debanjum Singh Solanky
8585976f37
Revert "Use notes in system prompt, rather than in the user message"
...
This reverts commit e695b9ab8c
.
2023-11-10 23:36:43 -08:00
Debanjum Singh Solanky
b6441683c6
Increase reference text on 1st expansion to 3 lines and 140 characters
2023-11-10 23:36:43 -08:00
sabaimran
55c97241b5
Merge branch 'fix/imports-and-references' of github.com:khoj-ai/khoj into fix/imports-and-references
2023-11-10 22:38:34 -08:00
sabaimran
e2e96f9aa4
Add default settings to let new users be subscribed on trial
...
- Add the default user to a subscription trial
- Update associated unit tests
2023-11-10 22:38:28 -08:00
Debanjum Singh Solanky
501e7606a0
Increase reference text on 1st expansion to 3 lines and 140 characters
2023-11-10 21:27:04 -08:00
sabaimran
0a950d9382
Fix checker to determine if obsidian client is connected
2023-11-10 19:21:58 -08:00
sabaimran
c736604366
Merge with remote
2023-11-10 17:50:15 -08:00
sabaimran
b0b07bde6c
Allow chat reference to expand enough to show the whole reference, rather than constraining the height
2023-11-10 17:49:20 -08:00
sabaimran
14f8c151c8
Fix return type of the generate_chat_response method
2023-11-10 17:48:54 -08:00
Debanjum Singh Solanky
45b8670c25
Fix return type hint for generate_chat_response func
2023-11-10 17:34:19 -08:00
Debanjum Singh Solanky
9b6c5ddba4
Update action row padding in cards on config page of web app
2023-11-10 16:53:25 -08:00
sabaimran
54d4fd0e08
Add chat_model data for logging selected models to telemetry
2023-11-10 16:46:34 -08:00
sabaimran
e695b9ab8c
Use notes in system prompt, rather than in the user message
2023-11-10 15:09:33 -08:00
sabaimran
cec932d88a
Update prompt so that GPT is more context aware with its capabilities
2023-11-10 14:37:11 -08:00
sabaimran
e62788ad79
Await result for determining if user has entries
2023-11-10 13:51:56 -08:00
sabaimran
1a56344f12
Remove the old syncData reference as it no longer exists
2023-11-10 10:10:07 -08:00
Debanjum Singh Solanky
39ad1c6ce6
Release Khoj version 0.14.0
...
Fix Khoj subtitle in manifest of Khoj Obsidian plugin
2023-11-10 00:28:33 -08:00
Debanjum Singh Solanky
745d6bfeed
Add detailed intro message, mention download desktop app for docs sync
2023-11-10 00:20:28 -08:00
Debanjum Singh Solanky
6eb7df717c
Only show search in web app nav pane if user has documents indexed
2023-11-09 19:14:54 -08:00
Debanjum Singh Solanky
c0789dc57b
Use email to get_user_subscription from DB and other DB adapters
...
- Needing user subscription requires chaining function
- Simplify get_file_sources DB adapter
2023-11-09 19:09:57 -08:00
Debanjum Singh Solanky
841ed95521
Move active user profile halo check into nav pane macro on web app
2023-11-09 18:05:19 -08:00
Debanjum Singh Solanky
ddac693762
Hide download desktop app message in web app if synced files exist
2023-11-09 17:47:00 -08:00
Debanjum Singh Solanky
30a9674f25
Mark generated profile pic with subscription circle in web app
2023-11-09 15:22:38 -08:00
Debanjum Singh Solanky
d6e6ed1cfa
Keep single Save button, Show next sync, default to prod Khoj URL in Desktop app
...
- Make mutable syncing variable not a const
- Show next sync time to make users aware of data sync is automated
- Keep a single Save button to reduce confusion. It does what Save All
previously did. Intent to manual sync should Save All
- Default to using app.khoj.dev as default Khoj URL to ease setup
2023-11-09 14:04:58 -08:00
Debanjum Singh Solanky
e1f0128576
Change config migration script to update to 0.15.0 version
...
Next release, 0.14.0 wouldn't contain the migration to Postgres
2023-11-09 12:21:58 -08:00
Debanjum Singh Solanky
17cbbb0b01
Use Consistent Environment Variable for KHOJ_DEBUG
2023-11-09 11:01:28 -08:00
Debanjum Singh Solanky
391db80499
Improve subscribed user profile pictures and nav pane selection
...
- Add yellow halo around subscribed user profile
- Fix highlighting current page in header nav pane
2023-11-09 00:57:05 -08:00
Debanjum Singh Solanky
605058c72a
Allow null user profile picture from Google OAuth in DB
...
- Fix width of generated profile picture generated for user
- Ignore unused Stripe webhook events
2023-11-09 00:46:59 -08:00
Debanjum Singh Solanky
a2609973b8
Disable Subscription if Stripe environment not setup
...
Deduplicate DJANGO_SECRET_KEY and KHOJ_DJANGO_SECRET_KEY to latter
name as prefixed with KHOJ as KHOJ app specific
2023-11-08 19:39:32 -08:00
Debanjum Singh Solanky
09e1235832
Auto update billing card UI on (re/un-)subscribe click on web app
...
Previously required a page load to see the updated billing state after
clicking resubscribe or unsubscribe buttons
2023-11-08 18:38:12 -08:00
Debanjum Singh Solanky
8b8bb15866
Keep sync state in memory, initialized to false in Desktop app
...
Prevent deadlock if desktop app killed in middle of syncing
2023-11-08 18:03:08 -08:00
Debanjum Singh Solanky
c043eb54ae
Use typed entry source instead of raw str to map source to conf in api.py
2023-11-08 18:03:08 -08:00
Debanjum Singh Solanky
8178004e6d
Move Subscription data into separate table in DB. Merge migrations
2023-11-08 18:03:08 -08:00
Debanjum Singh Solanky
3bb10128ef
Move subscription API to separate, independent router
2023-11-08 16:20:27 -08:00
Debanjum Singh Solanky
ec1395d072
Clean, merge subscription update events, API and functions
...
- Reduce webhook triggers for subscription updates
- Merge subscription update API endpoint, functions for (re/un-)subscribe
2023-11-08 15:55:20 -08:00
Debanjum Singh Solanky
ef5c13f968
Keep user subscription state. Update it when user has unsubscribed
2023-11-08 12:08:36 -08:00
Debanjum Singh Solanky
c52affc6d9
Get Khoj Cloud Subscription URL via environment variable
2023-11-08 12:07:53 -08:00
sabaimran
609d358b1a
Use sql datetime comparison for detecting validity of subscription renewal date
...
- Update the unsubscribe endpoint to use query params
- Use subscription id to process unsubscribe endpoint, rather than the customer id
2023-11-07 19:17:36 -08:00