Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using URN identity for brain #93

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flows/actions/testdata/call_brain.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"url": "http://127.0.0.1:49994/messages?token=token",
"status_code": 200,
"status": "success",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 253\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212?channel=57f1078f-88aa-46f4-a59a-948a5739c03d\\u0026id=123\",\"attachments\":[\"image/jpeg:http://http://s3.amazon.com/bucket/test.jpg\",\"audio/mp3:http://s3.amazon.com/bucket/test.mp3\"]}",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 196\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212\",\"attachments\":[\"image/jpeg:http://http://s3.amazon.com/bucket/test.jpg\",\"audio/mp3:http://s3.amazon.com/bucket/test.mp3\"]}",
"response": "HTTP/1.0 200 OK\r\nContent-Length: 0\r\n\r\n",
"elapsed_ms": 0,
"retries": 0,
Expand Down Expand Up @@ -51,7 +51,7 @@
"url": "http://127.0.0.1:49994/messages?token=token",
"status_code": 200,
"status": "success",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 151\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Different entry\",\"contact_urn\":\"tel:+12065551212?channel=57f1078f-88aa-46f4-a59a-948a5739c03d\\u0026id=123\",\"attachments\":[]}",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 94\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Different entry\",\"contact_urn\":\"tel:+12065551212\",\"attachments\":[]}",
"response": "HTTP/1.0 200 OK\r\nContent-Length: 0\r\n\r\n",
"elapsed_ms": 0,
"retries": 0,
Expand Down Expand Up @@ -87,7 +87,7 @@
"step_uuid": "59d74b86-3e2f-4a93-aece-b05d2fdcde0c",
"url": "http://127.0.0.1:49994/messages?token=token",
"status": "connection_error",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 253\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212?channel=57f1078f-88aa-46f4-a59a-948a5739c03d\\u0026id=123\",\"attachments\":[\"image/jpeg:http://http://s3.amazon.com/bucket/test.jpg\",\"audio/mp3:http://s3.amazon.com/bucket/test.mp3\"]}",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 196\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212\",\"attachments\":[\"image/jpeg:http://http://s3.amazon.com/bucket/test.jpg\",\"audio/mp3:http://s3.amazon.com/bucket/test.mp3\"]}",
"elapsed_ms": 0,
"retries": 0,
"extraction": "none"
Expand Down Expand Up @@ -117,7 +117,7 @@
"url": "http://127.0.0.1:49994/messages?token=token",
"status_code": 400,
"status": "response_error",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 253\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212?channel=57f1078f-88aa-46f4-a59a-948a5739c03d\\u0026id=123\",\"attachments\":[\"image/jpeg:http://http://s3.amazon.com/bucket/test.jpg\",\"audio/mp3:http://s3.amazon.com/bucket/test.mp3\"]}",
"request": "POST /messages?token=token HTTP/1.1\r\nHost: 127.0.0.1:49994\r\nUser-Agent: goflow-testing\r\nContent-Length: 196\r\nAccept-Encoding: gzip\r\n\r\n{\"project_uuid\":\"\",\"text\":\"Hi everybody\",\"contact_urn\":\"tel:+12065551212\",\"attachments\":[\"image/jpeg:http://http://s3.amazon.com/bucket/test.jpg\",\"audio/mp3:http://s3.amazon.com/bucket/test.mp3\"]}",
"response": "HTTP/1.0 400 Bad Request\r\nContent-Length: 29\r\n\r\n{ \"errors\": [\"bad_request\"] }",
"elapsed_ms": 0,
"retries": 0,
Expand Down
10 changes: 5 additions & 5 deletions services/brain/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ func NewService(httpClient *http.Client, httpRetries *httpx.RetryConfig, httpAcc
func (s *service) Call(session flows.Session, projectUUID uuids.UUID, text string, contactURN urns.URN, attachments []utils.Attachment) (*flows.BrainCall, error) {

body := struct {
ProjectUUID uuids.UUID `json:"project_uuid"`
Text string `json:"text"`
ContactURN urns.URN `json:"contact_urn"`
Attachments []utils.Attachment `json:"attachments"`
ProjectUUID uuids.UUID `json:"project_uuid"`
Text string `json:"text"`
ContactURN urns.URN `json:"contact_urn"`
Attachments []utils.Attachment `json:"attachments"`
}{
ProjectUUID: projectUUID,
Text: text,
ContactURN: contactURN,
ContactURN: contactURN.Identity(),
Attachments: attachments,
}

Expand Down
Loading