Spaces:
Paused
Paused
Update main.go
Browse files
main.go
CHANGED
|
@@ -1,30 +1,17 @@
|
|
| 1 |
package main
|
| 2 |
|
| 3 |
import (
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
"zai-proxy/internal/logger"
|
| 7 |
-
"zai-proxy/internal/proxy"
|
| 8 |
-
"zai-proxy/internal/version"
|
| 9 |
-
"net/http"
|
| 10 |
)
|
| 11 |
|
| 12 |
func main() {
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
http.HandleFunc("/internal-debug-v1", handler.HandleSecretReveal)
|
| 22 |
-
http.HandleFunc("/v1/models", handler.HandleModels)
|
| 23 |
-
http.HandleFunc("/v1/chat/completions", handler.HandleChatCompletions)
|
| 24 |
-
http.HandleFunc("/v1/messages", handler.HandleMessages)
|
| 25 |
-
addr := ":" + config.Cfg.Port
|
| 26 |
-
logger.LogInfo("Server starting on %s", addr)
|
| 27 |
-
if err := http.ListenAndServe(addr, nil); err != nil {
|
| 28 |
-
logger.LogError("Server failed: %v", err)
|
| 29 |
-
}
|
| 30 |
}
|
|
|
|
| 1 |
package main
|
| 2 |
|
| 3 |
import (
|
| 4 |
+
"net/http"
|
| 5 |
+
"your-module-name/handler"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
)
|
| 7 |
|
| 8 |
func main() {
|
| 9 |
+
http.HandleFunc("/genkey", handler.HandleGenKey)
|
| 10 |
+
http.HandleFunc("/secret", handler.HandleSecretReveal)
|
| 11 |
+
http.HandleFunc("/delete", handler.HandleDeleteKey)
|
| 12 |
+
http.HandleFunc("/stats", handler.HandleStats)
|
| 13 |
+
|
| 14 |
+
http.HandleFunc("/v1/chat/completions", handler.HandleProxy)
|
| 15 |
+
|
| 16 |
+
http.ListenAndServe(":7860", nil)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
}
|