Skip to content

Commit

Permalink
update: latest all codes for this release
Browse files Browse the repository at this point in the history
  • Loading branch information
joymollik1234 committed Apr 5, 2024
1 parent e79b567 commit f682958
Show file tree
Hide file tree
Showing 107 changed files with 7,777 additions and 2,693 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The `server` folder contains all the backend-related code for the application, f
Follow the steps below to get the project up and running.

### Prerequisites
- Node.js (Version: >=16.x)
- Node.js (Version: >=20.x)
- [MongoDB](https://www.mongodb.com/?ref=collaborativeai.software)
- NPM

Expand Down Expand Up @@ -131,6 +131,8 @@ To initialize the application data and create a superadmin user, you can use eit

This will send a POST request to `http://localhost:8011/api/init` with the provided JSON payload, creating a superadmin user with the specified details.

- **Site Setup**: Login with the superadmin credentials and set up your site by adding configs from your settings page, for ex. API keys, etc.


## Reference

Expand Down
4 changes: 3 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "OpenAIframework",
"version": "1.0.0",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.4",
Expand All @@ -11,6 +11,7 @@
"bootstrap": "^5.2.2",
"bootstrap-icons": "^1.9.1",
"dompurify": "^3.0.9",
"framer-motion": "^11.0.8",
"highlight.js": "^11.9.0",
"js-cookie": "^3.0.5",
"marked": "^9.1.6",
Expand All @@ -27,6 +28,7 @@
"react-scripts": "5.0.1",
"react-spinners": "^0.13.8",
"sass": "^1.50.0",
"socket.io-client": "^4.7.4",
"uuid": "^9.0.1",
"web-vitals": "^2.1.4"
},
Expand Down
18 changes: 15 additions & 3 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Route, Routes } from "react-router-dom";
import { Route, Routes, Navigate, useLocation } from "react-router-dom";
import {
LoginForm,
PageNotFound,
Expand All @@ -23,19 +23,30 @@ import {

import Layout from "./Pages/Layout";
import AssistantLayout from "./Pages/Layout/AssistantLayout";
import Configration from "./Pages/configration/promtcomfig";
import ConfigurationTabs from "./Pages/configration/index";
import Configration from "./Pages/configration";
import SuperAdminRoutes from "./component/RoutesData/SuperAdminRoutes";
import Templates from "./component/Prompt/Templates";
import TrackUsage from "./Pages/SuperAdmin/TrackUsage/TrackUsage";
import TrackUsageComponent from "./Pages/SuperAdmin/TrackUsage/TrackUsageComponent";

function App() {
// Hook to get the current location
const location = useLocation();

// Redirect to chat page if the user is on the root path
if (location.pathname === "/") {
return <Navigate to="/chat" />;
}

return (
<Routes>
<Route path="login" element={<LoginForm />} />
<Route path="passwordReset/:token/:id" element={<ResetPassword />} />
<Route path="*" element={<PageNotFound />} />

<Route path="/" element={<Layout />}>
<Route path="config/" element={<Configration />} />
<Route path="config/" element={<ConfigurationTabs />} />
<Route path="/profile" element={<Profile />} />
<Route path="usersassistantlist" element={<UsersAssistant />} />

Expand Down Expand Up @@ -63,6 +74,7 @@ function App() {
<Route path="/teams" element={<TeamList />} />

<Route path="/assistantsList" element={<AssistantsList />} />
<Route path="/trackUsage" element={<TrackUsageComponent/>} />
</Route>
</Route>
<Route path="/assistants" element={<AssistantLayout />}>
Expand Down
27 changes: 26 additions & 1 deletion client/src/Hooks/useAssistantPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const useAssistantPage = () => {
const [adminUserAssistants, setAdminUserAssistants] = useState([]);
const [userAssistants, setUserAssistants] = useState([]);
const [assistants, setAssistants] = useState([]);
const [functionCallingAssistants, setFunctionCallingAssistants] = useState(
[]
);
const [teamList, setTeamList] = useState([]);
const [loader, setLoader] = useState({
...initialLoaderState,
Expand All @@ -35,6 +38,7 @@ const useAssistantPage = () => {
handleFetchUserCreatedAssistants(1);
handleFetchUserAssistantStats();
handleFetchAllAssistants(1);
handleFetchFunctionCallingAssistants(1);
handleFetchTeams();
}, []);

Expand Down Expand Up @@ -71,6 +75,7 @@ const useAssistantPage = () => {
if (response) {
handleShowMessage(response.message);
handleFetchUserCreatedAssistants();
handleFetchFunctionCallingAssistants();
handleFetchAllAssistants(1);
successCb();
}
Expand All @@ -89,6 +94,7 @@ const useAssistantPage = () => {
if(response) {
handleFetchUserCreatedAssistants();
handleFetchAllAssistants(1);
handleFetchFunctionCallingAssistants();
handleShowMessage(response.message);
triggerRefetchAssistants();
}
Expand Down Expand Up @@ -140,6 +146,21 @@ const useAssistantPage = () => {
}
};

//fetching all functionCalling assistants
const handleFetchFunctionCallingAssistants = async () => {
try {
const response = await axiosSecureInstance.get(
`/api/assistants/users/createdFunctionCalling`
);

const result = response.data.assistants;

setFunctionCallingAssistants(result);
} catch (error) {
console.log(error);
}
};

const handleDeleteAssistant = async (assistantId) => {
updateLoader({ ASSISTANT_DELETING: assistantId });
try {
Expand All @@ -148,7 +169,8 @@ const useAssistantPage = () => {
if(response) {
handleFetchUserCreatedAssistants();
handleFetchUserAssistantStats();
handleFetchAllAssistants(1)
handleFetchFunctionCallingAssistants();
handleFetchAllAssistants(1);
handleShowMessage(response.message);
triggerRefetchAssistants();
}
Expand Down Expand Up @@ -222,6 +244,8 @@ const useAssistantPage = () => {
return {
setAdminUserAssistants,
adminUserAssistants,
setFunctionCallingAssistants,
functionCallingAssistants,
totalCount,
userAssistants,
assistants,
Expand All @@ -234,6 +258,7 @@ const useAssistantPage = () => {
handleFetchUserAssistantStats,
handleDeleteAssistant,
handleFetchAllAssistants,
handleFetchFunctionCallingAssistants,
handleFetchTeams,
updateLoader,
searchOrganizationalAssistants,
Expand Down
Loading

0 comments on commit f682958

Please sign in to comment.