Skip to content

Commit

Permalink
Merge branch 'develop' into logging
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikvirendrar authored Mar 15, 2024
2 parents 05aed77 + 9bd7e02 commit 128d9ac
Show file tree
Hide file tree
Showing 35 changed files with 4,125 additions and 1,293 deletions.
1,778 changes: 1,152 additions & 626 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@emotion/styled": "^11.11.0",
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@mui/icons-material": "^5.15.5",
"@mui/icons-material": "^5.15.11",
"@mui/material": "^5.14.18",
"@mui/styles": "^5.14.18",
"@mui/x-date-pickers-pro": "^6.18.4",
Expand Down Expand Up @@ -44,6 +44,7 @@
"react-hook": "^0.0.1",
"react-json-tree": "^0.18.0",
"react-markdown": "^9.0.1",
"react-material-ui-carousel": "^3.4.2",
"react-quill": "^2.0.0",
"react-quilljs": "^1.3.3",
"react-redux": "^9.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ const initialState = {
export const fetchGuestWorkspaceData = createAsyncThunk(
'getGuestWorkspace/fetchGuestWorkspaceData',
async (pageNumber, { dispatch }) => {
//list_guest_workspaces
const params = fetchParams(`${ENDPOINTS.getWorkspaces}`);
const params = fetchParams(`${ENDPOINTS.getWorkspaces}list_unauthenticated_guest_workspaces/`);
return fetch(params.url, params.options)
.then(response => response.json())
}
);

const getGuestWorkspace = createSlice({
name: 'getGuestWorkspace',
const getGuestWorkspaces = createSlice({
name: 'getGuestWorkspaces',
initialState,
reducers: {},
extraReducers: (builder) => {
Expand All @@ -37,7 +36,4 @@ const getGuestWorkspace = createSlice({
},
});

export default getGuestWorkspace.reducer;



export default getGuestWorkspaces.reducer;
5 changes: 2 additions & 3 deletions src/Lib/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import DatasetSearchPopup from './Features/datasets/DatasetSearchPopup';
import searchProjectCard from './Features/searchProjectCard';
import getTaskAnalyticsData from './Features/Analytics/getTaskAnalyticsData';
import getMetaAnalyticsData from './Features/Analytics/getMetaAnalyticsData';
import GetGuestWokspaces from './Features/GetGuestWorkspaces';
import getGuestWorkspaces from './Features/getGuestWorkspaces';
import getAnnotationsTask from './Features/projects/getAnnotationsTask';
import getTaskDetails from './Features/getTaskDetails';
import GlossarysentenceAPI from './Features/actions/GlossarysentenceAPI';
Expand Down Expand Up @@ -129,8 +129,7 @@ const makeStore = () => {
getProjectDetails:getProjectDetails,
getTaskAnalyticsData: getTaskAnalyticsData,
getMetaAnalyticsData: getMetaAnalyticsData,
GetGuestWokspaces: GetGuestWokspaces,

getGuestWorkspaces: getGuestWorkspaces,
},
});
};
Expand Down
42 changes: 42 additions & 0 deletions src/app/actions/api/UnauthUserManagement/PostChatInteractionAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//glossary SuggestAnEdit
import API from "../../api";
import ENDPOINTS from "../../../../config/apiendpoint"
import constants from "../../constants";

export default class PostChatInteractionAPI extends API {
constructor(ChatInteractionObj,timeout = 2000) {
super("POST", timeout, false);
this.ChatInteractionObj = ChatInteractionObj;
this.type = constants.POST_CHAT_INTERACTION;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.functions}chat_output`;
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.chatInteraction = res;
}
}

apiEndPoint() {
return this.endpoint;
}

getBody() {
return this.ChatInteractionObj;
}

getHeaders() {
this.headers = {
headers: {
"Content-Type": "application/json",
},
};
return this.headers;
}

getPayload() {
return this.chatInteraction;
}
}

42 changes: 42 additions & 0 deletions src/app/actions/api/UnauthUserManagement/PostChatLogAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//glossary SuggestAnEdit
import API from "../../api";
import ENDPOINTS from "../../../../config/apiendpoint"
import constants from "../../constants";

export default class PostChatLogAPI extends API {
constructor(ChatLogObj,timeout = 2000) {
super("POST", timeout, false);
this.ChatLogObj = ChatLogObj;
this.type = constants.POST_CHAT_LOG;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.functions}chat_log`;
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.chatLog = res;
}
}

