Commit graph

3479 commits

Author SHA1 Message Date
sabaimran
0a568244fd Revert "Convert conversationId int to string before making api request to bulk update file filters"
This reverts commit c9665fb20b.

Revert "Fix handling for new conversation in agents page"

This reverts commit 3466f04992.

Revert "Add a unique_id field for identifiying conversations (#914)"

This reverts commit ece2ec2d90.
2024-09-18 20:36:57 -07:00
Debanjum Singh Solanky
bb2bd77a64 Send chat message to Khoj web app via url query param
- This allows triggering khoj chat from the browser addressbar
- So now if you add Khoj to your browser bookmark with
  - URL: https://app.khoj.dev/?q=%s
  - Keyword: khoj

- Then you can type "khoj what is the news today" to trigger Khoj to
  quickly respond to your query. This avoids having to open the Khoj web
  app before asking your question
2024-09-17 21:50:47 -07:00
Debanjum Singh Solanky
ecdbcd815e Simplify code to remove json codeblock from AI response string 2024-09-17 21:50:47 -07:00
sabaimran
e457720e8a Improve the email templates and better align with new branding 2024-09-17 11:18:25 -07:00
sabaimran
c9665fb20b Convert conversationId int to string before making api request to bulk update file filters 2024-09-16 15:45:23 -07:00
sabaimran
3466f04992 Fix handling for new conversation in agents page 2024-09-16 15:04:49 -07:00
sabaimran
ece2ec2d90
Add a unique_id field for identifiying conversations (#914)
* Add a unique_id field to the conversation object

- This helps us keep track of the unique identity of the conversation without expose the internal id
- Create three staged migrations in order to first add the field, then add unique values to pre-fill, and then set the unique constraint. Without this, it tries to initialize all the existing conversations with the same ID.

* Parse and utilize the unique_id field in the query parameters of the front-end view

- Handle the unique_id field when creating a new conversation from the home page
- Parse the id field with a lightweight parameter called v in the chat page
- Share page should not be affected, as it uses the public slug

* Fix suggested card category
2024-09-16 12:19:16 -07:00
sabaimran
e6bc7a2ba2 Fix links to log in email templates 2024-09-15 19:14:19 -07:00
Debanjum Singh Solanky
79980feb7b Release Khoj version 1.23.2 2024-09-15 03:07:26 -07:00
Debanjum Singh Solanky
575ff103cf Frame chat response error on web app in a more conversational form
Also indicate hitting dislike on the message should be enough to
convey the issue to the developers.
2024-09-15 03:00:49 -07:00
Debanjum Singh Solanky
893ae60a6a Improve handling of harmful categorized responses by Gemini
Previously Khoj would stop in the middle of response generation when
the safety filters got triggered at default thresholds. This was
confusing as it felt like a service error, not expected behavior.

Going forward Khoj will
- Only block responding to high confidence harmful content detected by
  Gemini's safety filters instead of using the default safety settings
- Show an explanatory, conversational response (w/ harm category)
  when response is terminated due to Gemini's safety filters
2024-09-15 02:17:54 -07:00
sabaimran
ec1f87a896 Release Khoj version 1.23.1 2024-09-12 22:46:39 -07:00
sabaimran
2a4416d223 Use prefetch_related for the openai_config when retrieving all chatmodeloptions async 2024-09-12 22:45:43 -07:00
sabaimran
253ca92203 Release Khoj version 1.23.0 2024-09-12 20:25:29 -07:00
Debanjum Singh Solanky
178b78f87b Show debug log, not warning when use default tokenizer for context stuffing 2024-09-12 20:21:01 -07:00
Debanjum
f173188dcf
Support using image generation models like Flux via Replicate (#909)
- Support using image generation models like Flux via Replicate
- Modularize the image generation code
- Make generate better image prompt chat actor add composition details
- Generate vivid images with DALLE-3
2024-09-12 20:19:46 -07:00
Debanjum Singh Solanky
75d3b34452 Extract image generation code into new image processor for modularity 2024-09-12 20:01:32 -07:00
Debanjum Singh Solanky
84051d7d89 Make generate better image prompt chat actor add composition details 2024-09-12 19:58:57 -07:00
Debanjum Singh Solanky
ed12f45a26 Generate vivid images with DALLE-3
It's apparently the default setting in chatgpt app according to the
openai cookbook at https://cookbook.openai.com/articles/what_is_new_with_dalle_3#examples-and-prompts
2024-09-12 19:58:57 -07:00
Debanjum Singh Solanky
1b82aea753 Support using image generation models like Flux via Replicate
Enables using any image generation model on Replicate's Predictions
API endpoints.

The server admin just needs to add text-to-image model on the
server/admin panel in organization/model_name format and input their
Replicate API key with it

Create db migration (including merge)
2024-09-12 19:58:56 -07:00
Brian Kanya
1d512b4986
Use environment variable to set sender email of auth link emails (#907)
Set sender email using `RESEND_EMAIL` environment variable for magic link sent via Resend API for authentication . It was previously hard-coded. This prevented hosting Khoj on other domains. 

Resolves #908
2024-09-12 18:48:11 -07:00
Debanjum
26ca3df605
Support OpenAI's new O1 Model Series (#912)
- Major
   - The new O1 series doesn't seem to support streaming, response_format enforcement, 
      stop words or temperature currently. 
   - Remove any markdown json codeblock in chat actors expecting json responses

- Minor
   - Override block display styling of links by Katex in chat messages
2024-09-12 18:42:51 -07:00
Debanjum Singh Solanky
0685a79748 Remove any markdown json codeblock in chat actors expecting json responses
Strip any json md codeblock wrapper if exists before processing
response by output mode, extract questions chat actor. This is similar
to what is already being done by other chat actors

Useful for succesfully interpreting json output in chat actors when
using non (json) schema enforceable models like o1 and gemma-2

Use conversation helper function to centralize the json md codeblock
removal code
2024-09-12 18:26:15 -07:00
Debanjum Singh Solanky
6e660d11c9 Override block display styling of links by Katex in chat messages
This happens sometimes when LLM respons contains [\[1\]] kind of links
as reference. Both markdown-it and katex apply styling.

Katex's span uses display: block which makes the rendering of these
references take up a whole line by themselves.

Override block styling of spans within an `a' element to prevent such
chat message styling issues
2024-09-12 18:22:46 -07:00
Debanjum Singh Solanky
272eae5d66 Add support for the newly released OpenAI O1 model series for preview
The O1 series doesn't seem to support streaming, stop words or
temperature, response_format currently.
2024-09-12 18:22:46 -07:00
Alexander Matyasko
9570933506
Support Google's Gemini model series (#902)
* Add functions to chat with Google's gemini model series
  * Gracefully close thread when there's an exception in the gemini llm thread
* Use enums for verifying the chat model option type
* Add a migration to add the gemini chat model type to the db model
* Fix chat model selection verification and math prompt tuning
* Fix extract questions method with gemini. Enforce json response in extract questions.
* Add standard stop sequence for Gemini chat response generation

---------

Co-authored-by: sabaimran <narmiabas@gmail.com>
Co-authored-by: Debanjum Singh Solanky <debanjum@gmail.com>
2024-09-12 18:17:55 -07:00
Debanjum Singh Solanky
42b727e926 Revert additional logging enabled to debug automation failures in prod
Additional logging was enabled to debug automation failures in
production since migration chat API to use POST request method (from
earlier GET).

Redirect from http to https was default to use GET instead of POST
method to call /api/chat on redirect. This has been resolved now
2024-09-12 17:56:54 -07:00
sabaimran
14a495cbb5 Release Khoj version 1.22.3 2024-09-12 12:39:04 -07:00
sabaimran
91cee2eaa8 Handle redirects when scheduling chats from automations 2024-09-12 11:36:47 -07:00
sabaimran
4555969d38 Add additional log lines 2024-09-12 10:50:36 -07:00
sabaimran
12897a9a62 Update link to gif demo in README to pull from GitHub 2024-09-11 20:09:26 -07:00
sabaimran
9310f88537 Add quadratic equation gif to docs 2024-09-11 20:07:57 -07:00
sabaimran
d042a055cf Update the demo and simplify the readme 2024-09-11 20:03:48 -07:00
sabaimran
4d3224657f Update the documentation with swanky new demo videos 2024-09-11 19:57:10 -07:00
Debanjum Singh Solanky
2cc4a0769e Release Khoj version 1.22.2 2024-09-11 18:39:24 -07:00
Debanjum Singh Solanky
7f186be742 Fix json payload passed by automations to the new POST chat API 2024-09-11 18:35:31 -07:00
sabaimran
5038d15574 Route to config_page, not to deprecated notion_config_page, on notion callback API 2024-09-11 18:30:23 -07:00
Debanjum Singh Solanky
b61d825cbc Sanitize user attached image in chat message input pane of web app 2024-09-11 18:02:33 -07:00
Debanjum Singh Solanky
de60ad7da6 Update automations to call new POST chat API endpoint 2024-09-11 17:28:40 -07:00
Debanjum Singh Solanky
055ead550c Update desktop shortcut, web app factchecker to use new POST chat API 2024-09-11 17:28:32 -07:00
Debanjum Singh Solanky
bc2e889d72 Update chat director, client tests to call chat API using new POST method 2024-09-11 17:28:06 -07:00
Debanjum Singh Solanky
3f51af9a96 Keep the GET chat API endpoint for a bit before deprecating it
This is to avoid breaking non-updated Khoj clients
2024-09-11 16:50:10 -07:00
Debanjum Singh Solanky
241b9009ba Update OpenAI chat actor tests to handle more questions being extracted 2024-09-11 16:16:55 -07:00
Debanjum Singh Solanky
03befc9b12 Use consistent user attached image placeholder text for chat actors
Get information sources and get output mode don't actually see the
images. They just get placeholder text to indicate that the user
attached an image to their message for context
2024-09-11 16:16:55 -07:00
Debanjum Singh Solanky
04363a504c Prompt Whisper to know "Khoj" term for speech to text transcription 2024-09-11 16:16:55 -07:00
Debanjum Singh Solanky
3dcc8695b2 Improve vertical alignment of lists in chat messages on web app
- Make train of thought icons to be top aligned, next to the
  their intermediate step heading
- Add margin bottom to ordered, unordered lists in chat message,
  similar to how it is already added for paragraphs
2024-09-11 16:16:55 -07:00
Debanjum Singh Solanky
179357b28a Default to gpt-4o-mini as online chat model 2024-09-11 16:16:55 -07:00
sabaimran
ae74c6ca55 Release Khoj version 1.22.1 2024-09-11 13:03:53 -07:00
sabaimran
cd5db277f3 Fix sync to async issue when getting all valid vision configs 2024-09-11 12:57:54 -07:00
sabaimran
9b12290c17 Release Khoj version 1.22.0 2024-09-11 11:21:02 -07:00