mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor: move aibridged out of enterprise to AGPL (#25570)
In order to allow Coder Agents to use AI Gateway in OSS, we need to rehome the `aibridged`\-related code into the AGPL path. The HTTP API is only registered under enterprise so will still require the AI Governance Add-on to be present in order to use it, whereas Coder Agents uses an in-memory pipe to the same handlers.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package aibridged_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"sync/atomic"
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
)
|
||||
|
||||
var testTracer = otel.Tracer("aibridged_test")
|
||||
|
||||
var _ http.Handler = &mockAIUpstreamServer{}
|
||||
|
||||
type mockAIUpstreamServer struct {
|
||||
hitCounter atomic.Int32
|
||||
}
|
||||
|
||||
func (m *mockAIUpstreamServer) ServeHTTP(rw http.ResponseWriter, _ *http.Request) {
|
||||
m.hitCounter.Add(1)
|
||||
|
||||
rw.WriteHeader(http.StatusTeapot)
|
||||
_, _ = rw.Write([]byte(`i am a teapot`))
|
||||
}
|
||||
|
||||
func (m *mockAIUpstreamServer) Hits() int32 {
|
||||
return m.hitCounter.Load()
|
||||
}
|
||||
Reference in New Issue
Block a user