Moge-Row commited on
Commit
9d1e1b6
·
verified ·
1 Parent(s): 372b0e9

Update main.go

Browse files
Files changed (1) hide show
  1. main.go +10 -23
main.go CHANGED
@@ -1,30 +1,17 @@
1
  package main
2
 
3
  import (
4
- "zai-proxy/internal/config"
5
- "zai-proxy/internal/handler"
6
- "zai-proxy/internal/logger"
7
- "zai-proxy/internal/proxy"
8
- "zai-proxy/internal/version"
9
- "net/http"
10
  )
11
 
12
  func main() {
13
- config.LoadConfig()
14
- logger.InitLogger()
15
- proxy.LoadProxies("proxies.txt")
16
- version.StartVersionUpdater()
17
- http.HandleFunc("/", handler.HandleIndex)
18
- http.HandleFunc("/genkey", handler.HandleGenKey)
19
- http.HandleFunc("/stats", handler.HandleStats)
20
- http.HandleFunc("/deletekey", handler.HandleDeleteKey)
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
  }