zeuszhao 3 months ago
parent
commit
c9373e6809
3 changed files with 6 additions and 11 deletions
  1. 0 5
      kimi/chat.go
  2. 5 4
      kimi/kimi.go
  3. 1 2
      llm.go

+ 0 - 5
kimi/chat.go

@@ -91,8 +91,3 @@ func (c *Chat) Ask(ctx context.Context, text string) (string, error) {
 func (c *Chat) Close(ctx context.Context) error {
 	return c.Page.Close()
 }
-
-func (c *Chat) WithUserContext(user *llm.UserContext) llm.Chat {
-	c.userContext = user
-	return c
-}

+ 5 - 4
kimi/kimi.go

@@ -89,11 +89,12 @@ func (k *Kimi) GetName() string {
 	return "kimi"
 }
 
-func (k *Kimi) NewChat(ctx context.Context) (llm.Chat, error) {
+func (k *Kimi) NewChat(ctx context.Context, user *llm.UserContext) (llm.Chat, error) {
 	c := &Chat{
-		ai:       k,
-		Page:     k.browser.Context(ctx).MustIncognito().MustPage(),
-		qaSingle: make(chan bool),
+		ai:          k,
+		userContext: user,
+		Page:        k.browser.Context(ctx).MustIncognito().MustPage(),
+		qaSingle:    make(chan bool),
 	}
 	wait := c.Page.MustWaitNavigation()
 

+ 1 - 2
llm.go

@@ -6,14 +6,13 @@ import (
 
 type Chat interface {
 	Ask(ctx context.Context, text string) (string, error)
-	WithUserContext(user *UserContext) Chat
 	Close(ctx context.Context) error
 }
 
 type AI interface {
 	UserBrowserAgent
 	Init(ctx context.Context, debug bool) (AI, error)
-	NewChat(ctx context.Context) (Chat, error)
+	NewChat(ctx context.Context, user *UserContext) (Chat, error)
 	Close(ctx context.Context) error
 	GetName() string
 }