Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Dec 21, 2025

Summary

Adds middleware to forward /chat/completions, /listen, and /transcribe requests from apps/api to apps/ai when AI_SERVICE_URL environment variable is configured. This provides backward compatibility for clients that haven't updated to call apps/ai directly.

Path mappings:

  • /chat/completionsAI_SERVICE_URL/llm/chat/completions
  • /listenAI_SERVICE_URL/stt/listen
  • /transcribeAI_SERVICE_URL/stt/

When AI_SERVICE_URL is not set, requests continue to the original handlers (no change in behavior).

Implementation details:

  • HTTP endpoints (/chat/completions, /transcribe) use fetch-based forwarding with streaming support
  • WebSocket endpoint (/listen) uses the existing WsProxyConnection class for proper bidirectional message relay
  • Auth headers are forwarded to the upstream service
  • Query parameters are preserved

Review & Testing Checklist for Human

  • Verify path mappings are correct - Check that the target paths (/llm/chat/completions, /stt/listen, /stt/) match what apps/ai expects. This is the highest risk area.
  • Test WebSocket /listen forwarding - Verify real-time STT streaming works when forwarded through the proxy.
  • Test with AI_SERVICE_URL set - Deploy to staging with AI_SERVICE_URL=https://hyprnote-ai.fly.dev and verify all three endpoints work correctly.
  • Test without AI_SERVICE_URL - Verify the original behavior is preserved when the env var is not set.

Recommended test plan:

  1. Set AI_SERVICE_URL in staging environment
  2. Test /chat/completions with a simple LLM request (both streaming and non-streaming)
  3. Test /listen WebSocket connection for real-time STT
  4. Test /transcribe with a batch audio file

Notes

Add middleware to forward /chat/completions, /listen, and /transcribe
requests from apps/api to apps/ai when AI_SERVICE_URL is configured.
This provides backward compatibility for clients that haven't updated yet.

Co-Authored-By: yujonglee <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Dec 21, 2025

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit 6b01eba
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/6947f2ce2c40410008fbadab
😎 Deploy Preview https://deploy-preview-2452--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 21, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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


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

@netlify
Copy link

netlify bot commented Dec 21, 2025

Deploy Preview for hyprnote-storybook ready!

Name Link
🔨 Latest commit 6b01eba
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/6947f2ce0ee63100083a4bc3
😎 Deploy Preview https://deploy-preview-2452--hyprnote-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

When AI_SERVICE_URL is configured, forward WebSocket connections
to the AI service's /stt/listen endpoint with auth header passthrough.

Co-Authored-By: yujonglee <[email protected]>
@yujonglee yujonglee closed this Dec 22, 2025
@yujonglee yujonglee deleted the devin/1766319544-forward-llm-stt-to-ai branch December 22, 2025 12:53
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