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

Add User Tagging in Chat + Only Human Perception Response #343

Open
wants to merge 55 commits into
base: dev
Choose a base branch
from

Conversation

AbdurrehmanSubhani
Copy link
Contributor

@AbdurrehmanSubhani AbdurrehmanSubhani commented Oct 22, 2024

Integrates:

  1. Only Human Perception response generation
  • Introduced "playerType" to playerSpec over adding "human" in capabilities to extend multiple player type support
  • Added shouldThink method in default perception for "say" to check wether the perception is from a human and only reply if true
  1. User mention support
  • Adds User tagging/mention capability on both the frontend and SDK chat, mentioning a specific agent results in only the specific agent to return a response.
  • How it works is:
-- Text input entered by user is parsed
-- Parsing included specified tag pattern matching "@" to identify mentions
-- Agent id's extracted from the playersMap map
-- In case tags are found in the user input, the specified agent id's are added to the message args (message.args.taggedUserIds)
-- "say" perception extracts "taggedUserIds" if exists, if does exist, checks if the agent's id is tagged, only thinks if the agent is tagged.
  • For frontend package used:
  • react-mentions: in the prompt-form for handling user "@" character inputs
  • react-markdown: already being used in in codebase, added a "@" custom component to render mentions in message
  • For SDK:
  • added custom markdown rule for adding "@" rendering support (different color and bold)
  • added cli-markdown for rendering the markdown received in the message via chat.

Add auto-completer for name completion with "tab" key.
@AbdurrehmanSubhani AbdurrehmanSubhani changed the title Tag agent on FE Add User Tagging in Chat + Only Human Perception Response Oct 24, 2024
@@ -21,6 +21,49 @@ import { Icon } from 'ucom';
import { createPcmF32MicrophoneSource } from 'codecs/audio-client.mjs';
import { createVideoSource } from '@upstreet/multiplayer/public/video/video-client.mjs';
import { ensureAudioContext } from '@/lib/audio/audio-context-output';
import { MentionsInput, Mention } from 'react-mentions';

const mentionsInputStyle = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, is there an easy way to do this with tailwind classes (which we are using everywhere else) instead of an inline style object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've refactored the styling to use tailwind classes although still had to use some custom css for the elements being used by the react-mentions package:
8341082

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

Successfully merging this pull request may close these issues.

2 participants