Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements authentication migration improvements by fixing redirect URL handling in the Keycloak OAuth flow and adding support for project public IDs in conversations.
Key changes:
- Fixed OAuth redirect URL to be properly stored and retrieved during the authentication callback flow
- Added
project_public_idfield to conversations across all layers (database, domain, service, handlers, responses) - Enhanced GetMe endpoint to include a
namefield with username fallback
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| services/llm-api/migrations/000004_add_project_public_id_to_conversations.up.sql | Adds database column and index for storing project public IDs in conversations |
| services/llm-api/migrations/000004_add_project_public_id_to_conversations.down.sql | Provides rollback migration to remove project_public_id column |
| services/llm-api/internal/domain/conversation/conversation.go | Adds ProjectPublicID field to Conversation domain model |
| services/llm-api/internal/domain/conversation/conversation_service.go | Updates CreateConversationInput to include ProjectPublicID and sets it during conversation creation |
| services/llm-api/internal/infrastructure/database/dbschema/conversation.go | Adds ProjectPublicID field to database schema and updates conversion methods |
| services/llm-api/internal/interfaces/httpserver/handlers/conversationhandler/conversation_handler.go | Extracts and passes project public ID when creating conversations |
| services/llm-api/internal/interfaces/httpserver/responses/conversation/conversation.go | Adds project_id field to API response structure |
| services/llm-api/internal/interfaces/httpserver/handlers/authhandler/token_handler.go | Adds Name field to GetMe response with username fallback logic |
| services/llm-api/internal/interfaces/httpserver/handlers/authhandler/keycloak_oauth.go | Fixes redirect URL handling by storing it during login initiation and retrieving it during callback |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Default redirect URL if not provided | ||
| redirectURL = "https://chat-dev.jan.ai/auth/keycloak/callback" | ||
| } |
There was a problem hiding this comment.
The default redirect URL is hardcoded to a development environment URL (https://chat-dev.jan.ai/auth/keycloak/callback). This should be configurable or retrieved from configuration to support different environments (development, staging, production). Consider adding this as a configuration parameter similar to how h.redirectURI is configured and passed to the handler constructor.
| if redirectURL == "" { | ||
| // Default redirect URL if not provided | ||
| redirectURL = "https://chat-dev.jan.ai/auth/keycloak/callback" | ||
| } |
There was a problem hiding this comment.
The default redirect URL is hardcoded to a development environment URL (https://chat-dev.jan.ai/auth/keycloak/callback). This should be configurable or retrieved from configuration to support different environments (development, staging, production). Consider adding this as a configuration parameter similar to how h.redirectURI is configured and passed to the handler constructor.
Fix redirect
fix project and conversations