Merge branch 'master' into features/advanced-reasoning

This commit is contained in:
Debanjum Singh Solanky
2024-10-13 03:06:23 -07:00
2 changed files with 26 additions and 21 deletions

View File

@@ -3,14 +3,14 @@
<div align="center"> <div align="center">
[![test](https://github.com/khoj-ai/khoj/actions/workflows/test.yml/badge.svg)](https://github.com/khoj-ai/khoj/actions/workflows/test.yml) [![test](https://github.com/khoj-ai/khoj/actions/workflows/test.yml/badge.svg)](https://github.com/khoj-ai/khoj/actions/workflows/test.yml)
[![dockerize](https://github.com/khoj-ai/khoj/actions/workflows/dockerize.yml/badge.svg)](https://github.com/khoj-ai/khoj/pkgs/container/khoj) [![docker](https://github.com/khoj-ai/khoj/actions/workflows/dockerize.yml/badge.svg)](https://github.com/khoj-ai/khoj/pkgs/container/khoj)
[![pypi](https://github.com/khoj-ai/khoj/actions/workflows/pypi.yml/badge.svg)](https://pypi.org/project/khoj/) [![pypi](https://github.com/khoj-ai/khoj/actions/workflows/pypi.yml/badge.svg)](https://pypi.org/project/khoj/)
![Discord](https://img.shields.io/discord/1112065956647284756?style=plastic&label=discord) [![discord](https://img.shields.io/discord/1112065956647284756?style=plastic&label=discord)](https://discord.gg/BDgyabRM6e)
</div> </div>
<div align="center"> <div align="center">
<b>The open-source, personal AI for your digital brain</b> <b>Your AI second brain</b>
</div> </div>
<br /> <br />
@@ -19,11 +19,13 @@
[📑 Docs](https://docs.khoj.dev) [📑 Docs](https://docs.khoj.dev)
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span> <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
[🏮 App](https://khoj.dev) [🌐 Web](https://khoj.dev)
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
[🔥 App](https://app.khoj.dev)
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span> <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
[💬 Discord](https://discord.gg/BDgyabRM6e) [💬 Discord](https://discord.gg/BDgyabRM6e)
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span> <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
[📚 Blog](https://blog.khoj.dev) [✍🏽 Blog](https://blog.khoj.dev)
</div> </div>
@@ -31,14 +33,17 @@
*** ***
[Khoj](https://khoj.dev) is a personal, open-source AI application for you to extend your capabilities. [Khoj](https://khoj.dev) is a personal AI app to extend your capabilities. It smoothly scales up from an on-device personal AI to a cloud-scale enterprise AI.
- Share your documents to extend your digital brain.
- Access the internet, getting fresh information. - Chat with any local or online LLM (e.g llama3, qwen, gemma, mistral, gpt, claude, gemini).
- You can share pdf, markdown, org-mode, notion files and github repositories. - Get answers from the internet and your docs (including image, pdf, markdown, org-mode, word, notion files).
- Fast, accurate semantic search on top of your docs. - Access it from your Browser, Obsidian, Emacs, Desktop, Phone or Whatsapp.
- Create images, talk out loud, play your messages. - Build agents with custom knowledge bases and tools.
- Available Desktop, Emacs, Obsidian, Web and Whatsapp. - Create automations to get personal newsletters and smart notifications.
- Find relevant docs quickly and easily using our advanced semantic search.
- Generate images, talk out loud, play your messages.
- Khoj is open-source, self-hostable. Always. - Khoj is open-source, self-hostable. Always.
- Run it privately on [your computer](https://docs.khoj.dev/get-started/setup) or try it on our [cloud app](https://app.khoj.dev).
*** ***

View File

@@ -937,21 +937,21 @@ class ConversationAdapters:
def get_conversation_config(user: KhojUser): def get_conversation_config(user: KhojUser):
subscribed = is_user_subscribed(user) subscribed = is_user_subscribed(user)
if not subscribed: if not subscribed:
return ConversationAdapters.get_default_conversation_config() return ConversationAdapters.get_default_conversation_config(user)
config = UserConversationConfig.objects.filter(user=user).first() config = UserConversationConfig.objects.filter(user=user).first()
if config: if config:
return config.setting return config.setting
return ConversationAdapters.get_advanced_conversation_config() return ConversationAdapters.get_advanced_conversation_config(user)
@staticmethod @staticmethod
async def aget_conversation_config(user: KhojUser): async def aget_conversation_config(user: KhojUser):
subscribed = await ais_user_subscribed(user) subscribed = await ais_user_subscribed(user)
if not subscribed: if not subscribed:
return await ConversationAdapters.aget_default_conversation_config() return await ConversationAdapters.aget_default_conversation_config(user)
config = await UserConversationConfig.objects.filter(user=user).prefetch_related("setting").afirst() config = await UserConversationConfig.objects.filter(user=user).prefetch_related("setting").afirst()
if config: if config:
return config.setting return config.setting
return ConversationAdapters.aget_advanced_conversation_config() return ConversationAdapters.aget_advanced_conversation_config(user)
@staticmethod @staticmethod
async def aget_voice_model_config(user: KhojUser) -> Optional[VoiceModelOption]: async def aget_voice_model_config(user: KhojUser) -> Optional[VoiceModelOption]:
@@ -1012,22 +1012,22 @@ class ConversationAdapters:
return await ChatModelOptions.objects.filter().prefetch_related("openai_config").afirst() return await ChatModelOptions.objects.filter().prefetch_related("openai_config").afirst()
@staticmethod @staticmethod
def get_advanced_conversation_config(): def get_advanced_conversation_config(user: KhojUser):
server_chat_settings = ServerChatSettings.objects.first() server_chat_settings = ServerChatSettings.objects.first()
if server_chat_settings is not None and server_chat_settings.chat_advanced is not None: if server_chat_settings is not None and server_chat_settings.chat_advanced is not None:
return server_chat_settings.chat_advanced return server_chat_settings.chat_advanced
return ConversationAdapters.get_default_conversation_config() return ConversationAdapters.get_default_conversation_config(user)
@staticmethod @staticmethod
async def aget_advanced_conversation_config(): async def aget_advanced_conversation_config(user: KhojUser = None):
server_chat_settings: ServerChatSettings = ( server_chat_settings: ServerChatSettings = (
await ServerChatSettings.objects.filter() await ServerChatSettings.objects.filter()
.prefetch_related("chat_advanced", "chat_advanced__openai_config") .prefetch_related("chat_advanced", "chat_advanced__openai_config")
.afirst() .afirst()
) )
if server_chat_settings is not None or server_chat_settings.chat_advanced is not None: if server_chat_settings is not None and server_chat_settings.chat_advanced is not None:
return server_chat_settings.chat_advanced return server_chat_settings.chat_advanced
return await ConversationAdapters.aget_default_conversation_config() return await ConversationAdapters.aget_default_conversation_config(user)
@staticmethod @staticmethod
def create_conversation_from_public_conversation( def create_conversation_from_public_conversation(