Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ clean-backend-docker:
@docker container rm -f nest-backend >/dev/null 2>&1 || true
@docker container rm -f nest-cache >/dev/null 2>&1 || true
@docker container rm -f nest-db >/dev/null 2>&1 || true
@docker container rm -f nest-nestbot >/dev/null 2>&1 || true
@docker container rm -f nest-worker >/dev/null 2>&1 || true
@docker image rm -f nest-backend:base >/dev/null 2>&1 || true
@docker image rm -f nest-local-backend >/dev/null 2>&1 || true
@docker image rm -f nest-local-nestbot >/dev/null 2>&1 || true
@docker image rm -f nest-snapshot-video >/dev/null 2>&1 || true
@docker volume rm -f nest-local_backend-venv >/dev/null 2>&1 || true
@docker volume rm -f nest-local_cache-data >/dev/null 2>&1 || true
@docker volume rm -f nest-local_nestbot-venv >/dev/null 2>&1 || true

create-superuser:
@CMD="python manage.py createsuperuser" $(MAKE) exec-backend-command-it
Expand All @@ -44,6 +47,12 @@ exec-backend-command-it:
exec-db-command-it:
@docker exec -it nest-db $(CMD)

exec-nestbot-command:
@docker exec -i nest-nestbot $(CMD)

exec-nestbot-command-it:
@docker exec -it nest-nestbot $(CMD) 2>/dev/null

clear-cache:
@CMD="python manage.py clear_cache" $(MAKE) exec-backend-command

Expand Down
26 changes: 13 additions & 13 deletions backend/apps/ai/Makefile
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
ai-run-agentic-rag:
@echo "Running agentic RAG"
@CMD="python manage.py ai_run_agentic_rag" $(MAKE) exec-backend-command
@CMD="python manage.py ai_run_agentic_rag" $(MAKE) exec-nestbot-command

ai-update-chapter-chunks:
@echo "Updating chapter chunks"
@CMD="python manage.py ai_update_chapter_chunks" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_chapter_chunks" $(MAKE) exec-nestbot-command

ai-update-chapter-context:
@echo "Updating chapter context"
@CMD="python manage.py ai_update_chapter_context" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_chapter_context" $(MAKE) exec-nestbot-command

ai-update-committee-chunks:
@echo "Updating committee chunks"
@CMD="python manage.py ai_update_committee_chunks" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_committee_chunks" $(MAKE) exec-nestbot-command

ai-update-committee-context:
@echo "Updating committee context"
@CMD="python manage.py ai_update_committee_context" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_committee_context" $(MAKE) exec-nestbot-command

ai-update-event-chunks:
@echo "Updating event chunks"
@CMD="python manage.py ai_update_event_chunks" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_event_chunks" $(MAKE) exec-nestbot-command

ai-update-event-context:
@echo "Updating event context"
@CMD="python manage.py ai_update_event_context" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_event_context" $(MAKE) exec-nestbot-command

ai-update-project-chunks:
@echo "Updating project chunks"
@CMD="python manage.py ai_update_project_chunks" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_project_chunks" $(MAKE) exec-nestbot-command

ai-update-project-context:
@echo "Updating project context"
@CMD="python manage.py ai_update_project_context" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_project_context" $(MAKE) exec-nestbot-command

ai-update-repository-chunks:
@echo "Updating repository chunks"
@CMD="python manage.py ai_update_repository_chunks" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_repository_chunks" $(MAKE) exec-nestbot-command

ai-update-repository-context:
@echo "Updating repository context"
@CMD="python manage.py ai_update_repository_context" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_repository_context" $(MAKE) exec-nestbot-command

ai-update-slack-message-chunks:
@echo "Updating Slack message chunks"
@CMD="python manage.py ai_update_slack_message_chunks" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_slack_message_chunks" $(MAKE) exec-nestbot-command

ai-update-slack-message-context:
@echo "Updating Slack message context"
@CMD="python manage.py ai_update_slack_message_context" $(MAKE) exec-backend-command
@CMD="python manage.py ai_update_slack_message_context" $(MAKE) exec-nestbot-command
3 changes: 2 additions & 1 deletion backend/apps/ai/models/chunk.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""AI app chunk model."""

from django.db import models
from langchain.text_splitter import RecursiveCharacterTextSplitter
from pgvector.django import VectorField

from apps.ai.models.context import Context
Expand Down Expand Up @@ -34,6 +33,8 @@ def bulk_save(chunks, fields=None):
@staticmethod
def split_text(text: str) -> list[str]:
"""Split text into chunks."""
from langchain_text_splitters import RecursiveCharacterTextSplitter

return RecursiveCharacterTextSplitter(
chunk_size=200,
chunk_overlap=20,
Expand Down
3 changes: 2 additions & 1 deletion backend/apps/slack/common/handlers/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import logging

from apps.ai.flows import process_query
from apps.slack.blocks import markdown
from apps.slack.utils import format_ai_response_for_slack

Expand Down Expand Up @@ -61,6 +60,8 @@ def process_ai_query(

"""
try:
from apps.ai.flows import process_query

return process_query(
query, images=images, channel_id=channel_id, is_app_mention=is_app_mention
)
Expand Down
Loading