Reply by k3kalinix | 2023-12-21 10:20:29
Hello <@606256062613684224>
Reply by k3kalinix | 2023-12-21 10:20:29
Hello <@606256062613684224>
Reply by enormousvampire | 2023-12-23 11:26:26
Hii <@606256062613684224> . Sorry for the delay in response. Let me first clarify what youre asking.
You want to initiate the conversation with an initial text prompt before transitioning to the usual Speech-to-Text interaction. Your goal is to have the character interact based on a text prompt for the first user interaction (when the player comes close to the character or something like that), and then proceed with the standard Speech-to-Text functionality.
Reply by enormousvampire | 2023-12-23 11:30:20
If this is the query, then yes, you can very easily do it.
You can use two functions to achieve this.
One function is InitializeSessionIDAsync, and the other is SendTextData. Both of these functions are in the ConvaiGRPCAPI class.
if you cannot find the functions, here is the code for SendTextData:
Reply by enormousvampire | 2023-12-23 11:30:47
public async Task SendTextData(
ConvaiService.ConvaiServiceClient client,
string userText,
string characterID,
bool isActionActive,
bool isLipSyncActive,
ActionConfig actionConfig,
FaceModel faceModel)
{
AsyncDuplexStreamingCall<GetResponseRequest, GetResponseResponse> call =
GetAsyncDuplexStreamingCallOptions(client);
GetResponseRequest getResponseConfigRequest = CreateGetResponseRequest(
isActionActive,
isLipSyncActive,
0,
characterID,
actionConfig,
faceModel);
try
{
await call.RequestStream.WriteAsync(getResponseConfigRequest);
await call.RequestStream.WriteAsync(new GetResponseRequest
{
GetResponseData = new GetResponseData
{
TextData = userText
}
});
await call.RequestStream.CompleteAsync();
// Store the task that receives results from the server.
Task receiveResultsTask = Task.Run(
async () => { await ReceiveResultFromServer(call, _cancellationTokenSource.Token); },
_cancellationTokenSource.Token);
// Await the task if needed to ensure it completes before this method returns [OPTIONAL]
await receiveResultsTask.ConfigureAwait(false);
}
catch (Exception ex)
{
Logger.Error(ex, Logger.LogCategory.Character);
}
}
Reply by enormousvampire | 2023-12-23 11:32:24
So basically, whenever the player approaches an NPC, you can call this function and send any text data to you, and the NOC will respond. Or you can add your own logic as to when you should trigger this initial text response.
Hopefully, this can help you. Let me know if this works.
Replying to enormousvampire’s Message
Reply by enormousvampire | 2023-12-23 11:26:26
Hii <@606256062613684224> . Sorry for the delay in response. Let me first clarify what youre asking.
You want to initiate the conversation with an initial text prompt before transitioning to the usual Speech-to-Text interaction. Your goal is to have the character interact based on a text prompt for the first user interaction (when the player comes close to the character or something like that), and then proceed with the standard Speech-to-Text functionality.
Reply by petroslouca | 2023-12-24 00:35:09
Yes that is exactly what I would like to do, I will add a text to the “userText” string and see how this will work.
Reply by enormousvampire | 2023-12-28 18:00:49
Hey <@606256062613684224> Did the snippet work ?
Reply by petroslouca | 2024-01-21 21:26:35
Hello, could you also include the " InitializeSessionIDAsync" function? Is it possible to send me the complete “convaitextinout.cs” script file?
As mentioned earlier, I have already progressed my project significantly and I am skepticism in performing any version update. The Grpc.Core.Api is dated 18-08-2023 and its file properties details tab states 2.26, the ConvAI package was downloaded from the following address ConvaiDemoProject.zip - Google Drive
Thank you!
PS: The “GetAsyncDuplexStreamingCallOptions(client)” and “_cancellationTokenSource.Token” are not recognized.
This conversation happened on the Convai Discord Server, so this post will be closed.