@@ -39,6 +39,10 @@ type AIThread struct {
3939 UpdateAt int64 `json:"update_at"`
4040}
4141
42+ type ConfigProvider interface {
43+ AllowNativeWebSearchInChannels () bool
44+ }
45+
4246type Conversations struct {
4347 prompts * llm.Prompts
4448 mmClient mmapi.Client
@@ -49,6 +53,7 @@ type Conversations struct {
4953 licenseChecker * enterprise.LicenseChecker
5054 i18n * i18n.Bundle
5155 meetingsService MeetingsService
56+ configProvider ConfigProvider
5257}
5358
5459// MeetingsService defines the interface for meetings functionality needed by conversations
@@ -67,6 +72,7 @@ func New(
6772 licenseChecker * enterprise.LicenseChecker ,
6873 i18nBundle * i18n.Bundle ,
6974 meetingsService MeetingsService ,
75+ configProvider ConfigProvider ,
7076) * Conversations {
7177 return & Conversations {
7278 prompts : prompts ,
@@ -78,6 +84,7 @@ func New(
7884 licenseChecker : licenseChecker ,
7985 i18n : i18nBundle ,
8086 meetingsService : meetingsService ,
87+ configProvider : configProvider ,
8188 }
8289}
8390
@@ -133,8 +140,11 @@ func (c *Conversations) ProcessUserRequestWithContext(bot *bots.Bot, postingUser
133140 }
134141 var opts []llm.LanguageModelOption
135142 if ! isDM {
136- // In non-DM channels, disable tools for security but provide info about DM-only tools
137143 opts = append (opts , llm .WithToolsDisabled ())
144+
145+ if c .configProvider != nil && c .configProvider .AllowNativeWebSearchInChannels () && bot .HasNativeWebSearchEnabled () {
146+ opts = append (opts , llm .WithNativeWebSearchAllowed ())
147+ }
138148 }
139149 result , err := bot .LLM ().ChatCompletion (completionRequest , opts ... )
140150 if err != nil {
0 commit comments