Skip to content

Commit

Permalink
fixing the new session bug
Browse files Browse the repository at this point in the history
  • Loading branch information
irvins committed Jun 17, 2024
1 parent 310fb16 commit 92c7876
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 15 deletions.
6 changes: 3 additions & 3 deletions chatbot_ui/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"files": {
"main.css": "/static/css/main.da89d019.css",
"main.js": "/static/js/main.05320a56.js",
"main.js": "/static/js/main.0a989e88.js",
"static/js/488.5c64e536.chunk.js": "/static/js/488.5c64e536.chunk.js",
"service-worker.js": "/service-worker.js",
"index.html": "/index.html",
"main.da89d019.css.map": "/static/css/main.da89d019.css.map",
"main.05320a56.js.map": "/static/js/main.05320a56.js.map",
"main.0a989e88.js.map": "/static/js/main.0a989e88.js.map",
"488.5c64e536.chunk.js.map": "/static/js/488.5c64e536.chunk.js.map"
},
"entrypoints": [
"static/css/main.da89d019.css",
"static/js/main.05320a56.js"
"static/js/main.0a989e88.js"
]
}
2 changes: 1 addition & 1 deletion chatbot_ui/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><script src="https://cdn.jsdelivr.net/npm/react-bootstrap@next/dist/react-bootstrap.min.js" crossorigin></script><title>REDCap Chat GPT Powered Support Chatbot</title><script defer="defer" src="/static/js/main.05320a56.js"></script><link href="/static/css/main.da89d019.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><script src="https://cdn.jsdelivr.net/npm/react-bootstrap@next/dist/react-bootstrap.min.js" crossorigin></script><title>REDCap Chat GPT Powered Support Chatbot</title><script defer="defer" src="/static/js/main.0a989e88.js"></script><link href="/static/css/main.da89d019.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"></body></html>
2 changes: 1 addition & 1 deletion chatbot_ui/build/service-worker.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion chatbot_ui/build/static/js/main.05320a56.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions chatbot_ui/build/static/js/main.0a989e88.js.map

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions chatbot_ui/src/contexts/Chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ export const ChatContextProvider = ({ children }) => {
setMsgCount(0);
setMessages([]);
setSessionId(newSessionId);
// Clear chatContext and apiContext without saving

// Filter apiContext to keep only "system" roles
const filteredApiContext = apiContextRef.current.filter(entry => entry.role === "system");
chatContextRef.current = [];
apiContextRef.current = [];
apiContextRef.current = filteredApiContext;

setChatContext([]);
setApiContext([]);
setApiContext(filteredApiContext);
};

const replaceSession = async (session) => {
Expand Down
9 changes: 6 additions & 3 deletions mica-chatbot/src/contexts/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ export const ChatContextProvider = ({ children }) => {
setMsgCount(0);
setMessages([]);
setSessionId(newSessionId);
// Clear chatContext and apiContext without saving

// Filter apiContext to keep only "system" roles
const filteredApiContext = apiContextRef.current.filter(entry => entry.role === "system");
chatContextRef.current = [];
apiContextRef.current = [];
apiContextRef.current = filteredApiContext;

setChatContext([]);
setApiContext([]);
setApiContext(filteredApiContext);
};

const replaceSession = async (session) => {
Expand Down

0 comments on commit 92c7876

Please sign in to comment.