118 Commits

Author SHA1 Message Date
roland-the-engineer a9431b3ba0 Refactor environment variable management with centralized validation (#45)
* Refactor environment variable management with centralized validation

- Replace plain object with Map-based env structure
- Add all environment variables (not just LlamaCloud ones)
- Use sentinel value 'mandatory-env-not-set' for required vars
- Add helper functions: isDevelopment(), isProduction(), logEnv()
- Create instrumentation.ts for one-time startup validation
- Validate environment once at server startup using Next.js hook
- Exit with error code 1 if validation fails

This ensures the app doesn't start with missing required env vars and
provides better error messages during startup.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Update services to use centralized env.get() pattern

Replace direct process.env access with env.get() in:
- OpenAI services (openai-question-extractor, multi-step-response)
- Supabase utilities (4 files)
- Database client (db.ts)
- Login actions and API routes

Also use helper functions:
- isDevelopment() and isProduction() instead of NODE_ENV checks
- Keep Vercel platform vars (VERCEL_URL, VERCEL_ENV) as process.env

Remove constructor-level env validation checks since validation now
happens once at startup.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Remove redundant validateEnv() calls from services

Remove 9 validateEnv() calls across:
- lib/llama-index-service.ts
- lib/llamaparse-service.ts
- lib/services/llamacloud-documents-service.ts
- lib/services/llamacloud-connection-service.ts
- app/api/llamacloud/projects/route.ts
- app/api/organizations/route.ts

Environment validation now happens once at startup via instrumentation.ts,
so these per-request checks are no longer needed.

Also updated env access to use env.get() pattern consistently.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Simplify next.config.ts by removing explicit env var exposure

Remove explicit env var configuration from next.config.ts.
Next.js automatically makes NEXT_PUBLIC_* variables available to the
client, so explicit exposure is unnecessary.

Keeps only essential config:
- reactStrictMode
- output: 'standalone' (for Docker deployment)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Fix remaining env.PROPERTY to env.get() conversions

Updated remaining files that were still using env.PROPERTY pattern:
- lib/llama-index-service.ts
- lib/llamaparse-service.ts
- lib/services/llamacloud-client.ts
- lib/services/llamacloud-documents-service.ts
- app/api/llamacloud/projects/route.ts
- app/api/organizations/route.ts
- app/api/projects/[projectId]/indexes/route.ts

All files now consistently use env.get('VARIABLE_NAME')! pattern.
TypeScript compilation now passes successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Refactor LlamaIndexService import paths and consolidate service files

* Fix ESLint warnings in React components

Fix React Hook dependency warnings:
- ProjectDocuments: Add fetchProjectDocuments to useEffect deps
- ProjectIndexSelector: Wrap hasChanges and handleSave in useCallback
  and add all dependencies to the debounced auto-save useEffect

All ESLint checks now pass with no warnings or errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Add comprehensive environment variable documentation

Add detailed documentation explaining build-time vs runtime variables,
especially for NEXT_PUBLIC_* variables and Docker deployments.

Key additions:
- New "Environment Variables" section in README with comprehensive guide
- Explanation of build-time (NEXT_PUBLIC_*) vs runtime variables
- Docker deployment workflow (correct vs incorrect approaches)
- Why NEXT_PUBLIC_* variables require Docker rebuild
- Best practices for multi-environment deployments
- Code examples showing proper env.get() usage
- Startup validation explanation

This documentation is critical for users deploying with Docker, as
changing NEXT_PUBLIC_* variables without rebuilding will not work.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Implement auth for all api routes

* NODE_ENV has a default

* Make the env lookup type-safe.

* Restrict API health check path in session update logic

* Improve UI consistency

---------

Co-authored-by: Roland Tritsch <roland@tritsch.email>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-09 15:41:46 -06:00
boyang-zhang 86e0a09873 Add configurable LlamaCloud API URL for EU region support (#44)
* Add agentic mode support for LlamaParse and fix eligibility extraction

- Add agenticMode option to ParseOptions interface and Zod schema
- Enable agentic parsing by default for better multi-sheet Excel support
- Fix eligibility extraction to gracefully handle documents without
  eligibility criteria by returning empty array instead of throwing error

* Refactor project index selection to single-select with auto-save

- Change ProjectIndexSelector from multi-select checkboxes to single-select
  clickable rows with radio-style indicators
- Implement debounced auto-save (800ms) when selection changes
- Remove Edit/Save/Cancel buttons in favor of automatic persistence
- Add refreshKey prop to ProjectDocuments for efficient refetch on changes
- Update DocumentsSection to wire components with onSaveSuccess callback
- Simplify Questions page index selector to show index name with Active badge

* Fix ESLint configuration and resolve all lint errors

- Add eslint and eslint-config-next as dev dependencies
- Create .eslintrc.json with next/core-web-vitals preset
- Fix 43 unescaped entity errors by replacing quotes and apostrophes
  with HTML entities across 14 component files
- Fix 9 react-hooks/exhaustive-deps warnings by wrapping fetch
  functions in useCallback with proper dependency arrays

* Add Vitest testing infrastructure with 173 unit tests

- Configure Vitest with coverage reporting and path aliases
- Add test scripts (test, test:run, test:coverage) to package.json
- Install vitest, @vitest/coverage-v8, vite-tsconfig-paths, vitest-mock-extended

Test coverage includes:
- validators: extract-questions, generate-response, llamaparse, multi-step-response
- errors: all API error classes with type guard
- services: FileValidator (file type/size validation), DefaultResponseService
- middleware: apiHandler and withApiHandler request validation

Add mock infrastructure for Prisma, OpenAI, and test fixtures

* Fix missing agenticMode in LlamaParse processing service

Add agentic_mode field to request schema and form data parser to ensure
the agenticMode option is properly passed through the parsing pipeline.
This resolves TypeScript compilation error where agenticMode was required
in LlamaParseOptions but not provided by the processing service.

* Fix Add Manually button routing and improve Vercel preview URL handling

- Fix 404 error when clicking Add Manually button by using correct route path
  /projects/{projectId}/questions/create instead of /questions/create?projectId=
- Update magic link auth to use VERCEL_URL for preview deployments

* Simplify IndexSelector to display-only mode

Remove index configuration UI since only single file selection is now supported:
- Remove Configure/Hide toggle button and collapsible panel
- Remove Select All/Deselect All functionality
- Remove checkbox selection grid for indexes
- Clean up handleIndexToggle and handleSelectAllIndexes from provider
- Keep project card display showing active index name and status

* Update .gitignore (with .devcontainer)

* Initial implementation of API_URL

* Fix console errors on login page

Prevent auth session errors on public pages and remove form method attribute that conflicts with Server Actions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Roland Tritsch <roland@tritsch.email>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-27 12:18:21 -06:00
boyang-zhang 1151372e5c Dev branch improvements and bug fixes (#42)
* Add agentic mode support for LlamaParse and fix eligibility extraction

- Add agenticMode option to ParseOptions interface and Zod schema
- Enable agentic parsing by default for better multi-sheet Excel support
- Fix eligibility extraction to gracefully handle documents without
  eligibility criteria by returning empty array instead of throwing error

* Refactor project index selection to single-select with auto-save

- Change ProjectIndexSelector from multi-select checkboxes to single-select
  clickable rows with radio-style indicators
- Implement debounced auto-save (800ms) when selection changes
- Remove Edit/Save/Cancel buttons in favor of automatic persistence
- Add refreshKey prop to ProjectDocuments for efficient refetch on changes
- Update DocumentsSection to wire components with onSaveSuccess callback
- Simplify Questions page index selector to show index name with Active badge

* Fix ESLint configuration and resolve all lint errors

- Add eslint and eslint-config-next as dev dependencies
- Create .eslintrc.json with next/core-web-vitals preset
- Fix 43 unescaped entity errors by replacing quotes and apostrophes
  with HTML entities across 14 component files
- Fix 9 react-hooks/exhaustive-deps warnings by wrapping fetch
  functions in useCallback with proper dependency arrays

* Add Vitest testing infrastructure with 173 unit tests

- Configure Vitest with coverage reporting and path aliases
- Add test scripts (test, test:run, test:coverage) to package.json
- Install vitest, @vitest/coverage-v8, vite-tsconfig-paths, vitest-mock-extended

Test coverage includes:
- validators: extract-questions, generate-response, llamaparse, multi-step-response
- errors: all API error classes with type guard
- services: FileValidator (file type/size validation), DefaultResponseService
- middleware: apiHandler and withApiHandler request validation

Add mock infrastructure for Prisma, OpenAI, and test fixtures

* Fix missing agenticMode in LlamaParse processing service

Add agentic_mode field to request schema and form data parser to ensure
the agenticMode option is properly passed through the parsing pipeline.
This resolves TypeScript compilation error where agenticMode was required
in LlamaParseOptions but not provided by the processing service.

* Fix Add Manually button routing and improve Vercel preview URL handling

- Fix 404 error when clicking Add Manually button by using correct route path
  /projects/{projectId}/questions/create instead of /questions/create?projectId=
- Update magic link auth to use VERCEL_URL for preview deployments

* Simplify IndexSelector to display-only mode

Remove index configuration UI since only single file selection is now supported:
- Remove Configure/Hide toggle button and collapsible panel
- Remove Select All/Deselect All functionality
- Remove checkbox selection grid for indexes
- Clean up handleIndexToggle and handleSelectAllIndexes from provider
- Keep project card display showing active index name and status
2025-12-27 12:03:18 -06:00
blank-black 0ee5e09e5c Fix docker-run script: add missing port mapping -p 3000:3000 2025-12-26 10:53:36 -06:00
Roland Tritsch 7f93393f10 Adding support to build and run auto_rfp in a docker container (#38)
* consolidate duplicate Next.js config files into TypeScript version

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add Dockerfile

* Add the docker scripts to package.json

* Add docker doc to the README

* Update the README with the env file changes/requirements

* Update README with build- vs. run-time configuration requirements

* Ignore a/the .devcontainer (if there is one)

* Adding more docker scripts

* Adding a health endpoint to check the health of the container

* Make sure we can hit the health endpoint without authentication

* Make docker-build work

* Add more health-check script

* Moving docker config to next.config.ts

* Fix docker-run script. Remove network host access.

---------

Co-authored-by: Roland Tritsch <roland@tritsch.email>
Co-authored-by: Claude <noreply@anthropic.com>
2025-12-26 10:51:58 -06:00
Roland Tritsch ba8cd12233 Add LICENSE file
Co-authored-by: Roland Tritsch <roland@tritsch.email>
2025-12-19 11:54:18 -06:00
Roland Tritsch c743c5eaa4 Update README to use .env instead of .env.local
* Update README to use .env instead of .env.local

* Replace all other refernces to .env.local

---------

Co-authored-by: Roland Tritsch <roland@tritsch.email>
2025-12-19 11:54:13 -06:00
Roland Tritsch 6eeba518be Ignore CLAUDE.md file
Co-authored-by: Roland Tritsch <roland@tritsch.email>
2025-12-19 11:54:11 -06:00
Logan 57ea85b781 Merge pull request #41 from run-llama/vercel/react-server-components-cve-vu-2qzmxv 2025-12-16 16:42:13 -06:00
Vercel 9b78df8aa9 Fix React Server Components CVE vulnerabilities
Updated dependencies to fix Next.js and React CVE vulnerabilities.

The fix-react2shell-next tool automatically updated the following packages to their secure versions:
- next
- react-server-dom-webpack
- react-server-dom-parcel  
- react-server-dom-turbopack

All package.json files have been scanned and vulnerable versions have been patched to the correct fixed versions based on the official React advisory.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
2025-12-16 22:37:53 +00:00
zli484 5fbd4f1c61 Merge pull request #30 from run-llama/setup_internal
allow setting up an internal organization which accesses a separate l…
2025-08-28 16:13:27 -07:00
Zhaoqi Li 5823daf249 allow setting up an internal organization which accesses a separate llamacloud project 2025-08-28 16:07:54 -07:00
zli484 5cdc7f6933 Merge pull request #29 from run-llama/knowledge_base_feature
Knowledge base feature - initial features
2025-08-15 14:08:38 -07:00
Zhaoqi Li 6dc85cd870 initial implementation of knowledgebase questions and answers 2025-08-15 13:59:17 -07:00
Zhaoqi Li 3e311cfa02 update schema for creating org-level knowledgebase 2025-08-15 12:36:12 -07:00
zli484 8511d72fbd Merge pull request #28 from run-llama/generate_RFP_summary
Generate rfp summary
2025-08-13 11:57:36 -07:00
Zhaoqi Li d76058e7b3 now we alos extract key eligibility required for the vendor 2025-08-13 11:55:26 -07:00
Zhaoqi Li 91df641eee correctly generates RFP summary now and tracked at project 2025-08-13 11:44:04 -07:00
zli484 d11c16e148 Merge pull request #27 from run-llama/feature_improvements_20250813
allow user to easily delete a project from the organization page or f…
2025-08-13 10:51:44 -07:00
Zhaoqi Li 515319a6e7 allow user to easily delete a project from the organization page or from the project overview page 2025-08-13 10:47:13 -07:00
zli484 336fc14c7d Merge pull request #26 from run-llama/ui_improvement
UI improvement
2025-08-12 13:36:09 -07:00
Zhaoqi Li af574f10ee formatting improvement 2025-08-12 13:33:47 -07:00
Zhaoqi Li a20f739ba2 improvement in redirecting when creating new project 2025-08-12 13:21:13 -07:00
Zhaoqi Li c37e3fc7ba card width fix 2025-08-12 13:00:59 -07:00
zli484 b2ac5547c0 Merge pull request #25 from run-llama/improve_questions_ingestion
fix an integration issue with LlamaParse service
2025-08-12 12:52:36 -07:00
Zhaoqi Li bff7a114b7 fix an integration issue with LlamaParse service 2025-08-12 12:48:55 -07:00
zli484 7f5f88402f Merge pull request #24 from run-llama/guided_onboarding
Frontend cleanup
2025-07-18 09:49:55 -07:00
Zhaoqi Li c38bed9cc4 more clean-up 2025-07-18 09:47:06 -07:00
Zhaoqi Li 418f866017 remove console log 2025-07-18 09:38:45 -07:00
Zhaoqi Li 29d83feb6e added a help page 2025-07-18 09:07:08 -07:00
zli484 098146279d Merge pull request #23 from run-llama/prepare_for_opensource
Prepare for opensource
2025-07-17 23:36:03 -07:00
Zhaoqi Li 5e84e455c0 refactor certain files and improve read me 2025-07-17 23:33:26 -07:00
Zhaoqi Li 41da7e7033 formatting improvement 2025-07-17 22:22:51 -07:00
zli484 74f017f498 Merge pull request #22 from run-llama/end_to_end_test
ui clean up
2025-07-17 15:54:51 -07:00
Zhaoqi Li ba80e9a013 ui clean up 2025-07-17 15:52:33 -07:00
zli484 1f1b365836 Merge pull request #21 from run-llama/new_llamaindex_integration
New llamaindex integration
2025-07-17 13:29:02 -07:00
Zhaoqi Li d10f6b7b88 bug fixes and more mature integration 2025-07-17 13:25:07 -07:00
Zhaoqi Li 3f5db1b13a fix llamacloud integration issue in the multi-step reasoning mode 2025-07-17 12:56:28 -07:00
Zhaoqi Li 7ffaa1f175 reconfigure llamaindex integration to make sure the questions answering work 2025-07-17 12:43:48 -07:00
Zhaoqi Li aea36e5732 refactoring of llamacloud integration steps 2025-07-17 11:00:23 -07:00
zli484 befd17d52e Merge pull request #20 from run-llama/frontend_improvement_continued
Frontend improvement continued
2025-07-16 23:03:39 -07:00
Zhaoqi Li a917f803d6 refactoring the upload questions page 2025-07-16 22:58:21 -07:00
Zhaoqi Li 05ade3ae02 refactoring for upload questions 2025-07-16 22:27:35 -07:00
Zhaoqi Li 4619d91978 saving 2025-07-16 15:34:21 -07:00
zli484 558484bb28 Merge pull request #19 from run-llama/ui_refactoring
Major front-end refactoring
2025-07-16 15:15:28 -07:00
Zhaoqi Li 9d8f847491 refactoring frontend code 2025-07-16 15:13:22 -07:00
Zhaoqi Li ad26fe8c87 save 2025-07-15 17:15:03 -07:00
Zhaoqi Li 7280a784b0 major code refactoring on frontend logic and organization 2025-07-15 17:00:14 -07:00
zli484 e0c4e74666 Merge pull request #18 from run-llama/fix_llamacloud_integration
Fix llamacloud integration
2025-07-11 14:16:40 -07:00
Zhaoqi Li 869cd7c727 address llamacloud integration issue and some ui changes 2025-07-11 14:13:49 -07:00