Skip to content

Commit

Permalink
docs: refactor API endpoint to use 'POST' method and 'chat' route for…
Browse files Browse the repository at this point in the history
… chat functionality
  • Loading branch information
glaucia86 committed Apr 3, 2024
1 parent 22af4cb commit f8e80e4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/tutorial/04-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export async function chat(request: HttpRequest, context: InvocationContext): Pr
}
}

app.post('chat', {
app.http('chat', {
route: 'chat',
methods: ['POST'],
authLevel: 'anonymous',
handler: chat,
});
Expand All @@ -76,7 +77,7 @@ In this case, we put as the first parameter the type of message we are sending,

## Implementing a `chain` for the `chat` API

Agora que já criamos um chat mais dinâmico, vamos implementar o `chain` para que a conversa seja mais fluída e coerente. Para isso, adicione o seguinte código logo após a criação do `questionAnsweringPrompt`:
Now that we've created a more dynamic chat, let's implement the `chain` so that the conversation is more fluid and coherent. To do this, add the following code right after creating the `questionAnsweringPrompt`:

```typescript
(... the previous code ...)
Expand Down Expand Up @@ -107,8 +108,9 @@ Agora que já criamos um chat mais dinâmico, vamos implementar o `chain` para q
return serviceUnavailable(new Error('Service temporarily unavailable. Please try again later.'));
};

app.post('chat', {
app.http('chat', {
route: 'chat',
methods: ['POST'],
authLevel: 'anonymous',
handler: chat,
});
Expand Down

0 comments on commit f8e80e4

Please sign in to comment.