Browse Source

等待页面js执行完成,否则获取的内容不全,主要原因是目前判断是否回答完成是当前sse是否完成,及页面元素是否开始出现,没有找到好的判断结束的方法

zeuszhao 3 months ago
parent
commit
a27f0baa75
1 changed files with 3 additions and 0 deletions
  1. 3 0
      kimi/chat.go

+ 3 - 0
kimi/chat.go

@@ -81,6 +81,9 @@ func (c *Chat) Ask(ctx context.Context, text string) (string, error) {
 		return "", err
 	}
 
+	// todo 等待页面js执行完成
+	<-time.After(1 * time.Second)
+
 	qaEle, err := c.Page.Elements(".pop-content")
 	if err != nil {
 		return "", err