mirror of
https://github.com/ddworken/hishtory.git
synced 2025-03-16 16:28:15 +01:00
Log OpenAI error to debug log for #167
This commit is contained in:
parent
a6333ea995
commit
d27c3cd8e4
@ -496,6 +496,7 @@ func renderNullableTable(m model, helpText string) string {
|
||||
func getRowsFromAiSuggestions(ctx context.Context, columnNames []string, query string) ([]table.Row, []*data.HistoryEntry, error) {
|
||||
suggestions, err := ai.DebouncedGetAiSuggestions(ctx, strings.TrimPrefix(query, "?"), 5)
|
||||
if err != nil {
|
||||
hctx.GetLogger().Infof("failed to get AI query suggestions: %v", err)
|
||||
return nil, nil, fmt.Errorf("failed to get AI query suggestions: %w", err)
|
||||
}
|
||||
var rows []table.Row
|
||||
|
@ -103,7 +103,7 @@ func GetAiSuggestionsViaOpenAiApi(query, shellName, osName string, numberComplet
|
||||
return nil, OpenAiUsage{}, fmt.Errorf("failed to parse OpenAI API response=%#v: %w", bodyText, err)
|
||||
}
|
||||
if len(apiResp.Choices) == 0 {
|
||||
return nil, OpenAiUsage{}, fmt.Errorf("OpenAI API returned zero choices, parsed resp=%#v, resp body=%#v", apiResp, bodyText)
|
||||
return nil, OpenAiUsage{}, fmt.Errorf("OpenAI API returned zero choices, parsed resp=%#v, resp body=%#v, resp.StatusCode=%d", apiResp, bodyText, resp.StatusCode)
|
||||
}
|
||||
ret := make([]string, 0)
|
||||
for _, item := range apiResp.Choices {
|
||||
|
Loading…
Reference in New Issue
Block a user