Skip to content

Commit

Permalink
chore: remove giver/instruct flows
Browse files Browse the repository at this point in the history
  • Loading branch information
nzambello committed Jan 3, 2025
1 parent 29714ac commit 8dbef44
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 1,606 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const App = () => (
| `showTranslationOriginal` | | `bool` | `false` | Show button to see original text when translated |
| `showSettings` | | `bool` | `true` | Show the settings panel button |
| `showTypingText` | | `bool` | `false` | Show default sentences while loading text (see: Typing stories) |
| `showInstruct` | | `bool` | `false` | Show the switch selecting between test mode or instruct mode, needs an administrative session as a giver |
| `showLogin` | | `bool` | `true` | Show the login button |
| `showClear` | | `bool` | `false` | Show clear chat history button |
| `showOnlyLastMessages` | | `bool` | `true` or `false` \* | Show only last 2 messages. (\*) Defaults to `true` for `TOTEM` and `WEBSITE_ASSISTANT` layouts, `false` otherwise |
Expand Down Expand Up @@ -154,7 +153,6 @@ const MyCustomLayout: React.FC<LayoutProps> = ({
changeModeProps,
sessionId,
hasUserActivatedSpeak,
showInstruct = false,
loading = false,
poweredBy,
}) => (
Expand Down
7 changes: 3 additions & 4 deletions src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import Edit from '../icons/Edit';
import cx from 'classnames';
import ContainerAvatarView from './AvatarView';
import { useViseme } from '../../context/visemeContext';
import PositionControls from './AvatarView/AvatarComponent/positionControls/positionControls';
import { getLocalConfig } from '../../helpers/configuration';

export interface Props {
memori: Memori;
Expand Down Expand Up @@ -97,7 +95,8 @@ const Avatar: React.FC<Props> = ({
integrationConfig?.avatar === 'customglb' ||
integrationConfig?.avatar === 'customrpm') &&
integrationConfig?.avatarURL &&
(avatarType && avatarType !== 'blob')
avatarType &&
avatarType !== 'blob'
) {
return (
<>
Expand Down Expand Up @@ -128,7 +127,7 @@ const Avatar: React.FC<Props> = ({
if (
integrationConfig?.avatar === 'readyplayerme' ||
integrationConfig?.avatar === 'readyplayerme-full' ||
integrationConfig?.avatar === 'customrpm'
integrationConfig?.avatar === 'customrpm'
) {
return (
<ErrorBoundary
Expand Down
81 changes: 0 additions & 81 deletions src/components/Chat/Chat.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ it('renders Chat unchanged', () => {
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
Expand Down Expand Up @@ -74,7 +73,6 @@ it('renders Chat with memori typing unchanged', () => {
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
Expand Down Expand Up @@ -107,7 +105,6 @@ it('renders Chat with hints unchanged', () => {
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
Expand Down Expand Up @@ -139,7 +136,6 @@ it('renders Chat with media unchanged', () => {
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
Expand Down Expand Up @@ -171,7 +167,6 @@ it('renders Chat with dates unchanged', () => {
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
Expand Down Expand Up @@ -204,79 +199,6 @@ it('renders Chat with context vars unchanged', () => {
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
onChangeUserMessage={jest.fn()}
sendMessage={jest.fn()}
stopListening={jest.fn()}
resetTranscript={jest.fn()}
isPlayingAudio={false}
stopAudio={jest.fn()}
showMicrophone={false}
listening={false}
startListening={jest.fn()}
setEnableFocusChatInput={jest.fn()}
showContextPerLine
/>
);
expect(container).toMatchSnapshot();
});

it('renders Chat on X3 state unchanged', () => {
const { container } = render(
<Chat
memori={memori}
tenant={tenant}
dialogState={{
...dialogState,
state: 'X3',
}}
setDialogState={jest.fn()}
client={client}
history={history}
layout="DEFAULT"
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
onChangeUserMessage={jest.fn()}
sendMessage={jest.fn()}
stopListening={jest.fn()}
resetTranscript={jest.fn()}
isPlayingAudio={false}
stopAudio={jest.fn()}
showMicrophone={false}
listening={false}
startListening={jest.fn()}
setEnableFocusChatInput={jest.fn()}
showContextPerLine
/>
);
expect(container).toMatchSnapshot();
});

it('renders Chat on X2a state unchanged', () => {
const { container } = render(
<Chat
memori={memori}
tenant={tenant}
dialogState={{
...dialogState,
state: 'X2a',
}}
setDialogState={jest.fn()}
client={client}
history={history}
layout="DEFAULT"
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
Expand Down Expand Up @@ -310,7 +232,6 @@ it('renders Chat with user unchanged', () => {
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
Expand Down Expand Up @@ -343,7 +264,6 @@ it('renders Chat with custom user avatar unchanged', () => {
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
Expand Down Expand Up @@ -376,7 +296,6 @@ it('renders Chat with custom user avatar as react element unchanged', () => {
pushMessage={jest.fn()}
sessionID={sessionID}
simulateUserPrompt={jest.fn()}
selectReceiverTag={jest.fn()}
setAttachmentsMenuOpen={jest.fn()}
setSendOnEnter={jest.fn()}
userMessage=""
Expand Down
25 changes: 0 additions & 25 deletions src/components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export interface Props {
showTranslationOriginal?: boolean;
showWhyThisAnswer?: boolean;
client: ReturnType<typeof memoriApiClient>;
selectReceiverTag: (tag: string) => Promise<void>;
preview?: boolean;
microphoneMode?: 'CONTINUOUS' | 'HOLD_TO_TALK';
sendOnEnter?: 'keypress' | 'click';
Expand Down Expand Up @@ -102,7 +101,6 @@ const Chat: React.FC<Props> = ({
showWhyThisAnswer = true,
showCopyButton = true,
showTranslationOriginal = false,
selectReceiverTag,
preview = false,
instruct = false,
showInputs = true,
Expand Down Expand Up @@ -341,29 +339,6 @@ const Chat: React.FC<Props> = ({
</div>
</div>

{/*
* TODO: X2a emoji picker
*/}

{dialogState?.state === 'X3' && sessionID && (
<div className="memori-chat--known-tags">
{Object.keys(dialogState.knownTags ?? {})
.filter(t => t !== memori.giverTag)
.map(tag => (
<Button
key={tag}
icon={
<span className="memori-chat--known-tag-icon">{tag}</span>
}
className="memori-chat--known-tag"
onClick={() => selectReceiverTag(tag)}
>
{dialogState.knownTags?.[tag]}
</Button>
))}
</div>
)}

{showInputs && (
<ChatInputs
resetTranscript={resetTranscript}
Expand Down
Loading

0 comments on commit 8dbef44

Please sign in to comment.