Skip to content

Commit

Permalink
Merge pull request #330 from uezo/workaround-clear-llm-context
Browse files Browse the repository at this point in the history
Provide workaround to clear state data, including LLM context
  • Loading branch information
uezo committed Sep 1, 2024
2 parents ded4a4d + f4b4cd7 commit 10bcb5f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Scripts/Dialog/DialogController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,18 @@ public CancellationToken GetDialogToken()
return dialogTokenSource.Token;
}

public async UniTask ClearStateAsync(string userId = null)
{
if (requestProcessor is LocalRequestProcessor)
{
if (string.IsNullOrEmpty(userId))
{
userId = GetClientIdDefault();
}
await ((LocalRequestProcessor)requestProcessor).ClearStateAsync(userId);
}
}

private void Update()
{
// Control mute
Expand Down
5 changes: 5 additions & 0 deletions Scripts/Dialog/Processor/LocalRequestProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,10 @@ public virtual async UniTask<Response> ProcessRequestAsync(Request request, Canc
throw ex;
}
}

public virtual async UniTask ClearStateAsync(string userId)
{
await StateStore.DeleteStateAsync(userId);
}
}
}

0 comments on commit 10bcb5f

Please sign in to comment.