Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for User-Defined Tags in Response Messages #339

Open
uezo opened this issue Sep 9, 2024 · 2 comments
Open

Support for User-Defined Tags in Response Messages #339

uezo opened this issue Sep 9, 2024 · 2 comments

Comments

@uezo
Copy link
Owner

uezo commented Sep 9, 2024

Currently, the framework supports built-in tags like [face:Joy] for facial expressions and [anim:wave_hands] for animations in the AI's response messages. It would be helpful to extend this functionality to allow user-defined tags.

Request:

  • Enable users to define their own tags within the AI response messages.
  • Provide a mechanism to extract these custom tags and trigger user-defined behaviors or actions based on the tag's content.

This feature would allow developers to create more flexible and customizable interactions by adding their own sets of tags and corresponding custom logic for processing them.

Example use case: A developer could define a tag like [sound:bell] to trigger a specific sound effect in their application.

uezo added a commit that referenced this issue Sep 13, 2024
Implement support for user-defined tags in response messages.
Related issue: #339

Usage

```csharp
// User defined tag example: Dynamic multi language switching
// Insert following instruction to ChatGPTService.
// ----
// If you want change current language, insert language tag like [language:en-US].
//
// Example:
// [language:en-US]From now on, let's talk in English.
// ----
var chatGPTService = gameObject.GetComponent<ChatGPTService>();
chatGPTService.HandleExtractedTags = (tags, session) =>
{
    if (tags.ContainsKey("language"))
    {
        var language = tags["language"].Contains("-") ? tags["language"].Split('-')[0] : tags["language"];
        if (language != "ja")
        {
            var openAITTS = gameObject.GetComponent<OpenAITTSLoader>();
            modelController.RegisterTTSFunction(openAITTS.Name, openAITTS.GetAudioClipAsync, true);
        }
        else
        {
            var voicevoxTTS = gameObject.GetComponent<VoicevoxTTSLoader>();
            modelController.RegisterTTSFunction(voicevoxTTS.Name, voicevoxTTS.GetAudioClipAsync, true);
        }
        var openAIListener = gameObject.GetComponent<OpenAISpeechListener>();
        openAIListener.Language = language;
        Debug.Log($"Set language to {language}");
    }
};
```
@uezo
Copy link
Owner Author

uezo commented Sep 13, 2024

👍

@uezo uezo closed this as completed Sep 13, 2024
@uezo
Copy link
Owner Author

uezo commented Sep 16, 2024

  • Claude
  • Gemini
  • Dify

and their WebGL components.

@uezo uezo reopened this Sep 16, 2024
uezo added a commit that referenced this issue Sep 16, 2024
See #342

Support following components:

- Claude
- Gemini
- Dify

and their WebGL components.

This commit addressed issue #339 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant