Skip to content

Commit a41020c

Browse files
committed
Move response handling to modifyResponse
1 parent 11db5b1 commit a41020c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/AppContent.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ function AutomatedChatSession({entries, appendEntry, clearConversation}: Automat
127127
entries={entries}
128128
humanText={humanText}
129129
onPrompt={(text) => onPrompt(text, chatScriptIndex)}
130-
onResponse={({prompt, response, contentType, entryId}) => chatHistory.modifyResponse(entryId, {text: response, contentType: contentType, prompt: prompt})}
131130
clearConversation={() => {
132131
setChatScriptIndex(0);
133132
clearConversation();

src/Chat.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ type ChatProps = {
9797
entries: ChatElement[];
9898
humanText? : string;
9999
onPrompt: (prompt: string) => void;
100-
onResponse: ({prompt, response, contentType, entryId} : { prompt: string, response: string, contentType: ChatContent, entryId: number} ) => void;
101100
clearConversation: () => void;
102101
};
103-
function Chat({entries, humanText, onPrompt, onResponse, clearConversation}: ChatProps): JSX.Element {
102+
function Chat({entries, humanText, onPrompt, clearConversation}: ChatProps): JSX.Element {
104103
const styles = React.useContext(StylesContext);
105104
const chatHistory = React.useContext(ChatHistoryContext);
106105
const [showFeedbackPopup, setShowFeedbackPopup] = React.useState(false);
@@ -151,7 +150,8 @@ function Chat({entries, humanText, onPrompt, onResponse, clearConversation}: Cha
151150
id={entry.id}
152151
prompt={entry.prompt ?? ""}
153152
intent={entry.intent}
154-
onResponse={({prompt, response, contentType}) => onResponse({prompt: prompt, response: response, contentType: contentType, entryId: entry.id})}/>
153+
onResponse={({prompt, response, contentType}) =>
154+
chatHistory.modifyResponse(entry.id, {prompt: prompt, text: response, contentType: contentType})}/>
155155
}
156156
</View>
157157
))}

0 commit comments

Comments
 (0)