Skip to content

Commit c0c22d2

Browse files
committed
remove MultiCodeBlock from ConvoAI Quickstart
1 parent e101951 commit c0c22d2

File tree

1 file changed

+31
-22
lines changed

1 file changed

+31
-22
lines changed

conversational-ai/get-started/quickstart.mdx

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ description: >
77
Set up real-time interaction with a Conversational AI agent.
88
---
99

10-
import MultiCodeBlock, { CodeGroup, CodeItem } from '@app/mdx-components/MultiCodeBlock';
10+
import Tabs from '@theme/Tabs';
11+
import TabItem from '@theme/TabItem';
12+
import CodeBlock from '@theme/CodeBlock';
1113

1214
This page describes how to call the <Vpd k="NAME" /> RESTful APIs to start and stop an AI agent.
1315

@@ -53,9 +55,9 @@ This section introduces the basic RESTful API requests you use to start and stop
5355

5456
Call the `join` endpoint to create an agent instance that joins an Agora channel. Pass in the `channel` name and `token` for agent authentication. To generate your base64-encoded credentials, see [RESTful authentication](../rest-api/restful-authentication.mdx).
5557

56-
<MultiCodeBlock caption="Sample request:">
57-
<CodeGroup label="Select">
58-
<CodeItem language="js" name="Node.js">{`const fetch = require('node-fetch');\n
58+
<Tabs groupId="language">
59+
<TabItem value="node" label="Node.js" default>
60+
<CodeBlock language="js">{`const fetch = require('node-fetch');\n
5961
const url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join";\n
6062
const headers = \{
6163
"Authorization": "Basic <your_base64_encoded_credentials>",
@@ -106,9 +108,11 @@ fetch(url, \{
106108
})
107109
.then(response => response.json())
108110
.then(json => console.log(json))
109-
.catch(error => console.error("Error:", error));`}</CodeItem>
111+
.catch(error => console.error("Error:", error));`}</CodeBlock>
112+
</TabItem>
110113

111-
<CodeItem language="json" name="curl">{`curl --request POST \\
114+
<TabItem value="curl" label="Curl">
115+
<CodeBlock language="json">{`curl --request POST \\
112116
--url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join \\
113117
--header 'Authorization: Basic <your_base64_encoded_credentials>' \\
114118
--header 'Content-Type: application/json' \\
@@ -150,9 +154,11 @@ fetch(url, \{
150154
}
151155
}
152156
}
153-
}'`}</CodeItem>
157+
}'`}</CodeBlock>
158+
</TabItem>
154159

155-
<CodeItem language="python" name="Python">{`import requests
160+
<TabItem value="python" label="Python">
161+
<CodeBlock language="python">{`import requests
156162
import json\n
157163
url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join"\n
158164
headers = \{
@@ -198,10 +204,10 @@ data = \{
198204
}
199205
}\n
200206
response = requests.post(url, headers=headers, data=json.dumps(data))
201-
print(response.text)`}</CodeItem>
207+
print(response.text)`}</CodeBlock>
202208

203-
</CodeGroup>
204-
</MultiCodeBlock>
209+
</TabItem>
210+
</Tabs>
205211

206212
For complete information on all request parameters, see [Start a conversational AI agent](../rest-api/join).
207213

@@ -223,9 +229,9 @@ Store the `agent_id` for use in subsequent API calls to [query](../rest-api/quer
223229
To end the conversation with the AI agent, call the `leave` endpoint. This causes the agent to leave the Agora channel.
224230

225231

226-
<MultiCodeBlock caption="Sample request:">
227-
<CodeGroup label="Select">
228-
<CodeItem language="js" name="Node.js">{`const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/leave';\n
232+
<Tabs groupId="language">
233+
<TabItem value="node" label="Node.js">
234+
<CodeBlock language="js">{`const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/leave';\n
229235
const options = \{
230236
method: 'POST',
231237
headers: {
@@ -237,24 +243,27 @@ fetch(url, options)
237243
.then(res => res.json())
238244
.then(json => console.log(json))
239245
.catch(err => console.error(err));
240-
`}</CodeItem>
246+
`}</CodeBlock>
247+
</TabItem>
241248

242-
<CodeItem language="bash" name="curl">{`curl --request post \\
249+
<TabItem value="curl" label="Curl">
250+
<CodeBlock language="bash">{`curl --request post \\
243251
--url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/leave \\
244-
--header 'Authorization: Basic <your_base64_encoded_credentials>'`}</CodeItem>
252+
--header 'Authorization: Basic <your_base64_encoded_credentials>'`}</CodeBlock>
253+
</TabItem>
245254

246-
<CodeItem language="python" name="Python">{`import requests\n
255+
<TabItem value="python" label="Python">
256+
<CodeBlock language="python">{`import requests\n
247257
url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/leave"\n
248258
headers = \{
249259
"Authorization": "Basic <your_base64_encoded_credentials>",
250260
"Content-Type": "application/json"
251261
}\n
252262
response = requests.post(url, headers=headers)
253263
print(response.text)
254-
`}</CodeItem>
255-
256-
</CodeGroup>
257-
</MultiCodeBlock>
264+
`}</CodeBlock>
265+
</TabItem>
266+
</Tabs>
258267

259268
If the request is successful, the server responds with a `200 OK` status and an empty JSON object.
260269

0 commit comments

Comments
 (0)