mirror of
https://github.com/Finesssee/ProxyPilot.git
synced 2026-11-18 18:04:20 +00:00
fix: address local UI guard and example executor
This commit is contained in:
@@ -141,6 +141,10 @@ func (MyExecutor) CountTokens(context.Context, *coreauth.Auth, clipexec.Request,
|
||||
return clipexec.Response{}, errors.New("count tokens not implemented")
|
||||
}
|
||||
|
||||
func (MyExecutor) Embed(context.Context, *coreauth.Auth, clipexec.Request, clipexec.Options) (clipexec.Response, error) {
|
||||
return clipexec.Response{}, errors.New("embeddings not implemented")
|
||||
}
|
||||
|
||||
func (MyExecutor) ExecuteStream(ctx context.Context, a *coreauth.Auth, req clipexec.Request, opts clipexec.Options) (<-chan clipexec.StreamChunk, error) {
|
||||
ch := make(chan clipexec.StreamChunk, 1)
|
||||
go func() {
|
||||
|
||||
@@ -629,7 +629,7 @@ func (s *Server) managementAvailabilityMiddleware() gin.HandlerFunc {
|
||||
|
||||
func (s *Server) serveManagementControlPanel(c *gin.Context) {
|
||||
// Hidden fallback: only allow localhost and explicit opt-in.
|
||||
if !isLocalClient(c.ClientIP()) {
|
||||
if !isLocalClient(c) {
|
||||
c.AbortWithStatus(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
@@ -686,10 +686,6 @@ func (s *Server) serveManagementControlPanel(c *gin.Context) {
|
||||
c.String(http.StatusOK, html)
|
||||
}
|
||||
|
||||
func isLocalClient(ip string) bool {
|
||||
return ip == "127.0.0.1" || ip == "::1"
|
||||
}
|
||||
|
||||
func (s *Server) enableKeepAlive(timeout time.Duration, onTimeout func()) {
|
||||
if timeout <= 0 || onTimeout == nil {
|
||||
return
|
||||
|
||||
@@ -157,7 +157,7 @@ func (h *BaseAPIHandler) GetContextWithCancel(handler interfaces.APIHandler, c *
|
||||
newCtx = context.WithValue(newCtx, "gin", c)
|
||||
newCtx = context.WithValue(newCtx, "handler", handler)
|
||||
return newCtx, func(params ...interface{}) {
|
||||
if h.Cfg.RequestLog && len(params) == 1 {
|
||||
if h != nil && h.Cfg != nil && h.Cfg.RequestLog && len(params) == 1 {
|
||||
var payload []byte
|
||||
switch data := params[0].(type) {
|
||||
case []byte:
|
||||
|
||||
Reference in New Issue
Block a user