mirror of
https://github.com/coalaura/whiskr.git
synced 2025-12-02 20:22:52 +00:00
improve some error messages
This commit is contained in:
4
chat.go
4
chat.go
@@ -404,7 +404,7 @@ func HandleChat(w http.ResponseWriter, r *http.Request) {
|
|||||||
func RunCompletion(ctx context.Context, response *Stream, request *openrouter.ChatCompletionRequest) (*ToolCall, string, error) {
|
func RunCompletion(ctx context.Context, response *Stream, request *openrouter.ChatCompletionRequest) (*ToolCall, string, error) {
|
||||||
stream, err := OpenRouterStartStream(ctx, *request)
|
stream, err := OpenRouterStartStream(ctx, *request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", fmt.Errorf("stream.start: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer stream.Close()
|
defer stream.Close()
|
||||||
@@ -426,7 +426,7 @@ func RunCompletion(ctx context.Context, response *Stream, request *openrouter.Ch
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, "", err
|
return nil, "", fmt.Errorf("stream.receive: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if id == "" {
|
if id == "" {
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ func HandleGitHubRepositoryTool(ctx context.Context, tool *ToolCall) error {
|
|||||||
func ParseAndUpdateArgs(tool *ToolCall, arguments any) error {
|
func ParseAndUpdateArgs(tool *ToolCall, arguments any) error {
|
||||||
err := json.Unmarshal([]byte(tool.Args), arguments)
|
err := json.Unmarshal([]byte(tool.Args), arguments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("json.unmarshal: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := GetFreeBuffer()
|
buf := GetFreeBuffer()
|
||||||
@@ -218,7 +218,7 @@ func ParseAndUpdateArgs(tool *ToolCall, arguments any) error {
|
|||||||
|
|
||||||
err = enc.Encode(arguments)
|
err = enc.Encode(arguments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("json.marshal: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
tool.Args = buf.String()
|
tool.Args = buf.String()
|
||||||
|
|||||||
Reference in New Issue
Block a user