File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ func (app *ChatApp) callAzureOpenAI(userMessage string) (string, error) {
145145 }
146146
147147 if len (completion .Choices ) == 0 {
148- return "" , fmt .Errorf ("no choices in response " )
148+ return "" , fmt .Errorf ("chat completion returned zero choices " )
149149 }
150150
151151 return completion .Choices [0 ].Message .Content , nil
@@ -201,14 +201,15 @@ func main() {
201201 var aiConfig AIConfig
202202 if err := configProvider .Unmarshal (& aiConfig , & azureappconfiguration.ConstructionOptions {Separator : ":" }); err != nil {
203203 log .Fatal ("Error loading AI configuration:" , err )
204- return
205204 }
206205
207206 // Register a callback to refresh AI configuration on changes
208207 configProvider .OnRefreshSuccess (func () {
209- configProvider .Unmarshal (& aiConfig , & azureappconfiguration.ConstructionOptions {Separator : ":" })
208+ if err := configProvider .Unmarshal (& aiConfig , & azureappconfiguration.ConstructionOptions {Separator : ":" }); err != nil {
209+ log .Printf ("Error refreshing AI configuration: %v" , err )
210+ }
210211 })
211-
212+
212213 app := & ChatApp {
213214 configProvider : configProvider ,
214215 aiConfig : aiConfig ,
You can’t perform that action at this time.
0 commit comments