Commit Graph

3291 Commits

Author SHA1 Message Date
Debanjum
f8b887cabd Allow using OpenAI (compatible) API for Speech to Text transcription 2025-01-15 19:19:31 +07:00
Debanjum
182c49b41c Prefer explicitly configured OpenAI API url, key for image gen model
Previously we'd use the general openai client, even if the image
generation model has a different api key and base url set.

This change uses the openai config of the image generation models when
set. Otherwise it fallbacks to use the first openai api provider set
2025-01-15 19:19:31 +07:00
Debanjum
24204873c8 Use same openai base url env var name as the official openai client
This eases re-use of the OpenAI API across all openai clients,
including chat, image generation, speech to text.

Resolves #1085
2025-01-15 19:19:30 +07:00
Debanjum
63dd3985b5 Support using Embeddings Model exposed via OpenAI (compatible) API (#1051)
This change adds the ability to use OpenAI, Azure OpenAI or any embedding model exposed behind an OpenAI compatible API (like Ollama, LiteLLM, vLLM etc.).

Khoj previously only supported HuggingFace embedding models running locally on device or via HuggingFaceW inference API endpoint. This allows using commercial embedding models to index your content with Khoj.
2025-01-15 17:39:54 +07:00
Debanjum
9355381fac Catch error in call to data sources, output format selection tool AI
Previously if the call to this tool AI failed, the API call would
non-gracefully fail on server. This would leave the client hanging in
a wierd state (e.g with spinner running on web app with no indication
of issue).

Also do not show filters in query debug log lines when no filters in query
2025-01-15 13:09:50 +07:00
Debanjum
24ab8450ba Handle scenario where read chat stream error is not json on web app 2025-01-15 13:09:50 +07:00
sabaimran
7f329e7e9d Fix configuration of name field for chatmodel options during initalization 2025-01-12 22:37:08 -08:00
Debanjum
51a774c993 Add contrast to setting card inputs in dark mode on web app 2025-01-11 14:50:47 +07:00
Debanjum
9e8b8dc5a2 Toggle showing api key on web settings page via a visibility toggle
- Background
  Access to the clipboard API is disabled by certain browsers in non
  localhost http scenarios for security reasons.

  So the copy API key button doesn't work when khoj is self-hosted
  with authentication enabled at a non localhost domain

- Change
  This change enables copying API keys by manual text highlight + copy
  if copy button is disabled

Resolves #1070
2025-01-11 14:50:47 +07:00
Debanjum
25c39bd7da Extract api keys setting card into separate component on web app 2025-01-11 14:50:46 +07:00
Debanjum
6e955e158b Use normalized email address for new users
Not check email deliverability for now to allow air-gapped usage or
authenticated/multi-user setups with admin managed otp

Closes #1069
2025-01-11 12:28:40 +07:00
sabaimran
85c34a5f0f Merge pull request #1018 from hjamet/master
This PR delivers comprehensive improvements to the Khoj plugin across multiple key areas:

🔍 Search Enhancements:
- Added visual loading indicators during search operations
- Implemented color-coded results to distinguish between vault and external files
- Added abort logic for previous requests to improve performance
- Enhanced search feedback with clear status indicators
- Improved empty state handling

🔄 Synchronization Improvements:
- Added configurable sync interval setting in minutes
- Implemented manual "Sync new changes" command
- Enhanced sync timer management with automatic restart
- Improved notification system for sync operations

📁 Folder Management:
- Added granular folder selection for sync
- Implemented intuitive folder suggestion modal
- Enhanced folder list visualization

💅 UI/UX Improvements:
- Added loading animations and spinners
- Enhanced search results visualization with color coding
- Refined chat interface styling
- Improved overall settings panel organization

🔧 Technical Improvements:
- Refactored search and synchronization logic
- Implemented proper request cancellation
- Enhanced error handling and user feedback
- Improved code organization and maintainability
2025-01-10 21:24:12 -08:00
Patrick Jackson
6e0c767ff0 Use the configured OpenAI Base URL for Automations (#1065)
This change makes Automations (and possibly other entrypoints) use the configured OpenAI-compatible server if that has been set. Without this change it tries to use the hardcoded OpenAI provider.
2025-01-10 17:17:51 -08:00
Debanjum
1b5826d8b6 Support using Embeddings Model exposed via OpenAI (compatible) API 2025-01-10 23:48:04 +07:00
Debanjum
65f1c27963 Remove old, big warning about Khoj not configured on server init
- Just say using default config. This old khoj.yml settings mechamism
  isn't standard, so not having a configured khoj.yml isn't a concern
- Deep link to desktop download instead of the whole download page as
  android etc. are also on it, which don't help with syncing docs
2025-01-10 23:46:27 +07:00
Debanjum
3cc6597b49 Support Azure OpenAI API endpoint (#1048)
OpenAI chat models deployed on Azure are (ironically) not OpenAI API compatible endpoints.
This change enables using OpenAI chat models deployed on Azure with Khoj.
2025-01-10 08:35:03 -08:00
Debanjum
dd63bd8bcf Fix dark mode dropdown colors of phone no. country code on web settings page
Resolves #1046
2025-01-10 00:10:51 +07:00
Debanjum
01d27f5220 Do not show user logout button on web app side pane in anoymous mode
Refer
https://github.com/khoj-ai/khoj/issues/1050#issuecomment-2579119234
2025-01-09 21:18:50 +07:00
Debanjum
1eaa54b0ae Make PAT token requirement optional for Github indexing for now
The github integration has not been tested and may still be broken.
This change at least makes it easier to add repositories without
needing a PAT token if/when it does work.
2025-01-09 20:42:38 +07:00
sabaimran
c448c49811 Clean-up some code on homepage and disable initial card animations because of jitter 2025-01-08 22:07:23 -08:00
Henri Jamet
f42b0cb08c Refactor comments and CSS for improved clarity in Khoj plugin
- Translated comments from French to English for better accessibility and understanding.
- Updated CSS comment for loading animation to reflect the change in language.
- Enhanced code readability by ensuring consistent language usage across multiple files.
- Improved user experience by clarifying the purpose of various functions and settings in the codebase.
2025-01-08 09:31:43 +01:00
sabaimran
875cdde9b9 Release Khoj version 1.33.2 2025-01-07 15:32:18 -08:00
sabaimran
8d028e10c6 Fix populating login url in sign in email 2025-01-07 14:53:00 -08:00
omahs
36bdaedd2d Fix typos in Khoj Docs (#1033) 2025-01-07 15:55:57 +07:00
sabaimran
25c1c1c591 Release Khoj version 1.33.1 2025-01-06 09:08:01 -08:00
sabaimran
689d9d8b3a Update formatting in admin.py and utils.py 2025-01-06 09:07:28 -08:00
thinker007
aa442c28eb Handle reporting chat estimated cost when some fields unavailable (#1026)
Fix AttributeError: 'NoneType' object has no attribute 'model_extra'

* cost = chunk.usage.model_extra.get("estimated_cost", 0) if hasattr(chunk, "usage") and chunk.usage else 0  # Estimated costs returned by DeepInfra API
2025-01-06 09:03:49 -08:00
sabaimran
4aed6f7e08 Add a link around the header khojlogotype to go home 2025-01-06 08:55:00 -08:00
Debanjum
266d274e21 Make automation should_notify check robust to non json mode chat models
Use clean_json to handle automation should_notify check For gemini and
other chat models where enforcing json mode is problematic, not supported
2025-01-06 20:16:32 +07:00
Debanjum
9a5e3583cf Remove bullet styling only from sidebar items on web app
Previous fix had removed bullet styling from all components in web
app. This made chat messages on the web app lose bullet styling too.
2025-01-06 20:15:42 +07:00
sabaimran
eb9aadf72a Add an Obsidian README documentation for development 2025-01-05 19:06:27 -08:00
sabaimran
616cc189d1 Remove bullet points from li styling explicitly 2025-01-05 13:52:08 -08:00
sabaimran
a5705a5aa6 After agent prompt safe check is parsed as json, load it into a json object 2025-01-05 13:40:20 -08:00
sabaimran
756f4a2a66 Update regeneration logic to run for all entries now that we have a single search model ID 2025-01-03 15:16:10 -08:00
sabaimran
0ef787b57c Set waitBeforeSeconds to 0 2024-12-30 15:08:34 -08:00
sabaimran
8f69eb949b Release Khoj version 1.33.0 2024-12-29 10:39:26 -08:00
Henri Jamet
1aff78a969 Enhance Khoj plugin search functionality and loading indicators
- Added visual loading indicators to the search modal for improved user experience during search operations.
- Implemented logic to check if search results correspond to files in the vault, with color-coded results for better clarity.
- Refactored the getSuggestions method to handle loading states and abort previous requests if necessary.
- Updated CSS styles to support new loading animations and result file status indicators.
- Improved the renderSuggestion method to display file status and provide feedback for files not in the vault.
2024-12-29 16:19:42 +01:00
Henri Jamet
7d28b46ca7 Implement sync interval setting and enhance synchronization timer in Khoj plugin
- Added a new setting for users to configure the sync interval in minutes, allowing for more flexible automatic synchronization.
- Introduced methods to start and restart the synchronization timer based on the configured interval.
- Updated the synchronization logic to use the user-defined interval instead of a fixed 60 minutes.
- Improved code readability and organization by refactoring the sync timer logic.
2024-12-29 13:23:08 +01:00
Henri Jamet
c5c9e0072c Enhance Khoj plugin settings and UI for folder synchronization
- Added a new setting to manage sync folders, allowing users to specify which folders to sync or to sync the entire vault.
- Implemented a modal for folder suggestions to facilitate folder selection.
- Updated the folder list display to show currently selected folders with options to remove them.
- Improved CSS styles for chat interface and folder list for better user experience.
- Refactored code for consistency and readability across multiple files.
2024-12-29 13:07:21 +01:00
Henri Jamet
833ab52986 Add manual sync command to Khoj plugin
- Introduced a new command 'Sync new changes' to allow users to manually synchronize new modifications.
- The command updates the content index without regenerating it, ensuring only new changes are synced.
- User-triggered notifications are displayed upon successful sync.
2024-12-29 12:51:52 +01:00
Debanjum
90685ccbb0 Show error message if update automation via web app fails 2024-12-26 22:21:56 -08:00
Debanjum
c4bb92076e Convert async create automation api endpoints to sync 2024-12-26 21:59:55 -08:00
Debanjum
9674de400c Format AI response to send in automation email
Previously we sent the AI response directly. This change post
processes the AI response with the awareness that it is to be sent to
the user as an email to improve rendering and quality of the emails.
2024-12-26 21:04:50 -08:00
Debanjum
6d219dcc1d Switch to let Khoj infer chat query based on user automation query
This tries to decouple the automation query from the chat query. So
the chat model doesn't have to know it is running in an automation
context or figure how to notify user or send automation response. It
just has to respond to the AI generated `query_to_run' corresponding
to the `scheduling_request` automation by the user.

For example, a `scheduling_request' of `notify me when X happens'
results in the automation calling the chat api with a `query_to_run`
like `tell me about X` and deciding if to notify based on information
gathered about X from the scheduled run. If these two are not
decoupled, the chat model may respond with how it can notify about X
instead of just asking about it.

Swap query_to_run with scheduling_request on the automation web page
2024-12-26 21:04:50 -08:00
Debanjum
3600a9a4f3 Ask reason before decision to improve to_notify decider automation AI
Previously it just gave a decision. This was hard to debug during
prompt tuning. Asking for reason before decision improves models
decision quality.
2024-12-26 21:04:50 -08:00
Debanjum
dcc5073d16 Fix the to_notify decider automation chat actor. Add detailed logging 2024-12-26 21:04:50 -08:00
sabaimran
5985ef4c7c Further improve prompts 2024-12-24 12:11:27 -08:00
sabaimran
012e0ef882 Add tooltip for file input ref. 2024-12-24 11:20:39 -08:00
sabaimran
a58b3b4a37 Remove some of the step one suggestions 2024-12-24 10:52:42 -08:00
sabaimran
cf78f426d3 Merge branch 'master' of github.com:khoj-ai/khoj into features/update-home-page 2024-12-24 09:52:06 -08:00