Chat
Send a chat message
Send a message to a space and receive a streaming response via Server-Sent Events.
POST
/
api
/
workspaces
/
{workspaceId}
/
chat
cURL
curl -X POST http://localhost:18080/api/workspaces/abc123/chat \
-H 'Content-Type: application/json' \
-d '{
"id": "chat-001",
"message": {
"role": "user",
"content": "What can you help me with?"
}
}'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({id: '<string>', message: {role: 'user', content: 'What can you help me with?'}})
};
fetch('http://localhost:18080/api/workspaces/{workspaceId}/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:18080/api/workspaces/{workspaceId}/chat"
payload = {
"id": "<string>",
"message": {
"role": "user",
"content": "What can you help me with?"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:18080/api/workspaces/{workspaceId}/chat"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"message\": {\n \"role\": \"user\",\n \"content\": \"What can you help me with?\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}"<string>"⌘I
cURL
curl -X POST http://localhost:18080/api/workspaces/abc123/chat \
-H 'Content-Type: application/json' \
-d '{
"id": "chat-001",
"message": {
"role": "user",
"content": "What can you help me with?"
}
}'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({id: '<string>', message: {role: 'user', content: 'What can you help me with?'}})
};
fetch('http://localhost:18080/api/workspaces/{workspaceId}/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:18080/api/workspaces/{workspaceId}/chat"
payload = {
"id": "<string>",
"message": {
"role": "user",
"content": "What can you help me with?"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:18080/api/workspaces/{workspaceId}/chat"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"message\": {\n \"role\": \"user\",\n \"content\": \"What can you help me with?\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}"<string>"
