File tree Expand file tree Collapse file tree
Core/Sources/HostApp/FeatureSettings/Chat Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ struct ChatSettingsGeneralSectionView: View {
1616 @AppStorage ( \. chatCodeFont) var chatCodeFont
1717
1818 @AppStorage ( \. defaultChatFeatureChatModelId) var defaultChatFeatureChatModelId
19+ @AppStorage ( \. preferredChatModelIdForUtilities) var utilityChatModelId
1920 @AppStorage ( \. defaultChatSystemPrompt) var defaultChatSystemPrompt
2021 @AppStorage ( \. chatSearchPluginMaxIterations) var chatSearchPluginMaxIterations
2122 @AppStorage ( \. defaultChatFeatureEmbeddingModelId) var defaultChatFeatureEmbeddingModelId
@@ -119,6 +120,27 @@ struct ChatSettingsGeneralSectionView: View {
119120 }
120121 }
121122
123+ Picker (
124+ " Utility chat model " ,
125+ selection: $settings. utilityChatModelId
126+ ) {
127+ Text ( " Use the default model " ) . tag ( " " )
128+
129+ if !settings. chatModels. contains ( where: { $0. id == settings. utilityChatModelId } ) ,
130+ !settings. utilityChatModelId. isEmpty
131+ {
132+ Text (
133+ ( settings. chatModels. first? . name) . map { " \( $0) (Default) " }
134+ ?? " No Model Found "
135+ )
136+ . tag ( settings. utilityChatModelId)
137+ }
138+
139+ ForEach ( settings. chatModels, id: \. id) { chatModel in
140+ Text ( chatModel. name) . tag ( chatModel. id)
141+ }
142+ }
143+
122144 Picker (
123145 " Embedding model " ,
124146 selection: $settings. defaultChatFeatureEmbeddingModelId
Original file line number Diff line number Diff line change 11import Foundation
22import Logger
33import OpenAIService
4+ import Preferences
45
56public class CombineAnswersChain : Chain {
67 public struct Input : Decodable {
@@ -16,7 +17,8 @@ public class CombineAnswersChain: Chain {
1617 public let chatModelChain : ChatModelChain < Input >
1718
1819 public init (
19- configuration: ChatGPTConfiguration = UserPreferenceChatGPTConfiguration ( ) ,
20+ configuration: ChatGPTConfiguration =
21+ UserPreferenceChatGPTConfiguration ( chatModelKey: \. preferredChatModelIdForUtilities) ,
2022 extraInstructions: String = " "
2123 ) {
2224 chatModelChain = . init(
Original file line number Diff line number Diff line change 1+ import ChatBasic
12import Foundation
23import OpenAIService
3- import ChatBasic
4+ import Preferences
45
56public final class RefineDocumentChain : Chain {
67 public struct Input {
@@ -76,7 +77,10 @@ public final class RefineDocumentChain: Chain {
7677 func buildChatModel( ) -> ChatModelChain < RefinementInput > {
7778 . init(
7879 chatModel: OpenAIChat (
79- configuration: UserPreferenceChatGPTConfiguration ( ) . overriding {
80+ configuration: UserPreferenceChatGPTConfiguration (
81+ chatModelKey: \. preferredChatModelIdForUtilities
82+ )
83+ . overriding {
8084 $0. temperature = 0
8185 $0. runFunctionsAutomatically = false
8286 } ,
Original file line number Diff line number Diff line change 11import ChatBasic
22import Foundation
33import OpenAIService
4+ import Preferences
45
56public final class RelevantInformationExtractionChain : Chain {
67 public struct Input {
@@ -52,7 +53,10 @@ public final class RelevantInformationExtractionChain: Chain {
5253 func buildChatModel( ) -> ChatModelChain < TaskInput > {
5354 . init(
5455 chatModel: OpenAIChat (
55- configuration: UserPreferenceChatGPTConfiguration ( ) . overriding {
56+ configuration: UserPreferenceChatGPTConfiguration (
57+ chatModelKey: \. preferredChatModelIdForUtilities
58+ )
59+ . overriding {
5660 $0. temperature = 0.5
5761 $0. runFunctionsAutomatically = false
5862 } ,
Original file line number Diff line number Diff line change @@ -505,6 +505,10 @@ public extension UserDefaultPreferenceKeys {
505505 var preferredChatModelIdForWebScope : PreferenceKey < String > {
506506 . init( defaultValue: " " , key: " PreferredChatModelIdForWebScope " )
507507 }
508+
509+ var preferredChatModelIdForUtilities : PreferenceKey < String > {
510+ . init( defaultValue: " " , key: " PreferredChatModelIdForUtilities " )
511+ }
508512
509513 var disableFloatOnTopWhenTheChatPanelIsDetached : PreferenceKey < Bool > {
510514 . init( defaultValue: true , key: " DisableFloatOnTopWhenTheChatPanelIsDetached " )
You can’t perform that action at this time.
0 commit comments