65 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
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
Zhaoqi Li 5823daf249 allow setting up an internal organization which accesses a separate llamacloud project 2025-08-28 16:07:54 -07:00
Zhaoqi Li 6dc85cd870 initial implementation of knowledgebase questions and answers 2025-08-15 13:59:17 -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
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
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 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
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
Zhaoqi Li ba80e9a013 ui clean up 2025-07-17 15:52:33 -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
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
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
Zhaoqi Li 869cd7c727 address llamacloud integration issue and some ui changes 2025-07-11 14:13:49 -07:00
Zhaoqi Li 075d9172e4 fix the llamacloud file integration issue 2025-07-11 12:06:36 -07:00
Zhaoqi Li 9e30e89542 a new streaming-based user experience for multi-step question answering 2025-05-27 16:55:12 -07:00
Zhaoqi Li a96bfb5947 bug fixes in the multi-step reasoning feature 2025-05-27 14:22:28 -07:00
Zhaoqi Li 2c5767bda0 initial implementation of the reasoning step 2025-05-26 19:29:52 -07:00
Zhaoqi Li 0a58cbd13c code refactoring for llamaparse 2025-05-26 14:08:04 -07:00
Zhaoqi Li 5f0962ad95 refactor code in llamacloud - connect, disconnect and documents 2025-05-26 14:00:25 -07:00
Zhaoqi Li 93b32df6dc code refactoring to make more robust and remove duplication 2025-05-26 13:42:23 -07:00
Zhaoqi Li ab6dfc794d bug fix - now we can generate answers using the indexes selected 2025-05-25 17:29:21 -07:00
Zhaoqi Li 10fb248405 allow user to set which index or indexes to include in a project 2025-05-23 17:24:58 -07:00
Zhaoqi Li 36ddafc797 save 2025-05-23 16:53:00 -07:00
Zhaoqi Li 97859b64b2 now user can set up a connection between an organization and a LlamaIndex project to use the indexed files as knowledge base 2025-05-23 14:47:15 -07:00
Zhaoqi Li 80f3ac6ad8 uiux improvement and questions parsing 2025-05-23 13:27:30 -07:00
Zhaoqi Li 92c4694615 fixing uiux issues 2025-05-22 22:47:36 -07:00
Zhaoqi Li 6b27d3c99f improve ui components of the document list 2025-05-22 22:06:41 -07:00
Zhaoqi Li 59a5fe7a35 clean up page and fix new-project creation issue 2025-05-18 10:54:42 -07:00
Zhaoqi Li d259ce7e6a new question page to allow ingesting questions through file upload or manual adding 2025-05-16 16:00:20 -07:00
Zhaoqi Li 5aebed13a0 fixing type errors 2025-05-16 14:48:40 -07:00
Zhaoqi Li 7afdfb7fe7 adding organization 2025-05-16 13:56:36 -07:00
Zhaoqi Li 6812d3440f improvement in question page 2025-05-13 16:31:30 -07:00
Zhaoqi Li 47c9f5403a page refactor 2025-05-13 16:05:21 -07:00
Zhaoqi Li 152e102669 code refactoring for the project-related components 2025-05-13 15:37:25 -07:00
Zhaoqi Li 8b44cf4909 created initial version of the documents page 2025-05-09 19:32:06 -07:00
Zhaoqi Li b01f7b4283 started to fill in real data for the project page and also add back the answer citations 2025-05-09 18:09:34 -07:00