Skip to content

Commit f066f1b

Browse files
committed
update
1 parent a00203c commit f066f1b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

examples/Go/ChatApp/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)