diff --git a/backend/.env.example b/backend/.env.example index cdd4ad4..5ee9934 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -1,4 +1,6 @@ APP_SECRET_KEY='app_secret_key' +DEBUG=False +ALLOWED_HOSTS=localhost,127.0.0.1 GEMINI_API_KEY=GEMINI_KEY DB_NAME=chatterbox DB_USER=postgres diff --git a/backend/config/settings.py b/backend/config/settings.py index fe3118a..6c358a5 100644 --- a/backend/config/settings.py +++ b/backend/config/settings.py @@ -9,9 +9,9 @@ SECRET_KEY = os.environ.get('APP_SECRET_KEY') CLOSED_ALPHA_SIGN_UPS = os.environ.get('CLOSED_ALPHA_SIGN_UPS') -DEBUG = True +DEBUG = os.environ.get('DEBUG', 'False').lower() == 'true' -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',') if os.environ.get('ALLOWED_HOSTS') else [] ASGI_APPLICATION = "config.asgi.application" diff --git a/backend/debug_github_ingestion.py b/backend/debug_github_ingestion.py deleted file mode 100644 index d9a7b7d..0000000 --- a/backend/debug_github_ingestion.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python -""" -Debug GitHub GraphQL ingestion to identify incomplete ingestion issues -""" - -import os -import sys - -# Setup Django -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') -sys.path.append('/home/krrish/projects/ch8r/backend') - -try: - import django - django.setup() - - print("šŸ” GitHub Ingestion Diagnostic Tool") - print("=" * 50) - - from core.models.github_data import GitHubRepository, GitHubIssue, GitHubPullRequest - from core.models import AppIntegration - - def check_repository_stats(owner: str, repo: str): - """Check ingestion statistics for a repository""" - print(f"\nšŸ“Š Statistics for {owner}/{repo}:") - - try: - # Find the repository - repo_obj = GitHubRepository.objects.filter( - full_name=f'{owner}/{repo}' - ).first() - - if not repo_obj: - print(f"āŒ Repository not found in database") - return - - print(f"Repository ID: {repo_obj.id}") - print(f"Ingestion Status: {repo_obj.ingestion_status}") - print(f"Last Ingested: {repo_obj.last_ingested_at}") - - # Count issues - issue_count = GitHubIssue.objects.filter(repository=repo_obj).count() - print(f"Issues in database: {issue_count}") - - # Count PRs - pr_count = GitHubPullRequest.objects.filter(repository=repo_obj).count() - print(f"Pull Requests in database: {pr_count}") - - # Count issue comments - from django.db.models import Count - issue_comment_count = GitHubIssueComment.objects.filter( - issue__repository=repo_obj - ).count() - print(f"Issue Comments in database: {issue_comment_count}") - - # Count PR comments - pr_comment_count = GitHubPRComment.objects.filter( - pull_request__repository=repo_obj - ).count() - print(f"PR Comments in database: {pr_comment_count}") - - # Show recent activity - recent_issues = GitHubIssue.objects.filter( - repository=repo_obj - ).order_by('-created_at')[:5] - - if recent_issues: - print(f"\nšŸ“ Recent Issues:") - for issue in recent_issues: - print(f" - #{issue.number}: {issue.title[:50]}...") - - recent_prs = GitHubPullRequest.objects.filter( - repository=repo_obj - ).order_by('-created_at')[:5] - - if recent_prs: - print(f"\nšŸ“ Recent Pull Requests:") - for pr in recent_prs: - print(f" - #{pr.number}: {pr.title[:50]}...") - - print(f"\nšŸ’” Ingestion appears {'complete' if issue_count > 0 and pr_count > 0 else 'incomplete'}") - - except Exception as e: - print(f"āŒ Error checking stats: {e}") - - def list_available_repositories(): - """List all repositories in database""" - print(f"\nšŸ“š All Repositories in Database:") - - repos = GitHubRepository.objects.all().order_by('-last_ingested_at')[:10] - - if not repos: - print(" No repositories found") - return - - for repo in repos: - status_emoji = "āœ…" if repo.ingestion_status == 'completed' else "šŸ”„" - print(f" {status_emoji} {repo.full_name} ({repo.ingestion_status})") - print(f" Issues: {GitHubIssue.objects.filter(repository=repo).count()}") - print(f" PRs: {GitHubPullRequest.objects.filter(repository=repo).count()}") - - if len(sys.argv) >= 3: - command = sys.argv[1] - - if command == "stats" and len(sys.argv) >= 4: - owner, repo = sys.argv[2], sys.argv[3] - check_repository_stats(owner, repo) - - elif command == "list": - list_available_repositories() - - else: - print("Usage:") - print(" python debug_github_ingestion.py stats ") - print(" python debug_github_ingestion.py list") - - else: - print("Available commands:") - print(" stats - Check ingestion statistics") - print(" list - List all repositories") - -except ImportError as e: - print(f"āŒ Import error: {e}") - sys.exit(1) -except Exception as e: - print(f"āŒ Unexpected error: {e}") - import traceback - traceback.print_exc() - sys.exit(1) diff --git a/backend/requirements.txt b/backend/requirements.txt index 9c08d3d..feb01b9 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -145,9 +145,3 @@ websockets==15.0.1 zope.interface==7.2 zstandard==0.23.0 gql==3.5.0 -pytest==8.3.4 -pytest-django==4.9.0 -pytest-cov==6.0.0 -factory-boy==3.3.1 -django-factory-boy==1.0.0 -pytest-json-report==1.5.0 diff --git a/backend/verify_graphql_migration.py b/backend/verify_graphql_migration.py deleted file mode 100644 index a445aa8..0000000 --- a/backend/verify_graphql_migration.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python -import os -import sys -import django - -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') -sys.path.append('/home/krrish/projects/ch8r/backend') -django.setup() - -import re - - -def check_file_for_graphql_usage(filepath): - try: - with open(filepath, 'r') as f: - content = f.read() - - matches = re.findall(r'GitHubDataIngestionService\([^)]*\)', content) - - graphql_enabled = [] - for match in matches: - if 'use_graphql=True' in match: - graphql_enabled.append(match) - elif 'use_graphql=False' in match: - graphql_enabled.append(match) - else: - graphql_enabled.append(f"{match} (defaults to GraphQL)") - - return matches, graphql_enabled - - except FileNotFoundError: - return [], [] - - -def main(): - print("šŸ” Verifying GraphQL Migration Implementation") - print("=" * 50) - - files_to_check = [ - './backend/core/tasks/github_tasks.py', - './backend/test_github_setup.py', - './backend/core/tests/test_github_ingestion.py', - ] - - all_good = True - - for filepath in files_to_check: - filename = os.path.basename(filepath) - print(f"\nšŸ“ Checking {filename}...") - - matches, graphql_enabled = check_file_for_graphql_usage(filepath) - - if not matches: - print(f" āœ… No GitHubDataIngestionService usage found") - continue - - print(f" šŸ“Š Found {len(matches)} GitHubDataIngestionService usage(s):") - - for i, match in enumerate(matches, 1): - print(f" {i}. {match}") - - print(f" šŸš€ GraphQL enabled usages: {len(graphql_enabled)}") - for i, usage in enumerate(graphql_enabled, 1): - print(f" {i}. {usage}") - - if len(matches) == len(graphql_enabled): - print(" āœ… All usages have GraphQL enabled!") - else: - print(" āŒ Some usages may not have GraphQL enabled!") - all_good = False - - print("\n" + "=" * 50) - - if all_good: - print("šŸŽ‰ SUCCESS: All GitHub ingestion services are configured to use GraphQL!") - print("\nšŸ“‹ Summary:") - print(" • GitHubDataIngestionService now defaults to GraphQL") - print(" • All task calls use use_graphql=True") - print(" • Test files updated to use GraphQL") - print(" • Backward compatibility maintained") - print("\nšŸš€ Expected Performance Improvements:") - print(" • 90-95% reduction in API calls") - print(" • 5-20x faster ingestion speed") - print(" • Eliminated rate limiting issues") - - else: - print("āŒ ISSUES FOUND: Some GitHub ingestion may not use GraphQL") - return 1 - - print("\nšŸ“¦ Checking dependencies...") - req_file = '/home/krrish/projects/ch8r/backend/requirements.txt' - try: - with open(req_file, 'r') as f: - requirements = f.read() - - if 'gql==' in requirements: - print(" āœ… gql library found in requirements.txt") - else: - print(" āŒ gql library missing from requirements.txt") - all_good = False - - except FileNotFoundError: - print(" āŒ requirements.txt not found") - all_good = False - - if all_good: - print("\nšŸŽÆ Migration Complete! GitHub GraphQL is ready for production.") - return 0 - else: - print("\nšŸ”§ Please fix the issues above before proceeding.") - return 1 - - -if __name__ == '__main__': - exit(main()) diff --git a/frontend/.env.example b/frontend/.env.example index 30da259..8f82244 100644 --- a/frontend/.env.example +++ b/frontend/.env.example @@ -1,3 +1,4 @@ DOMAIN=localhost:8000 BACKEND_BASE_URL=http://localhost:8000 API_BASE_URL=http://localhost:8000/api +NODE_ENV=production diff --git a/frontend/components/KnowledgeBase/GitHubInput.vue b/frontend/components/KnowledgeBase/GitHubInput.vue index 5e5c20c..0ed3132 100644 --- a/frontend/components/KnowledgeBase/GitHubInput.vue +++ b/frontend/components/KnowledgeBase/GitHubInput.vue @@ -119,12 +119,9 @@ const form = ref({ const integrationName = computed(() => { const appIntegrations = integrationStore.appIntegrations || [] - console.log('GitHubInput - appIntegrations:', appIntegrations) const githubIntegration = appIntegrations.find( (appInt: any) => appInt.integration.provider === 'github' ) - console.log('GitHubInput - githubIntegration:', githubIntegration) - console.log('GitHubInput - integrationName:', githubIntegration?.integration.name) return githubIntegration?.integration.name }) @@ -136,13 +133,10 @@ const isValid = computed(() => { const getGitHubIntegrationId = () => { const appIntegrations = integrationStore.appIntegrations || [] - console.log('getGitHubIntegrationId - appIntegrations:', appIntegrations) const githubIntegration = appIntegrations.find( (appInt: any) => appInt.integration.provider === 'github' ) - console.log('getGitHubIntegrationId - githubIntegration:', githubIntegration) const integrationId = githubIntegration?.id || 0 - console.log('getGitHubIntegrationId - integrationId:', integrationId) return integrationId } diff --git a/frontend/components/KnowledgeBase/NewKnowledgeBase.vue b/frontend/components/KnowledgeBase/NewKnowledgeBase.vue index cb748be..66f2907 100644 --- a/frontend/components/KnowledgeBase/NewKnowledgeBase.vue +++ b/frontend/components/KnowledgeBase/NewKnowledgeBase.vue @@ -74,9 +74,7 @@ const githubData = ref(null) onMounted(async () => { try { - console.log('Loading app integrations for app:', useRoute().params.appId) await integrationStore.loadAppIntegrations(useRoute().params.appId as string) - console.log('App integrations loaded:', integrationStore.appIntegrations) } catch (error) { console.error('Failed to load integrations:', error) toast.error('Failed to load integration options') diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts index 5fa8234..eab97f7 100644 --- a/frontend/nuxt.config.ts +++ b/frontend/nuxt.config.ts @@ -2,7 +2,7 @@ import tailwindcss from '@tailwindcss/vite' export default defineNuxtConfig({ compatibilityDate: '2025-05-15', - devtools: { enabled: true }, + devtools: { enabled: process.env.NODE_ENV === 'development' }, ssr: false, css: ['~/assets/css/main.css'], diff --git a/frontend/package.json b/frontend/package.json index 4ef8808..a279426 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -14,6 +14,7 @@ "@nuxt/fonts": "^0.11.4", "@nuxt/icon": "^1.14.0", "@nuxt/image": "^1.10.0", + "@nuxtjs/color-mode": "^3.5.2", "@pinia/nuxt": "^0.11.1", "@tailwindcss/vite": "^4.1.10", "@tanstack/vue-table": "^8.21.3", @@ -44,7 +45,6 @@ "zod": "^3.25.76" }, "devDependencies": { - "@nuxtjs/color-mode": "^3.5.2", "prettier": "^3.5.3" }, "volta": { diff --git a/frontend/pages/forgot-password.vue b/frontend/pages/forgot-password.vue index 187b27c..ab3aa1f 100644 --- a/frontend/pages/forgot-password.vue +++ b/frontend/pages/forgot-password.vue @@ -39,7 +39,6 @@ const onSubmit = handleSubmit(async (values) => { toast.success('Password reset link sent! Check your email.') await router.push('/login') } catch (e: never) { - console.log(e.errors) toast.error('Failed to send password reset link.') } }) diff --git a/frontend/pages/login.vue b/frontend/pages/login.vue index 071e650..01055d5 100644 --- a/frontend/pages/login.vue +++ b/frontend/pages/login.vue @@ -59,7 +59,6 @@ const handleLogin = async () => { toast.success('Login successful!') navigateTo('/') } catch (err: any) { - console.log(err, "error") if (err.status === 403) { if (err?.errors?.is_verified === false) { @@ -136,7 +135,6 @@ onMounted(async () => { toast.success('Email verified! Logged in successfully.') navigateTo('/') } catch (err: any) { - console.log(err,"error") if (err.status === 403) { dialogMessage.value = 'Your account approval is pending. We will get back to you as soon as the verification is complete. Thank you for your patience. Please contact our support team for any queries'