Spaces:
Sleeping
Sleeping
sanbo
commited on
Commit
·
5e0f525
1
Parent(s):
482079b
update sth. at 2024-12-18 21:13:27
Browse files
main.go
CHANGED
@@ -337,43 +337,6 @@ func handleCompletion(c *gin.Context) {
|
|
337 |
}
|
338 |
}
|
339 |
|
340 |
-
//func requestToken() (string, error) {
|
341 |
-
// req, err := http.NewRequest("GET", "https://duckduckgo.com/duckchat/v1/status", nil)
|
342 |
-
// if err != nil {
|
343 |
-
// return "", fmt.Errorf("创建请求失败: %v", err)
|
344 |
-
// }
|
345 |
-
// for k, v := range config.FakeHeaders {
|
346 |
-
// req.Header.Set(k, v)
|
347 |
-
// }
|
348 |
-
// req.Header.Set("x-vqd-accept", "1")
|
349 |
-
//
|
350 |
-
// client := &http.Client{
|
351 |
-
// Timeout: 10 * time.Second,
|
352 |
-
// }
|
353 |
-
//
|
354 |
-
// log.Println("发送 token 请求")
|
355 |
-
// resp, err := client.Do(req)
|
356 |
-
// if err != nil {
|
357 |
-
// return "", fmt.Errorf("请求失败: %v", err)
|
358 |
-
// }
|
359 |
-
// defer resp.Body.Close()
|
360 |
-
//
|
361 |
-
// if resp.StatusCode != http.StatusOK {
|
362 |
-
// bodyBytes, _ := io.ReadAll(resp.Body)
|
363 |
-
// bodyString := string(bodyBytes)
|
364 |
-
// log.Printf("requestToken: 非200响应: %d, 内容: %s\n", resp.StatusCode, bodyString)
|
365 |
-
// return "", fmt.Errorf("非200响应: %d, 内容: %s", resp.StatusCode, bodyString)
|
366 |
-
// }
|
367 |
-
//
|
368 |
-
// token := resp.Header.Get("x-vqd-4")
|
369 |
-
// if token == "" {
|
370 |
-
// return "", errors.New("响应中未包含x-vqd-4头")
|
371 |
-
// }
|
372 |
-
//
|
373 |
-
// // log.Printf("获取到的 token: %s\n", token)
|
374 |
-
// return token, nil
|
375 |
-
//}
|
376 |
-
|
377 |
func requestToken() (string, error) {
|
378 |
url := "https://duckduckgo.com/duckchat/v1/status"
|
379 |
client := &http.Client{
|
|
|
337 |
}
|
338 |
}
|
339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
func requestToken() (string, error) {
|
341 |
url := "https://duckduckgo.com/duckchat/v1/status"
|
342 |
client := &http.Client{
|