forked from ConnectAI-E/feishu-openai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ConnectAI-E#194 from LufeiCheng/feat_ai_mode
feat ConnectAI-E#181 add temperature params modify by choose ai mode
- Loading branch information
Showing
10 changed files
with
168 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package handlers | ||
|
||
import ( | ||
"context" | ||
|
||
"start-feishubot/services" | ||
"start-feishubot/services/openai" | ||
|
||
larkcard "github.com/larksuite/oapi-sdk-go/v3/card" | ||
) | ||
|
||
// AIModeChooseKind is the kind of card action for choosing AI mode | ||
func NewAIModeCardHandler(cardMsg CardMsg, | ||
m MessageHandler) CardHandlerFunc { | ||
return func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { | ||
|
||
if cardMsg.Kind == AIModeChooseKind { | ||
newCard, err, done := CommonProcessAIMode(cardMsg, cardAction, | ||
m.sessionCache) | ||
if done { | ||
return newCard, err | ||
} | ||
return nil, nil | ||
} | ||
return nil, ErrNextHandler | ||
} | ||
} | ||
|
||
// CommonProcessAIMode is the common process for choosing AI mode | ||
func CommonProcessAIMode(msg CardMsg, cardAction *larkcard.CardAction, | ||
cache services.SessionServiceCacheInterface) (interface{}, | ||
error, bool) { | ||
option := cardAction.Action.Option | ||
replyMsg(context.Background(), "已选择AI模式:"+option, | ||
&msg.MsgId) | ||
cache.SetAIMode(msg.SessionId, openai.AIModeMap[option]) | ||
return nil, nil, true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,8 @@ | |
|
||
🎭 角色扮演:支持场景模式,增添讨论乐趣和创意 | ||
|
||
🤖 AI模式:内置4种AI模式,感受AI的智慧与创意 | ||
|
||
🔄 上下文保留:回复对话框即可继续同一话题讨论 | ||
|
||
⏰ 自动结束:超时自动结束对话,支持清除讨论历史 | ||
|