Skip to content

Commit

Permalink
Routes regular chat requests to the standard endpoints
Browse files Browse the repository at this point in the history
Handles WebSocket connections for /realtime endpoints
Automatically redirects voice/audio requests to use the realtime endpoint when using realtime models
Maintains bidirectional message relay for realtime connections
Properly handles session management and cleanup

For Open WebUI compatibility:

Regular chat will continue to work as before
Voice features will automatically use the realtime endpoint when needed
The proxy will handle upgrading connections to WebSocket when required

Additional notes:

The WebSocket implementation includes proper error handling and connection cleanup
The code includes session management for realtime connections
Authentication is preserved when proxying to Azure
Both OpenAI-style and Azure-style paths are supported
  • Loading branch information
Gyarbij committed Dec 15, 2024
1 parent 96d8e63 commit 55addc1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.23.4

require (
github.com/gin-gonic/gin v1.10.0
github.com/gorilla/websocket v1.5.3
github.com/joho/godotenv v1.5.1
github.com/tidwall/gjson v1.18.0
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PU
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down

0 comments on commit 55addc1

Please sign in to comment.