apiEndPoint() {
return this.endpoint;
}

getBody() {
return this.ChatLogObj;
}

getHeaders() {
this.headers = {
headers: {
"Content-Type": "application/json",
},
};
return this.headers;
}

getPayload() {
return this.chatLog;
}
}

42 changes: 42 additions & 0 deletions src/app/actions/api/workspace/AuthenticateToWorkspaceAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import API from "../../api";
import ENDPOINTS from "../../../../config/apiendpoint"
import constants from "../../constants";
/* eslint-disable react-hooks/exhaustive-deps */

export default class AuthenticateToWorkspaceAPI extends API {
constructor(currentWorkspaceId, authenticateObj, timeout = 2000) {
super("PUT", timeout, false);
this.authenticateObj = authenticateObj;
this.type = constants.AUTHENTICATE_WORKSPACE;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getWorkspaces}${currentWorkspaceId}/guest_auth/`;
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.authenticateWorkspace = res;
}
}

apiEndPoint() {
return this.endpoint;
}

getBody() {
return this.authenticateObj;
}

getHeaders() {
this.headers = {
headers: {
"Content-Type": "application/json",
"Authorization":`JWT ${localStorage.getItem('anudesh_access_token')}`
},
};
return this.headers;
}

getPayload() {
return this.authenticateWorkspace
}
}
3 changes: 3 additions & 0 deletions src/app/actions/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ const constants = {
PATCH_ANNOTATION:"PATCH_ANNOTATION",
UPDATE_UI_PREFS: "UPDATE_UI_PREFS",
PATCH_ANNOTATIONS: "PATCH_ANNOTATIONS",
AUTHENTICATE_WORKSPACE: "AUTHENTICATE_WORKSPACE",
POST_CHAT_INTERACTION: "POST_CHAT_INTERACTION",
POST_CHAT_LOG: "POST_CHAT_LOG",
};

export default constants;
1 change: 1 addition & 0 deletions src/app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import ReviewPage from "./ui/pages/chat/ReviewPage";
import AnnotatePage from "./ui/pages/chat/AnnotatePage";
import SuperCheckerPage from "./ui/pages/chat/SuperCheckerPage";
import CreateProject from "./new-project/newproject";

export default function Root() {
if (typeof window !== 'undefined') {
const ProtectedRoute = ({ user, children }) => {
Expand Down
18 changes: 17 additions & 1 deletion src/app/ui/pages/chat/AnnotatePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import LightTooltip from "@/components/common/Tooltip";
import { ArrowDropDown } from "@material-ui/icons";
import Glossary from "./Glossary";
import getTaskAssignedUsers from "@/utils/getTaskAssignedUsers";
import ModelInteractionEvaluation from "../model_response_evaluation/model_response_evaluation";


const AnnotatePage = () => {
Expand Down Expand Up @@ -68,6 +69,7 @@ const AnnotatePage = () => {
message: "",
variant: "success",
});
console.log(ProjectDetails,"lll");
const [disableSkipButton, setdisableSkipButton] = useState(false);
const [filterMessage, setFilterMessage] = useState(null);
const [autoSave, setAutoSave] = useState(true);
Expand Down Expand Up @@ -464,6 +466,20 @@ const AnnotatePage = () => {
setLoading(false);
}
}, [AnnotationsTaskDetails]);

let componentToRender;
switch (ProjectDetails.project_type) {
case 'InstructionDrivenChat':
componentToRender = <InstructionDrivenChatPage />;
break;
case 'ModelInteractionEvaluation':
componentToRender = <ModelInteractionEvaluation />;
break;
default:
componentToRender = null;
break;
}

return (
<>
<Grid container spacing={2}>
Expand Down Expand Up @@ -704,7 +720,7 @@ const AnnotatePage = () => {
</Alert>
)}
</Grid>
<Grid item container> <InstructionDrivenChatPage /></Grid>
<Grid item container> {componentToRender} </Grid>


</Grid>
Expand Down
Loading

0 comments on commit 128d9ac

Please sign in to comment.