소스 검색

wip:并发限制提交

wangkaiyue 2 년 전
부모
커밋
3c3bd1141c
2개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  1. 0 2
      internal/model/pool.go
  2. 1 0
      internal/model/question.go

+ 0 - 2
internal/model/pool.go

@@ -16,7 +16,6 @@ type cChatGptPool struct {
 }
 
 func NewChatGptPool(pool int) *cChatGptPool {
-	fmt.Println("pool", pool)
 	c := &cChatGptPool{
 		GPTPool: make(chan bool, pool),
 	}
@@ -27,7 +26,6 @@ func NewChatGptPool(pool int) *cChatGptPool {
 }
 
 func (c *cChatGptPool) Get() error {
-	fmt.Println("tttt", g.Config().MustGet(gctx.New(), "chat.api.waitTimeout", 10).Int())
 	select {
 	case <-c.GPTPool:
 		return nil

+ 1 - 0
internal/model/question.go

@@ -163,6 +163,7 @@ func (q *cQuestion) DetailQuestion(ctx context.Context, qRes *QuestionReq) (repl
 		}
 		cRes, err := ChatGpt.GPTDo(ctx, qRes)
 		if err != nil {
+			ChatGptPool.Add()
 			return "", nil, 0, err
 		}
 		return "", cRes, Answer_ChatGPT, nil