Skip to content

Commit

Permalink
small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
popestr committed Jul 10, 2024
1 parent 033286f commit 57601ad
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/chat-headless/docs/chat-headless.chatheadless.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface ChatHeadless
| [getNextMessage(text, source)](./chat-headless.chatheadless.getnextmessage.md) | Performs a Chat API request for the next message generated by chat bot using the conversation state (e.g. message history and notes). Update the state with the response data. |
| [initLocalStorage()](./chat-headless.chatheadless.initlocalstorage.md) | Loads the [ConversationState](./chat-headless.conversationstate.md) from local storage, if present, and adds a listener to keep the conversation state in sync with the stored state |
| [report(eventPayload)](./chat-headless.chatheadless.report.md) | Send Chat related analytics event to Yext Analytics API. |
| [restartConversation()](./chat-headless.chatheadless.restartconversation.md) | Resets all fields within [ConversationState](./chat-headless.conversationstate.md) and the agent session, if one exists. |
| [restartConversation()](./chat-headless.chatheadless.restartconversation.md) | <p>Resets all fields within the [ConversationState](./chat-headless.conversationstate.md)<!-- -->, and sets the active client to the <code>bot</code> client, if one was provided when constructing the [ChatHeadless](./chat-headless.chatheadless.md) instance.</p><p>If a [ChatEventClient](./chat-headless.chateventclient.md) is currently active before reset, that client's <code>resetSession</code> method is called.</p> |
| [setCanSendMessage(canSendMessage)](./chat-headless.chatheadless.setcansendmessage.md) | Sets [ConversationState.canSendMessage](./chat-headless.conversationstate.cansendmessage.md) to the specified state |
| [setChatLoadingStatus(isLoading)](./chat-headless.chatheadless.setchatloadingstatus.md) | Sets [ConversationState.isLoading](./chat-headless.conversationstate.isloading.md) to the specified loading state |
| [setContext(context)](./chat-headless.chatheadless.setcontext.md) | Sets [MetaState.context](./chat-headless.metastate.context.md) to the specified context. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

## ChatHeadless.restartConversation() method

Resets all fields within [ConversationState](./chat-headless.conversationstate.md) and the agent session, if one exists.
Resets all fields within the [ConversationState](./chat-headless.conversationstate.md)<!-- -->, and sets the active client to the `bot` client, if one was provided when constructing the [ChatHeadless](./chat-headless.chatheadless.md) instance.

If a [ChatEventClient](./chat-headless.chateventclient.md) is currently active before reset, that client's `resetSession` method is called.

**Signature:**

Expand Down
2 changes: 1 addition & 1 deletion packages/chat-headless/src/ChatHeadlessImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ export class ChatHeadlessImpl implements ChatHeadless {
restartConversation() {
if (isChatEventClient(this.chatClient)) {
this.chatClient.resetSession();
this.chatClient = this.botClient;
}
this.chatClient = this.botClient;

this.setConversationId(undefined);
this.setChatLoadingStatus(false);
Expand Down
7 changes: 6 additions & 1 deletion packages/chat-headless/src/models/ChatHeadless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ export interface ChatHeadless {
*/
initLocalStorage(): void;
/**
* Resets all fields within {@link ConversationState} and the agent session, if one exists.
* Resets all fields within the {@link ConversationState}, and sets the active
* client to the `bot` client, if one was provided when constructing the
* {@link ChatHeadless} instance.
*
* If a {@link ChatEventClient} is currently active before reset, that client's
* `resetSession` method is called.
*
* @public
*/
Expand Down

0 comments on commit 57601ad

Please sign in to comment.