Skip to content

Commit

Permalink
feat: Add currpath as a param
Browse files Browse the repository at this point in the history
  • Loading branch information
tjtanjin committed Sep 14, 2024
1 parent bf913e5 commit ab38f05
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ const FileAttachmentButton = () => {
}
await handleSubmitText("📄 " + fileNames.join(", "), settings.fileAttachment?.sendFileName);
await fileHandler({userInput: inputRef.current?.value as string, prevPath: getPrevPath(),
goToPath, setTextAreaValue, injectMessage, streamMessage, removeMessage, endStreamMessage,
openChat, showToast, dismissToast, files
currPath: getCurrPath(), goToPath, setTextAreaValue, injectMessage, streamMessage,
removeMessage, endStreamMessage, openChat, showToast, dismissToast, files
});
}
};
Expand Down
6 changes: 4 additions & 2 deletions src/hooks/internal/useBotEffectInternal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,10 @@ export const useBotEffectInternal = () => {
return;
}

const params = {prevPath: getPrevPath(), goToPath, setTextAreaValue, userInput: paramsInputRef.current,
endStreamMessage, injectMessage, removeMessage, streamMessage, openChat, showToast, dismissToast};
const params = {prevPath: getPrevPath(), currPath: getCurrPath(), goToPath, setTextAreaValue,
userInput: paramsInputRef.current, endStreamMessage, injectMessage, removeMessage, streamMessage,
openChat, showToast, dismissToast
};

// calls the new block for preprocessing upon change to path.
const callNewBlock = async (currPath: keyof Flow, block: Block, params: Params) => {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/internal/useSubmitInputInternal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const useSubmitInputInternal = () => {
setTextAreaSensitiveMode(false);

setTimeout(async () => {
const params = {prevPath: getPrevPath(), goToPath, setTextAreaValue, userInput,
const params = {prevPath: getPrevPath(), currPath: getCurrPath(), goToPath, setTextAreaValue, userInput,
injectMessage, streamMessage, removeMessage, endStreamMessage, openChat, showToast, dismissToast
};
const hasNextPath = await postProcessBlock(flowRef.current as Flow, path, params, goToPath);
Expand Down
1 change: 1 addition & 0 deletions src/types/Params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Flow } from "./Flow";
*/
export type Params = {
userInput: string;
currPath: keyof Flow | null;
prevPath: keyof Flow | null;
goToPath: (pathToGo: keyof Flow) => void;
setTextAreaValue: (value: string) => void;
Expand Down

0 comments on commit ab38f05

Please sign in to comment.