Skip to content

Release 1.1.0 - #97

Merged
rakeshSgr merged 14 commits into
ELEVATE-Project:release-1.2.0from
vishwanath1004:release-1.1.0
Oct 26, 2026
Merged

rakeshSgr merged 14 commits into
ELEVATE-Project:release-1.2.0from
vishwanath1004:release-1.1.0

Conversation

@vishwanath1004

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 15c2c6b3-3064-4d27-987a-99094b6579d6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread chatbot/admin/media_admin.py Outdated
)
from chatbot.utils.company_utils import get_company_queryset_for_user, get_user_company, get_user_profile
from chatbot.utils.knowledge_service.theme_classification_service import (
ADMIN_THEME_WAIT_TIMEOUT_SECONDS, ThemeMessageLevel, enqueue_theme_classification, theme_outcome_message,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 why this required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have kept the max waiting time as 30 seconds for ADMIN_THEME_WAIT_TIMEOUT_SECONDS, after that the theme mapping will happens in background.

Comment thread chatbot/admin/media_admin.py

@rakeshSgr rakeshSgr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 Please check the comments

Comment thread chatbot/admin/media_admin.py
Comment thread chatbot/admin/media_admin.py Outdated
if not pending or response.status_code != 302:
return response
task_id, media_name = pending
outcome = wait_for_theme_classification(task_id, ADMIN_THEME_WAIT_TIMEOUT_SECONDS)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 how it works?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, after saving the media, users were immediately redirected to the listing page. With the addition of theme mapping to the existing implementation, we’ve updated the flow so that navigation happens only after the theme mapping is complete. This ensures that users can see the mapped themes immediately on the listing page.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 we can remove this, it may take more, lets it happen in backend

Comment thread chatbot/admin/theme_admin.py

def get_queryset(self, request):
return super().get_queryset(request).select_related('created_by').annotate(
primary_count=Count('primary_media', distinct=True),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 what is primary_media ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It adds an number to the each theme, Its a count for each media how many resources are using this as primary theme.

'existing_secondary_themes': list(existing_names),
'needed': needed,
'document': self.document_context(document),
'feedback': feedback,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 are we storing the feedback ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we are not storing in db, feedback used if theme classification is failed any cases we are showing an message.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


logger = logging.getLogger('django')

THEME_CLASSIFIER_ROUTE = '/theme_classifier'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 create a constant file theme, and move these constant there

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

MEDIA_THEME_FIELDS = ['primary_theme', 'primary_theme_confidence', 'primary_theme_reasoning', 'needs_review']
SEARCH_TEXT_MAX_CHARS = 2000
THEME_CODE_HASH_LENGTH = 12
NEAR_DUPLICATE_NEIGHBOUR_FLOOR = 0.3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 how it works ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are using that to check the duplicate names of secondary theme.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 what is 0.3 value ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats the minimum matching, if the existing secondary theme name is matching with new one then it will treats as duplicate one so it will not create the secondary theme it will reuse the existing one.

SEARCH_TEXT_MAX_CHARS = 2000
THEME_CODE_HASH_LENGTH = 12
NEAR_DUPLICATE_NEIGHBOUR_FLOOR = 0.3
NEAR_DUPLICATE_NEIGHBOUR_LIMIT = 10

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 provide me the brief explanation for these keys


def acquire_secondary_theme_lock() -> None:
with connection.cursor() as cursor:
cursor.execute('SELECT pg_advisory_xact_lock(%s)', [SECONDARY_THEME_LOCK_KEY])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 SECONDARY_THEME_LOCK_KEY ? how this works

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the ID number of a database lock. The lock stops two classifications running at the same time from both creating the same new secondary theme.

if not media:
logger.warning(f"{log_prefix} vector sync skipped: media not found")
return None
if media.company_bot and media.company_bot.provider == LLMProvider.OPENAI:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwanath1004 we don't need to check the == LLMProvider.OPENAI , check in other places also

THEME_WAIT_MAX_POLL_SECONDS = 3.0
SECONDARY_THEME_MIN_WORDS = 2
SECONDARY_THEME_MAX_WORDS = 4
MAX_SECONDARY_THEME_COUNT = 10

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to env

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SECONDARY_THEME_COUNT this is the key to manage the number of secondary themes to assign each document hence this key i have moved to .env from the .bot file. And MAX_SECONDARY_THEME_COUNT is the upper limit for the SECONDARY_THEME_COUNT setting. The setting decides how many secondary themes each document can get (currently 2), and it can never be set above 10.

@rakeshSgr
rakeshSgr merged commit 491662d into ELEVATE-Project:release-1.2.0 Oct 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants