Implement json.Unmarshaler to CreateMessageResult (#191)
When calling `ServerSession.CreateMessage`, will get an json unmarshal error because `CreateMessageResult.Content` is an interface, and it doesn't implement `json.Unmarshaller`. Implement the `json.Unmarshaller` to `CreateMessageResult`, let it able to unmarshal the client response without error
This commit is contained in:
parent
982a0bceca
commit
bacca7a1d2
1 changed files with 18 additions and 1 deletions
|
|
@ -125,7 +125,7 @@ func TestEndToEnd(t *testing.T) {
|
|||
loggingMessages := make(chan *LoggingMessageParams, 100) // big enough for all logging
|
||||
opts := &ClientOptions{
|
||||
CreateMessageHandler: func(context.Context, *ClientSession, *CreateMessageParams) (*CreateMessageResult, error) {
|
||||
return &CreateMessageResult{Model: "aModel"}, nil
|
||||
return &CreateMessageResult{Model: "aModel", Content: &TextContent{}}, nil
|
||||
},
|
||||
ToolListChangedHandler: func(context.Context, *ClientSession, *ToolListChangedParams) { notificationChans["tools"] <- 0 },
|
||||
PromptListChangedHandler: func(context.Context, *ClientSession, *PromptListChangedParams) { notificationChans["prompts"] <- 0 },
|
||||
|
|
|
|||
Loading…
Reference in a new issue