MCPcopy
hub / github.com/the-open-agent/openagent / ChatTest

Method ChatTest

controllers/pipe.go:209–236  ·  view source on GitHub ↗

ChatTest sends a test message through the pipe to verify the full pipeline. @Title ChatTest @Tag Pipe API @Description send a test chat message through a pipe @Param id query string true "The id of the pipe (owner/name)" @Param chatId query string true "The chat/channel ID to send the message to" @P

()

Source from the content-addressed store, hash-verified

207// @Success 200 {object} controllers.Response The Response object
208// @router /api/chat-test [post]
209func (c *ApiController) ChatTest() {
210 id := c.Input().Get("id")
211 chatId := c.Input().Get("chatId")
212 message := c.Input().Get("message")
213
214 pipe, err := object.GetPipe(id)
215 if err != nil {
216 c.ResponseError(err.Error())
217 return
218 }
219 if pipe == nil {
220 c.ResponseError("pipe not found")
221 return
222 }
223
224 pipeObj, err := pipe.GetProvider(c.GetAcceptLanguage())
225 if err != nil {
226 c.ResponseError(err.Error())
227 return
228 }
229
230 if err = pipeObj.SendMessage(chatId, message); err != nil {
231 c.ResponseError(err.Error())
232 return
233 }
234
235 c.ResponseOk("message sent")
236}

Callers

nothing calls this directly

Calls 7

ResponseErrorMethod · 0.95
GetAcceptLanguageMethod · 0.95
ResponseOkMethod · 0.95
GetPipeFunction · 0.92
ErrorMethod · 0.80
SendMessageMethod · 0.65
GetProviderMethod · 0.45

Tested by

no test coverage detected