Commit graph

3276 commits

Author SHA1 Message Date
sabaimran
c83b8f2768
Allow just one worker to be the background schedule leader (#836)
* Add a leader election mechanism to circumvent runtime issues for multiple schedulers

- Reduce the load on the DB and risk of issues on the service side by limiting the execution environment to one elected leader at a given time. This one is responsible for managing all of the execution of the jobs, though all workers are capable of adding and removing jobs

* Set a max duration for the schedule leader position (12 hrs), add some error if automation not added successfully
2024-06-28 13:13:25 +05:30
sabaimran
80fe5ce182 Fix user not authenticated interpretation error 2024-06-27 21:13:54 +05:30
Raghav Tirumale
24a0d8b073
Add OS Level Shortcut Window for Quick Access to Khoj Desktop (#815)
* rough sketch of desktop shortcuts. many bugs to fix still

* working MVP of desktop shortcut khoj

* UI fixes

* UI improvements for editable shortcut message

* major rendering fix to prevent clipboard text from getting lost

* UI improvements and bug fixes

* UI upgrades: custom top bar, edit sent message and color matching

* removed debug javascript file

* font reverted to Noto Sans

* cleaning up the code and removing diffs

* UX fixes

* cleaning up unused methods from html

* front end for button to send user back to main window to continue conversation

* UX fix for window and continue conversation support added

* migrated common js functions into chatutils.js

* Fix window closing issue in macos by

1. Use a helper function to determine if the window is open by seeing if there's a browser window with shortcut.html loaded
2. Use the  event listener on the window to handle teardown

* removed extra comment and renamed continue convo button

---------

Co-authored-by: sabaimran <narmiabas@gmail.com>
2024-06-27 07:20:13 -07:00
sabaimran
870d9ecdbf
Add a fact checker feature with updated styling (#835)
- Add an experimental feature used for fact-checking falsifiable statements with customizable models. See attached screenshot for example. Once you input a statement that needs to be fact-checked, Khoj goes on a research spree to verify or refute it.
- Integrate frontend libraries for [Tailwind](https://tailwindcss.com/) and [ShadCN](https://ui.shadcn.com/) for easier UI development. Update corresponding styling for some existing UI components. 
- Add component for model selection 
- Add backend support for sharing arbitrary packets of data that will be consumed by specific front-end views in shareable scenarios
2024-06-27 18:45:38 +05:30
sabaimran
3b7a9358c3
Add our first view via Next.js for Agents (#817)
Initialize our migration to use Next.js for front-end views via Agents. This includes setup for getting authenticated users, reading in available agents, setting up a pop-up modal when you're clicking on an agent, and allowing users to start new conversations with agents.

Best attempt at an in-place migration, though there are some noticeable differences.

Also adds view for chat that are not being used, but in experimental phase.
2024-06-27 13:56:16 +05:30
Debanjum Singh Solanky
afbeee9e82 Rename copy-button to more general chat-action-button in Obsidian client
- Use 4 space indent of activateView function in pane_view component
2024-06-26 18:09:23 +05:30
sabaimran
8c12a69570 Fix issue in anthropic chat when khoj message becomes top message
This is because Anthropic requires the first message in the chat history to be from the user.
2024-06-26 12:59:34 +05:30
Debanjum Singh Solanky
4f89319b40 Release Khoj version 1.15.0 2024-06-26 10:38:16 +05:30
Debanjum Singh Solanky
bbfd320ed4 Use Yarn instead of NPM to bump Desktop, Obsidian client versions 2024-06-26 10:37:58 +05:30
Debanjum Singh Solanky
c793d8a69e Add Validation logic to save PaintModel. Use API key from Paint Model
Rename Paint Model, Adapters to TextToImage for consistency
2024-06-26 10:16:26 +05:30
Debanjum Singh Solanky
1acf969c6e Do not require OpenAI to generate image as local chat + sd3 works now
Previously the text_to_image helper would only trigger the image
generation flow if OpenAI client was setup. This is not required
anymore as offline chat model + sd3 API works. So remove that check
2024-06-26 10:16:26 +05:30
Debanjum Singh Solanky
2c4bf91a61 Allow user to set paint model to use from web client config page 2024-06-26 10:16:26 +05:30
Debanjum Singh Solanky
eb09aba747 Remove quotes wrapping the prompt from being passed to image gen model 2024-06-26 10:16:26 +05:30
Debanjum Singh Solanky
fdd4c02461 Use shorter prompt generator to prompt SD3 to create better images 2024-06-26 10:16:26 +05:30
Debanjum Singh Solanky
eda33e092f Enable using Stable Diffusion 3 for Image Generation via API 2024-06-26 10:16:26 +05:30
Debanjum
a25689fabf
Use user theme in Obsidian for Khoj plugin styling (#825)
Makes the Khoj chat in the Obsidian plugin adapt better to the user theme, making it feel more seamless, and helps with dark mode compatibility
2024-06-26 10:14:17 +05:30
Debanjum Singh Solanky
cfe46fd9f5 Add Border Color instead of BG Color for Chat Message in Obsidian 2024-06-26 08:11:04 +05:30
sabaimran
fb818ead60 Use active bg instead of code background for khoj response 2024-06-26 08:05:13 +05:30
sabaimran
a4b2552540 Update conversation session selection menu to use Obsidian theme colors as well 2024-06-26 08:05:13 +05:30
sabaimran
da5b07e913 Remove custom styling on the reference buttons 2024-06-26 08:05:13 +05:30
sabaimran
c4a1ae9375 Make the Khoj Obsidian plugin more user theme friendly
Use the CSS variables from the theme for the Khoj UI components
2024-06-26 08:04:17 +05:30
Debanjum Singh Solanky
d6fe5d9a63 Pass current component as arg to markdown renderer in chat view
This doesn't work on search modal, but hopefully will get resolved
once we migrate search into a view from a modal
2024-06-24 16:12:20 +05:30
Debanjum Singh Solanky
0d04018622 Install pydantic with optional email validator package
Otherwise Khoj fails on startup. Not sure why, must be new changes to
pydantic?
2024-06-24 16:12:20 +05:30
Debanjum Singh Solanky
6f280b1ccc Split setup of specific OpenAI API proxies into separate doc pages 2024-06-24 16:12:20 +05:30
Debanjum Singh Solanky
68e7c297e0 Add Advanced Self Hosting Section, Improve Self Hosting, OpenAI Proxy Docs
- Add instructions for self-hosted users with info, warning boxes to
  avoid, fix common issues when setting up Khoj server
- Create new Advanced Self Hosting section
  - Extract Advanced Self-Hosting Sections from the Advanced Page and
    move them to separate Pages under Advanced Self Hosting section
- Improve OpenAI Proxy Docs
  - Put Ollama setup as a section under OpenAI API Proxy page instead
    of a separate page
  - Add Section to use Khoj with chat model from LM Studio
  - Update LiteLLM docs to use chat model from LM Studio
2024-06-24 16:12:20 +05:30
Debanjum Singh Solanky
732332a3c5 Spell fix s/e.g/e.g./ across code, tests and docs 2024-06-24 15:24:45 +05:30
Debanjum Singh Solanky
8fc7f980aa Revert KHOJ_DOMAIN to only support single domain.
Multiple domain support didn't generalize to other portions where it
is used
2024-06-24 15:24:45 +05:30
sabaimran
4110e71e84 Add info in the documentation about text to speech 2024-06-24 12:46:33 +05:30
sabaimran
939811e9b5 Fix conversation look up logic 2024-06-24 09:10:03 +05:30
Debanjum Singh Solanky
a4d88612c1 Just use yarn for package version locking. Remove npm package lock 2024-06-23 16:06:20 +05:30
Debanjum Singh Solanky
55be90cdd2 Sanitize user input fields on Automations page of web client
Use Dompurify to sanitize user input
2024-06-23 14:14:47 +05:30
Debanjum Singh Solanky
1c7a562880 Generate automation cards via DOM scripting 2024-06-23 13:22:38 +05:30
Debanjum Singh Solanky
57a36967bf Run Obsidian version script in bump_version.sh to write to versions.json
This handles updates from manifest.json minAppVersion field to the
versions.json file.

The minAppVersion field is for the minimum Obsidian app version
supported by a Khoj plugin version
2024-06-23 08:18:55 +05:30
Debanjum Singh Solanky
c7c32a7467 Improve online chat reference extraction in Khoj.el Emacs package
- Handle online references with no title
- Improve handling references which are arrays instead of lists
2024-06-23 08:13:36 +05:30
Debanjum Singh Solanky
9d33d8c0fa Upgrade typescript eslint dev dependency of Khoj Obsidian plugin 2024-06-23 07:36:49 +05:30
Debanjum
a94062469a
Automatically Find Similar Notes on Emacs in Background (#827)
Khoj will find and display notes similar to the current entry in the side pane when
1. find similar is open in side pane and
2. cursor has moved to a new entry

### Major
- Find similar notes to current note at cursor automatically in background
- Only show headings of search result and increase default results count

### Minor
- Pass absolute path of file to index from khoj.el emacs client
- Update help message to only show the smaller set of new keybindings
- Fix edge cases in loading some chat sessions
2024-06-23 07:36:11 +05:30
sabaimran
38090b2553 In dockerize.yml file, revert the added configuration 2024-06-22 21:11:25 +05:30
sabaimran
a53178cab9
Add developer support for using next.js to serve generated static files (#814)
To improve the developer experience for front-end development, we're migrating to Next.js. In order to do this migration page-by-page, we're using static site generation via Next.js. This also helps us avoid making cross site requests from front-end to back-end for the time being, while giving a ramp to separating out server and client if needed for scale down the road.

Dev instructions for using the next.js setup are in the added README.

This adds scaffolding for including the built files in the python package as well as the docker images. Docker setup has been tested locally. In order to verify the build is working as expected, we can navigate to the {khoj_host}:42110/experimental and verify that the experiment page comes up.

This setup works with serving static files included in the src/interface/web folder from the Django app. The key bit for understanding the setup is in the yarn export command in package.json.
2024-06-22 20:12:41 +05:30
Debanjum Singh Solanky
59edb99f04 Simplify, improve bump version development script
- Just use in-built `npm version' command to update desktop, obsidian version
- Upgrade by major, minor or patch version using new -t flag in script
  E.g bump_version -t minor
2024-06-22 18:19:38 +05:30
Debanjum Singh Solanky
abd6f58aee Upgrade Desktop app package dependencies 2024-06-22 17:38:52 +05:30
Debanjum Singh Solanky
f413dc62cd Upgrade Obsidian plugin dependencies. Add package lock file for it
Add it to bump_version script as well.
2024-06-22 17:38:52 +05:30
Debanjum Singh Solanky
1d7d51a7ab Upgrade Documentation packages 2024-06-22 17:38:48 +05:30
Debanjum Singh Solanky
22f6db0a6b Upgrade RapidOCR and enable for Python 3.12. Fix PDF OCR test 2024-06-22 16:01:55 +05:30
Debanjum Singh Solanky
55a23eae25 Upgrade pillow to fix pytest workflow failure 2024-06-22 15:17:43 +05:30
Debanjum Singh Solanky
7e277e9381 Fix getting file-toggle-button element in chat of web app 2024-06-21 15:54:38 +05:30
Debanjum Singh Solanky
fa7b40ab86 Automatically respond with Voice if subscribed user sent Voice message 2024-06-21 15:53:01 +05:30
Debanjum Singh Solanky
5e5fe4b7af Improve font size, spacing of conversation session on desktop app 2024-06-21 12:25:35 +05:30
sabaimran
d3c0111121 Include base URL when using openai api config in extract questions. Close #831 2024-06-21 12:18:50 +05:30
sabaimran
b9966eb3d4
Add support for text to speech in chat responses (#821)
* Enable speech to text responses in khoj chat

- Current issue: reads out all the markdown formatting, plus waits for the whole result to be streamed before playing it

* Extract content from markdown-formatted text

* Add a loader for while you're waiting for Khoj's response

* Add user configuration option for chat model options, allow server side configuration for option list

* Join up APIs, views, admin pages to allow configuring custom voice models
2024-06-21 11:30:28 +05:30
Debanjum Singh Solanky
427575e958 Improve khoj chat new, delete session flows
When create new conversation session, automatically request query. As
that is expected next action after creating new session

Pass session-id to khoj-chat to allow reuse from
create-new-conversation func

When delete conversation session, do not call load chat session.
Unnecessary action.

Use thread-last to improve code flow in new, delete conversation funcs
2024-06-21 10:54:59 +05:30