2023-07-27 10:11:57 -04:00
|
|
|
import { NewChat, NavLinks } from './';
|
|
|
|
|
import { Panel, Spinner } from '~/components';
|
|
|
|
|
import { Conversations, Pages } from '../Conversations';
|
2023-07-04 05:26:00 +09:00
|
|
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
2023-07-27 14:49:47 -04:00
|
|
|
import { useGetConversationsQuery, useSearchQuery } from 'librechat-data-provider';
|
2023-07-04 05:26:00 +09:00
|
|
|
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
feat: ChatGPT Plugins/OpenAPI specs for Plugins Endpoint (#620)
* wip: proof of concept for openapi chain
* chore(api): update langchain dependency to version 0.0.105
* feat(Plugins): use ChatGPT Plugins/OpenAPI specs (first pass)
* chore(manifest.json): update pluginKey for "Browser" tool to "web-browser"
chore(handleTools.js): update customConstructor key for "web-browser" tool
* fix(handleSubmit.js): set unfinished property to false for all endpoints
* fix(handlers.js): remove unnecessary capitalizeWords function and use action.tool directly
refactor(endpoints.js): rename availableTools to tools and transform it into a map
* feat(endpoints): add plugins selector to endpoints file
refactor(CodeBlock.tsx): refactor to typescript
refactor(Plugin.tsx): use recoil Map for plugin name and refactor to typescript
chore(Message.jsx): linting
chore(PluginsOptions/index.jsx): remove comment/linting
chore(svg): export Clipboard and CheckMark components from SVG index and refactor to typescript
* fix(OpenAPIPlugin.js): rename readYamlFile function to readSpecFile
fix(OpenAPIPlugin.js): handle JSON files in readSpecFile function
fix(OpenAPIPlugin.js): handle JSON URLs in getSpec function
fix(OpenAPIPlugin.js): handle JSON variables in createOpenAPIPlugin function
fix(OpenAPIPlugin.js): add description for variables in createOpenAPIPlugin function
fix(OpenAPIPlugin.js): add optional flag for is_user_authenticated and has_user_authentication in ManifestDefinition
fix(loadSpecs.js): add optional flag for is_user_authenticated and has_user_authentication in ManifestDefinition
fix(Plugin.tsx): remove unnecessary callback parameter in getPluginName function
fix(getDefaultConversation.js): fix browser console error: handle null value for lastConversationSetup in getDefaultConversation function
* feat(api): add new tools
Add Ai PDF tool for super-fast, interactive chats with PDFs of any size, complete with page references for fact checking.
Add VoxScript tool for searching through YouTube transcripts, financial data sources, Google Search results, and more.
Add WebPilot tool for browsing and QA of webpages, PDFs, and data. Generate articles from one or more URLs.
feat(api): update OpenAPIPlugin.js
- Add support for bearer token authorization in the OpenAPIPlugin.
- Add support for custom headers in the OpenAPIPlugin.
fix(api): fix loadTools.js
- Pass the user parameter to the loadSpecs function.
* feat(PluginsClient.js): import findMessageContent function from utils
feat(PluginsClient.js): add message parameter to options object in initializeCustomAgent function
feat(PluginsClient.js): add content to errorMessage if message content is found
feat(PluginsClient.js): break out of loop if message content is found
feat(PluginsClient.js): add delay option with value of 8 to generateTextStream function
feat(PluginsClient.js): add support for process.env.PORT environment variable in app.listen function
feat(askyourpdf.json): add askyourpdf plugin configuration
feat(metar.json): add metar plugin configuration
feat(askyourpdf.yaml): add askyourpdf plugin OpenAPI specification
feat(OpenAPIPlugin.js): add message parameter to createOpenAPIPlugin function
feat(OpenAPIPlugin.js): add description_for_model to chain run message
feat(addOpenAPISpecs.js): remove verbose option from loadSpecs function call
fix(loadSpecs.js): add 'message' parameter to the loadSpecs function
feat(findMessageContent.js): add utility function to find message content in JSON objects
* fix(PluginStoreDialog.tsx): update z-index value for the dialog container
The z-index value for the dialog container was updated to "102" to ensure it appears above other elements on the page.
* chore(web_pilot.json): add "params" field with "user_has_request" parameter set to true
* chore(eslintrc.js): update eslint rules
fix(Login.tsx): add missing semicolon after import statement
* fix(package-lock.json): update langchain dependency to version ^0.0.105
* fix(OpenAPIPlugin.js): change header key from 'id' to 'librechat_user_id' for consistency and clarity
feat(plugins): add documentation for using official ChatGPT Plugins with OpenAPI specs
This commit adds a new file `chatgpt_plugins_openapi.md` to the `docs/features/plugins` directory. The file provides detailed information on how to use official ChatGPT Plugins with OpenAPI specifications. It explains the components of a plugin, including the Plugin Manifest file and the OpenAPI spec. It also covers the process of adding a plugin, editing manifest files, and customizing OpenAPI spec files. Additionally, the commit includes disclaimers about the limitations and compatibility of plugins with LibreChat. The documentation also clarifies that the use of ChatGPT Plugins with LibreChat does not violate OpenAI's Terms of Service.
The purpose of this commit is to provide comprehensive documentation for developers who want to integrate ChatGPT Plugins into their projects using OpenAPI specs. It aims to guide them through the process of adding and configuring plugins, as well as addressing potential issues and
chore(introduction.md): update link to ChatGPT Plugins documentation
docs(introduction.md): clarify the purpose of the plugins endpoint and its capabilities
* fix(OpenAPIPlugin.js): update SUFFIX variable to provide a clearer description
docs(chatgpt_plugins_openapi.md): update information about adding plugins via url on the frontend
* feat(PluginsClient.js): sendIntermediateMessage on successful Agent load
fix(PluginsClient.js, server/index.js, gptPlugins.js): linting fixes
docs(chatgpt_plugins_openapi.md): update links and add additional information
* Update chatgpt_plugins_openapi.md
* chore: rebuild package-lock file
* chore: format/lint all files with new rules
* chore: format all files
* chore(README.md): update AI model selection list
The AI model selection list in the README.md file has been updated to reflect the current options available. The "Anthropic" model has been added as an alternative name for the "Claude" model.
* fix(Plugin.tsx): type issue
* feat(tools): add new tool WebPilot
feat(tools): remove tool Weather Report
feat(tools): add new tool Prompt Perfect
feat(tools): add new tool Scholarly Graph Link
* feat(OpenAPIPlugin.js): add getSpec and readSpecFile functions
feat(OpenAPIPlugin.spec.js): add tests for readSpecFile, getSpec, and createOpenAPIPlugin functions
* chore(agent-demo-1.js): remove unused code and dependencies
chore(agent-demo-2.js): remove unused code and dependencies
chore(demo.js): remove unused code and dependencies
* feat(addOpenAPISpecs): add function to transform OpenAPI specs into desired format
feat(addOpenAPISpecs.spec): add tests for transformSpec function
fix(loadSpecs): remove debugging code
* feat(loadSpecs.spec.js): add unit tests for ManifestDefinition, validateJson, and loadSpecs functions
* fix: package file resolution bug
* chore: move scholarly_graph_link manifest to 'has-issues'
* refactor(client/hooks): convert to TS and export from index
* Update introduction.md
* Update chatgpt_plugins_openapi.md
2023-07-16 12:19:47 -04:00
|
|
|
import { useAuthContext, useDebounce } from '~/hooks';
|
2023-07-24 08:33:08 -04:00
|
|
|
import { localize } from '~/localization/Translation';
|
2023-07-27 10:11:57 -04:00
|
|
|
import { cn } from '~/utils/';
|
|
|
|
|
import store from '~/store';
|
2023-05-19 20:21:34 +05:30
|
|
|
|
2023-03-12 00:32:03 +08:00
|
|
|
export default function Nav({ navVisible, setNavVisible }) {
|
2023-02-14 16:15:45 -05:00
|
|
|
const [isHovering, setIsHovering] = useState(false);
|
feat: Auth and User System (#205)
* server-side JWT auth implementation
* move oauth routes and strategies, fix bugs
* backend modifications for wiring up the frontend login and reg forms
* Add frontend data services for login and registration
* Add login and registration forms
* Implment auth context, functional client side auth
* protect routes with jwt auth
* finish local strategy (using local storage)
* Start setting up google auth
* disable token refresh, remove old auth middleware
* refactor client, add ApiErrorBoundary context
* disable google and facebook strategies
* fix: fix presets not displaying specific to user
* fix: fix issue with browser refresh
* fix: casing issue with User.js (#11)
* delete user.js to be renamed
* fix: fix casing issue with User.js
* comment out api error watcher temporarily
* fix: issue with api error watcher (#12)
* delete user.js to be renamed
* fix: fix casing issue with User.js
* comment out api error watcher temporarily
* feat: add google auth social login
* fix: make google login url dynamic based on dev/prod
* fix: bug where UI is briefly displayed before redirecting to login
* fix: fix cookie expires value for local auth
* Update README.md
* Update LOCAL_INSTALL structure
* Add local testing instructions
* Only load google strategy if client id and secret are provided
* Update .env.example files with new params
* fix issue with not redirecting to register form
* only show google login button if value is set in .env
* cleanup log messages
* Add label to button for google login on login form
* doc: fix client/server url values in .env.example
* feat: add error message details to registration failure
* Restore preventing paste on confirm password
* auto-login user after registering
* feat: forgot password (#24)
* make login/reg pages look like openai's
* add password reset data services
* new form designs similar to openai, add password reset pages
* add api's for password reset
* email utils for password reset
* remove bcrypt salt rounds from process.env
* refactor: restructure api auth code, consolidate routes (#25)
* add api's for password reset
* remove bcrypt salt rounds from process.env
* refactor: consolidate auth routes, use controller pattern
* refactor: code cleanup
* feat: migrate data to first user (#26)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes after refactor (#27)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: issue with auto-login when logging out then logging in with new browser window (#28)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: fix issue with auto-login in new tab
* doc: Update README and .env.example files with user system information (#29)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: fix issue with auto-login in new tab
* doc: update README and .env.example files
* Fixup: LOCAL_INSTALL.md PS instructions (#200) (#30)
Co-authored-by: alfredo-f <alfredo.fomitchenko@mail.polimi.it>
* feat: send user with completion to protect against abuse (#31)
* Fixup: LOCAL_INSTALL.md PS instructions (#200)
* server-side JWT auth implementation
* move oauth routes and strategies, fix bugs
* backend modifications for wiring up the frontend login and reg forms
* Add frontend data services for login and registration
* Add login and registration forms
* Implment auth context, functional client side auth
* protect routes with jwt auth
* finish local strategy (using local storage)
* Start setting up google auth
* disable token refresh, remove old auth middleware
* refactor client, add ApiErrorBoundary context
* disable google and facebook strategies
* fix: fix presets not displaying specific to user
* fix: fix issue with browser refresh
* fix: casing issue with User.js (#11)
* delete user.js to be renamed
* fix: fix casing issue with User.js
* comment out api error watcher temporarily
* feat: add google auth social login
* fix: make google login url dynamic based on dev/prod
* fix: bug where UI is briefly displayed before redirecting to login
* fix: fix cookie expires value for local auth
* Only load google strategy if client id and secret are provided
* Update .env.example files with new params
* fix issue with not redirecting to register form
* only show google login button if value is set in .env
* cleanup log messages
* Add label to button for google login on login form
* doc: fix client/server url values in .env.example
* feat: add error message details to registration failure
* Restore preventing paste on confirm password
* auto-login user after registering
* feat: forgot password (#24)
* make login/reg pages look like openai's
* add password reset data services
* new form designs similar to openai, add password reset pages
* add api's for password reset
* email utils for password reset
* remove bcrypt salt rounds from process.env
* refactor: restructure api auth code, consolidate routes (#25)
* add api's for password reset
* remove bcrypt salt rounds from process.env
* refactor: consolidate auth routes, use controller pattern
* refactor: code cleanup
* feat: migrate data to first user (#26)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes after refactor (#27)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: issue with auto-login when logging out then logging in with new browser window (#28)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: fix issue with auto-login in new tab
* doc: Update README and .env.example files with user system information (#29)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: fix issue with auto-login in new tab
* doc: update README and .env.example files
* Send user id to openai to protect against abuse
* add meilisearch to gitignore
* Remove webpack
---------
Co-authored-by: alfredo-f <alfredo.fomitchenko@mail.polimi.it>
---------
Co-authored-by: Danny Avila <110412045+danny-avila@users.noreply.github.com>
Co-authored-by: Alfredo Fomitchenko <alfredo.fomitchenko@mail.polimi.it>
2023-05-07 10:04:51 -07:00
|
|
|
const { isAuthenticated } = useAuthContext();
|
2023-03-28 20:36:21 +08:00
|
|
|
const containerRef = useRef(null);
|
|
|
|
|
const scrollPositionRef = useRef(null);
|
2023-07-24 08:33:08 -04:00
|
|
|
const lang = useRecoilValue(store.lang);
|
2023-03-28 20:36:21 +08:00
|
|
|
|
|
|
|
|
const [conversations, setConversations] = useState([]);
|
|
|
|
|
// current page
|
|
|
|
|
const [pageNumber, setPageNumber] = useState(1);
|
|
|
|
|
// total pages
|
2023-03-18 14:28:10 -04:00
|
|
|
const [pages, setPages] = useState(1);
|
2023-05-18 11:09:31 -07:00
|
|
|
|
|
|
|
|
// data provider
|
feat: Auth and User System (#205)
* server-side JWT auth implementation
* move oauth routes and strategies, fix bugs
* backend modifications for wiring up the frontend login and reg forms
* Add frontend data services for login and registration
* Add login and registration forms
* Implment auth context, functional client side auth
* protect routes with jwt auth
* finish local strategy (using local storage)
* Start setting up google auth
* disable token refresh, remove old auth middleware
* refactor client, add ApiErrorBoundary context
* disable google and facebook strategies
* fix: fix presets not displaying specific to user
* fix: fix issue with browser refresh
* fix: casing issue with User.js (#11)
* delete user.js to be renamed
* fix: fix casing issue with User.js
* comment out api error watcher temporarily
* fix: issue with api error watcher (#12)
* delete user.js to be renamed
* fix: fix casing issue with User.js
* comment out api error watcher temporarily
* feat: add google auth social login
* fix: make google login url dynamic based on dev/prod
* fix: bug where UI is briefly displayed before redirecting to login
* fix: fix cookie expires value for local auth
* Update README.md
* Update LOCAL_INSTALL structure
* Add local testing instructions
* Only load google strategy if client id and secret are provided
* Update .env.example files with new params
* fix issue with not redirecting to register form
* only show google login button if value is set in .env
* cleanup log messages
* Add label to button for google login on login form
* doc: fix client/server url values in .env.example
* feat: add error message details to registration failure
* Restore preventing paste on confirm password
* auto-login user after registering
* feat: forgot password (#24)
* make login/reg pages look like openai's
* add password reset data services
* new form designs similar to openai, add password reset pages
* add api's for password reset
* email utils for password reset
* remove bcrypt salt rounds from process.env
* refactor: restructure api auth code, consolidate routes (#25)
* add api's for password reset
* remove bcrypt salt rounds from process.env
* refactor: consolidate auth routes, use controller pattern
* refactor: code cleanup
* feat: migrate data to first user (#26)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes after refactor (#27)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: issue with auto-login when logging out then logging in with new browser window (#28)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: fix issue with auto-login in new tab
* doc: Update README and .env.example files with user system information (#29)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: fix issue with auto-login in new tab
* doc: update README and .env.example files
* Fixup: LOCAL_INSTALL.md PS instructions (#200) (#30)
Co-authored-by: alfredo-f <alfredo.fomitchenko@mail.polimi.it>
* feat: send user with completion to protect against abuse (#31)
* Fixup: LOCAL_INSTALL.md PS instructions (#200)
* server-side JWT auth implementation
* move oauth routes and strategies, fix bugs
* backend modifications for wiring up the frontend login and reg forms
* Add frontend data services for login and registration
* Add login and registration forms
* Implment auth context, functional client side auth
* protect routes with jwt auth
* finish local strategy (using local storage)
* Start setting up google auth
* disable token refresh, remove old auth middleware
* refactor client, add ApiErrorBoundary context
* disable google and facebook strategies
* fix: fix presets not displaying specific to user
* fix: fix issue with browser refresh
* fix: casing issue with User.js (#11)
* delete user.js to be renamed
* fix: fix casing issue with User.js
* comment out api error watcher temporarily
* feat: add google auth social login
* fix: make google login url dynamic based on dev/prod
* fix: bug where UI is briefly displayed before redirecting to login
* fix: fix cookie expires value for local auth
* Only load google strategy if client id and secret are provided
* Update .env.example files with new params
* fix issue with not redirecting to register form
* only show google login button if value is set in .env
* cleanup log messages
* Add label to button for google login on login form
* doc: fix client/server url values in .env.example
* feat: add error message details to registration failure
* Restore preventing paste on confirm password
* auto-login user after registering
* feat: forgot password (#24)
* make login/reg pages look like openai's
* add password reset data services
* new form designs similar to openai, add password reset pages
* add api's for password reset
* email utils for password reset
* remove bcrypt salt rounds from process.env
* refactor: restructure api auth code, consolidate routes (#25)
* add api's for password reset
* remove bcrypt salt rounds from process.env
* refactor: consolidate auth routes, use controller pattern
* refactor: code cleanup
* feat: migrate data to first user (#26)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes after refactor (#27)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: issue with auto-login when logging out then logging in with new browser window (#28)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: fix issue with auto-login in new tab
* doc: Update README and .env.example files with user system information (#29)
* refactor: use /api for auth routes
* fix: use user id instead of username
* feat: migrate data to first user on register
* fix: fix social login routes
* fix: fix issue with auto-login in new tab
* doc: update README and .env.example files
* Send user id to openai to protect against abuse
* add meilisearch to gitignore
* Remove webpack
---------
Co-authored-by: alfredo-f <alfredo.fomitchenko@mail.polimi.it>
---------
Co-authored-by: Danny Avila <110412045+danny-avila@users.noreply.github.com>
Co-authored-by: Alfredo Fomitchenko <alfredo.fomitchenko@mail.polimi.it>
2023-05-07 10:04:51 -07:00
|
|
|
const getConversationsQuery = useGetConversationsQuery(pageNumber, { enabled: isAuthenticated });
|
2023-03-28 20:36:21 +08:00
|
|
|
|
|
|
|
|
// search
|
|
|
|
|
const searchQuery = useRecoilValue(store.searchQuery);
|
|
|
|
|
const isSearchEnabled = useRecoilValue(store.isSearchEnabled);
|
|
|
|
|
const isSearching = useRecoilValue(store.isSearching);
|
2023-03-29 00:08:02 +08:00
|
|
|
const { newConversation, searchPlaceholderConversation } = store.useConversation();
|
2023-03-28 20:36:21 +08:00
|
|
|
|
|
|
|
|
// current conversation
|
|
|
|
|
const conversation = useRecoilValue(store.conversation);
|
|
|
|
|
const { conversationId } = conversation || {};
|
2023-03-29 00:08:02 +08:00
|
|
|
const setSearchResultMessages = useSetRecoilState(store.searchResultMessages);
|
2023-04-03 14:57:30 -07:00
|
|
|
const refreshConversationsHint = useRecoilValue(store.refreshConversationsHint);
|
2023-03-28 20:36:21 +08:00
|
|
|
const { refreshConversations } = store.useConversations();
|
|
|
|
|
|
|
|
|
|
const [isFetching, setIsFetching] = useState(false);
|
|
|
|
|
|
2023-04-07 10:16:53 -07:00
|
|
|
const debouncedSearchTerm = useDebounce(searchQuery, 750);
|
2023-05-18 11:09:31 -07:00
|
|
|
const searchQueryFn = useSearchQuery(debouncedSearchTerm, pageNumber, {
|
|
|
|
|
enabled:
|
2023-07-14 09:36:49 -04:00
|
|
|
!!debouncedSearchTerm && debouncedSearchTerm.length > 0 && isSearchEnabled && isSearching,
|
2023-04-07 10:16:53 -07:00
|
|
|
});
|
|
|
|
|
|
2023-03-18 14:28:10 -04:00
|
|
|
const onSearchSuccess = (data, expectedPage) => {
|
|
|
|
|
const res = data;
|
2023-03-28 20:36:21 +08:00
|
|
|
setConversations(res.conversations);
|
2023-03-18 14:28:10 -04:00
|
|
|
if (expectedPage) {
|
2023-03-28 20:36:21 +08:00
|
|
|
setPageNumber(expectedPage);
|
2023-03-14 20:21:41 -04:00
|
|
|
}
|
2023-03-18 14:28:10 -04:00
|
|
|
setPages(res.pages);
|
2023-03-18 15:59:59 -04:00
|
|
|
setIsFetching(false);
|
2023-03-29 00:08:02 +08:00
|
|
|
searchPlaceholderConversation();
|
|
|
|
|
setSearchResultMessages(res.messages);
|
2023-03-06 08:58:52 -05:00
|
|
|
};
|
|
|
|
|
|
2023-04-06 05:47:37 -07:00
|
|
|
useEffect(() => {
|
2023-04-06 08:02:08 -07:00
|
|
|
//we use isInitialLoading here instead of isLoading because query is disabled by default
|
2023-04-06 05:47:37 -07:00
|
|
|
if (searchQueryFn.isInitialLoading) {
|
|
|
|
|
setIsFetching(true);
|
2023-05-18 11:09:31 -07:00
|
|
|
} else if (searchQueryFn.data) {
|
2023-04-06 05:47:37 -07:00
|
|
|
onSearchSuccess(searchQueryFn.data);
|
|
|
|
|
}
|
2023-05-18 11:09:31 -07:00
|
|
|
}, [searchQueryFn.data, searchQueryFn.isInitialLoading]);
|
2023-03-18 15:59:59 -04:00
|
|
|
|
2023-03-18 14:28:10 -04:00
|
|
|
const clearSearch = () => {
|
2023-03-28 20:36:21 +08:00
|
|
|
setPageNumber(1);
|
|
|
|
|
refreshConversations();
|
|
|
|
|
if (conversationId == 'search') {
|
|
|
|
|
newConversation();
|
2023-03-22 16:06:11 -04:00
|
|
|
}
|
2023-03-18 14:28:10 -04:00
|
|
|
};
|
|
|
|
|
|
2023-06-11 14:46:21 -04:00
|
|
|
const moveToTop = useCallback(() => {
|
2023-05-19 20:21:34 +05:30
|
|
|
const container = containerRef.current;
|
|
|
|
|
if (container) {
|
|
|
|
|
scrollPositionRef.current = container.scrollTop;
|
|
|
|
|
}
|
2023-06-11 14:46:21 -04:00
|
|
|
}, [containerRef, scrollPositionRef]);
|
2023-05-19 20:21:34 +05:30
|
|
|
|
2023-03-15 04:05:14 +08:00
|
|
|
const nextPage = async () => {
|
2023-03-14 20:21:41 -04:00
|
|
|
moveToTop();
|
2023-04-07 10:16:53 -07:00
|
|
|
setPageNumber(pageNumber + 1);
|
2023-03-15 04:05:14 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const previousPage = async () => {
|
2023-03-14 20:21:41 -04:00
|
|
|
moveToTop();
|
2023-04-07 10:16:53 -07:00
|
|
|
setPageNumber(pageNumber - 1);
|
2023-03-05 14:41:50 -05:00
|
|
|
};
|
2023-02-14 16:15:45 -05:00
|
|
|
|
2023-03-14 20:21:41 -04:00
|
|
|
useEffect(() => {
|
2023-04-02 12:49:12 -07:00
|
|
|
if (getConversationsQuery.data) {
|
|
|
|
|
if (isSearching) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let { conversations, pages } = getConversationsQuery.data;
|
|
|
|
|
if (pageNumber > pages) {
|
|
|
|
|
setPageNumber(pages);
|
|
|
|
|
} else {
|
|
|
|
|
if (!isSearching) {
|
2023-05-18 11:09:31 -07:00
|
|
|
conversations = conversations.sort(
|
2023-07-14 09:36:49 -04:00
|
|
|
(a, b) => new Date(b.createdAt) - new Date(a.createdAt),
|
2023-05-18 11:09:31 -07:00
|
|
|
);
|
2023-04-02 12:49:12 -07:00
|
|
|
}
|
|
|
|
|
setConversations(conversations);
|
|
|
|
|
setPages(pages);
|
|
|
|
|
}
|
2023-03-18 14:28:10 -04:00
|
|
|
}
|
2023-04-02 12:49:12 -07:00
|
|
|
}, [getConversationsQuery.isSuccess, getConversationsQuery.data, isSearching, pageNumber]);
|
2023-02-13 23:14:35 -05:00
|
|
|
|
2023-04-03 14:57:30 -07:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (!isSearching) {
|
|
|
|
|
getConversationsQuery.refetch();
|
|
|
|
|
}
|
2023-07-15 10:43:15 -04:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2023-04-03 14:57:30 -07:00
|
|
|
}, [pageNumber, conversationId, refreshConversationsHint]);
|
|
|
|
|
|
2023-03-28 20:36:21 +08:00
|
|
|
const toggleNavVisible = () => {
|
2023-05-18 11:44:07 -07:00
|
|
|
setNavVisible((prev) => !prev);
|
2023-03-28 20:36:21 +08:00
|
|
|
};
|
|
|
|
|
|
2023-03-07 13:53:23 -05:00
|
|
|
const containerClasses =
|
2023-04-02 12:49:12 -07:00
|
|
|
getConversationsQuery.isLoading && pageNumber === 1
|
2023-03-07 13:53:23 -05:00
|
|
|
? 'flex flex-col gap-2 text-gray-100 text-sm h-full justify-center items-center'
|
|
|
|
|
: 'flex flex-col gap-2 text-gray-100 text-sm';
|
2023-02-25 10:16:21 -05:00
|
|
|
|
2023-02-06 13:27:28 -05:00
|
|
|
return (
|
2023-03-12 00:32:03 +08:00
|
|
|
<>
|
2023-07-15 17:56:18 +05:30
|
|
|
<div
|
2023-07-15 10:43:15 -04:00
|
|
|
className="nav active dark flex-shrink-0 overflow-x-hidden bg-gray-900 transition-all duration-200 ease-in-out"
|
|
|
|
|
style={{
|
|
|
|
|
width: navVisible ? '260px' : '0px',
|
|
|
|
|
visibility: navVisible ? 'visible' : 'hidden',
|
|
|
|
|
}}
|
2023-07-15 17:56:18 +05:30
|
|
|
>
|
2023-07-15 10:43:15 -04:00
|
|
|
<div className="h-full w-[260px]">
|
|
|
|
|
<div className="flex h-full min-h-0 flex-col ">
|
|
|
|
|
<div className="scrollbar-trigger relative flex h-full w-full flex-1 items-start border-white/20">
|
|
|
|
|
<nav className="relative flex h-full flex-1 flex-col space-y-1 p-2">
|
|
|
|
|
<div className="mb-2 flex h-11 flex-row">
|
|
|
|
|
<NewChat />
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
className={cn(
|
|
|
|
|
'nav-close-button inline-flex h-11 w-11 items-center justify-center rounded-md border border-white/20 text-white hover:bg-gray-500/10',
|
|
|
|
|
)}
|
|
|
|
|
onClick={toggleNavVisible}
|
|
|
|
|
>
|
2023-07-24 08:33:08 -04:00
|
|
|
<span className="sr-only">{localize(lang, 'com_nav_close_sidebar')}</span>
|
2023-07-15 10:43:15 -04:00
|
|
|
<Panel open={false} />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
className={`flex-1 flex-col overflow-y-auto ${
|
|
|
|
|
isHovering ? '' : 'scrollbar-transparent'
|
|
|
|
|
} border-b border-white/20`}
|
|
|
|
|
onMouseEnter={() => setIsHovering(true)}
|
|
|
|
|
onMouseLeave={() => setIsHovering(false)}
|
|
|
|
|
ref={containerRef}
|
2023-07-04 05:26:00 +09:00
|
|
|
>
|
2023-07-15 10:43:15 -04:00
|
|
|
<div className={containerClasses}>
|
|
|
|
|
{(getConversationsQuery.isLoading && pageNumber === 1) || isFetching ? (
|
|
|
|
|
<Spinner />
|
|
|
|
|
) : (
|
|
|
|
|
<Conversations
|
|
|
|
|
conversations={conversations}
|
|
|
|
|
conversationId={conversationId}
|
|
|
|
|
moveToTop={moveToTop}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
<Pages
|
|
|
|
|
pageNumber={pageNumber}
|
|
|
|
|
pages={pages}
|
|
|
|
|
nextPage={nextPage}
|
|
|
|
|
previousPage={previousPage}
|
2023-03-12 00:32:03 +08:00
|
|
|
/>
|
2023-07-15 10:43:15 -04:00
|
|
|
</div>
|
2023-03-12 00:32:03 +08:00
|
|
|
</div>
|
2023-07-15 10:43:15 -04:00
|
|
|
<NavLinks clearSearch={clearSearch} isSearchEnabled={isSearchEnabled} />
|
|
|
|
|
</nav>
|
|
|
|
|
</div>
|
2023-03-12 00:32:03 +08:00
|
|
|
</div>
|
2023-02-06 13:27:28 -05:00
|
|
|
</div>
|
2023-03-12 00:32:03 +08:00
|
|
|
</div>
|
2023-05-19 20:21:34 +05:30
|
|
|
{!navVisible && (
|
2023-07-15 10:43:15 -04:00
|
|
|
<div className="absolute left-2 top-2 z-10 hidden md:inline-block">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
feat: ChatGPT Plugins/OpenAPI specs for Plugins Endpoint (#620)
* wip: proof of concept for openapi chain
* chore(api): update langchain dependency to version 0.0.105
* feat(Plugins): use ChatGPT Plugins/OpenAPI specs (first pass)
* chore(manifest.json): update pluginKey for "Browser" tool to "web-browser"
chore(handleTools.js): update customConstructor key for "web-browser" tool
* fix(handleSubmit.js): set unfinished property to false for all endpoints
* fix(handlers.js): remove unnecessary capitalizeWords function and use action.tool directly
refactor(endpoints.js): rename availableTools to tools and transform it into a map
* feat(endpoints): add plugins selector to endpoints file
refactor(CodeBlock.tsx): refactor to typescript
refactor(Plugin.tsx): use recoil Map for plugin name and refactor to typescript
chore(Message.jsx): linting
chore(PluginsOptions/index.jsx): remove comment/linting
chore(svg): export Clipboard and CheckMark components from SVG index and refactor to typescript
* fix(OpenAPIPlugin.js): rename readYamlFile function to readSpecFile
fix(OpenAPIPlugin.js): handle JSON files in readSpecFile function
fix(OpenAPIPlugin.js): handle JSON URLs in getSpec function
fix(OpenAPIPlugin.js): handle JSON variables in createOpenAPIPlugin function
fix(OpenAPIPlugin.js): add description for variables in createOpenAPIPlugin function
fix(OpenAPIPlugin.js): add optional flag for is_user_authenticated and has_user_authentication in ManifestDefinition
fix(loadSpecs.js): add optional flag for is_user_authenticated and has_user_authentication in ManifestDefinition
fix(Plugin.tsx): remove unnecessary callback parameter in getPluginName function
fix(getDefaultConversation.js): fix browser console error: handle null value for lastConversationSetup in getDefaultConversation function
* feat(api): add new tools
Add Ai PDF tool for super-fast, interactive chats with PDFs of any size, complete with page references for fact checking.
Add VoxScript tool for searching through YouTube transcripts, financial data sources, Google Search results, and more.
Add WebPilot tool for browsing and QA of webpages, PDFs, and data. Generate articles from one or more URLs.
feat(api): update OpenAPIPlugin.js
- Add support for bearer token authorization in the OpenAPIPlugin.
- Add support for custom headers in the OpenAPIPlugin.
fix(api): fix loadTools.js
- Pass the user parameter to the loadSpecs function.
* feat(PluginsClient.js): import findMessageContent function from utils
feat(PluginsClient.js): add message parameter to options object in initializeCustomAgent function
feat(PluginsClient.js): add content to errorMessage if message content is found
feat(PluginsClient.js): break out of loop if message content is found
feat(PluginsClient.js): add delay option with value of 8 to generateTextStream function
feat(PluginsClient.js): add support for process.env.PORT environment variable in app.listen function
feat(askyourpdf.json): add askyourpdf plugin configuration
feat(metar.json): add metar plugin configuration
feat(askyourpdf.yaml): add askyourpdf plugin OpenAPI specification
feat(OpenAPIPlugin.js): add message parameter to createOpenAPIPlugin function
feat(OpenAPIPlugin.js): add description_for_model to chain run message
feat(addOpenAPISpecs.js): remove verbose option from loadSpecs function call
fix(loadSpecs.js): add 'message' parameter to the loadSpecs function
feat(findMessageContent.js): add utility function to find message content in JSON objects
* fix(PluginStoreDialog.tsx): update z-index value for the dialog container
The z-index value for the dialog container was updated to "102" to ensure it appears above other elements on the page.
* chore(web_pilot.json): add "params" field with "user_has_request" parameter set to true
* chore(eslintrc.js): update eslint rules
fix(Login.tsx): add missing semicolon after import statement
* fix(package-lock.json): update langchain dependency to version ^0.0.105
* fix(OpenAPIPlugin.js): change header key from 'id' to 'librechat_user_id' for consistency and clarity
feat(plugins): add documentation for using official ChatGPT Plugins with OpenAPI specs
This commit adds a new file `chatgpt_plugins_openapi.md` to the `docs/features/plugins` directory. The file provides detailed information on how to use official ChatGPT Plugins with OpenAPI specifications. It explains the components of a plugin, including the Plugin Manifest file and the OpenAPI spec. It also covers the process of adding a plugin, editing manifest files, and customizing OpenAPI spec files. Additionally, the commit includes disclaimers about the limitations and compatibility of plugins with LibreChat. The documentation also clarifies that the use of ChatGPT Plugins with LibreChat does not violate OpenAI's Terms of Service.
The purpose of this commit is to provide comprehensive documentation for developers who want to integrate ChatGPT Plugins into their projects using OpenAPI specs. It aims to guide them through the process of adding and configuring plugins, as well as addressing potential issues and
chore(introduction.md): update link to ChatGPT Plugins documentation
docs(introduction.md): clarify the purpose of the plugins endpoint and its capabilities
* fix(OpenAPIPlugin.js): update SUFFIX variable to provide a clearer description
docs(chatgpt_plugins_openapi.md): update information about adding plugins via url on the frontend
* feat(PluginsClient.js): sendIntermediateMessage on successful Agent load
fix(PluginsClient.js, server/index.js, gptPlugins.js): linting fixes
docs(chatgpt_plugins_openapi.md): update links and add additional information
* Update chatgpt_plugins_openapi.md
* chore: rebuild package-lock file
* chore: format/lint all files with new rules
* chore: format all files
* chore(README.md): update AI model selection list
The AI model selection list in the README.md file has been updated to reflect the current options available. The "Anthropic" model has been added as an alternative name for the "Claude" model.
* fix(Plugin.tsx): type issue
* feat(tools): add new tool WebPilot
feat(tools): remove tool Weather Report
feat(tools): add new tool Prompt Perfect
feat(tools): add new tool Scholarly Graph Link
* feat(OpenAPIPlugin.js): add getSpec and readSpecFile functions
feat(OpenAPIPlugin.spec.js): add tests for readSpecFile, getSpec, and createOpenAPIPlugin functions
* chore(agent-demo-1.js): remove unused code and dependencies
chore(agent-demo-2.js): remove unused code and dependencies
chore(demo.js): remove unused code and dependencies
* feat(addOpenAPISpecs): add function to transform OpenAPI specs into desired format
feat(addOpenAPISpecs.spec): add tests for transformSpec function
fix(loadSpecs): remove debugging code
* feat(loadSpecs.spec.js): add unit tests for ManifestDefinition, validateJson, and loadSpecs functions
* fix: package file resolution bug
* chore: move scholarly_graph_link manifest to 'has-issues'
* refactor(client/hooks): convert to TS and export from index
* Update introduction.md
* Update chatgpt_plugins_openapi.md
2023-07-16 12:19:47 -04:00
|
|
|
className="nav-open-button flex h-11 cursor-pointer items-center gap-3 rounded-md border border-black/10 bg-white p-3 text-sm text-black transition-colors duration-200 hover:bg-gray-50 dark:border-white/20 dark:bg-gray-800 dark:text-gray-100 dark:hover:bg-gray-700"
|
2023-07-15 10:43:15 -04:00
|
|
|
onClick={toggleNavVisible}
|
|
|
|
|
>
|
|
|
|
|
<div className="flex items-center justify-center">
|
2023-07-24 08:33:08 -04:00
|
|
|
<span className="sr-only">{localize(lang, 'com_nav_open_sidebar')}</span>
|
2023-07-15 10:43:15 -04:00
|
|
|
<Panel open={true} />
|
|
|
|
|
</div>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2023-05-19 20:21:34 +05:30
|
|
|
)}
|
|
|
|
|
|
2023-05-18 11:09:31 -07:00
|
|
|
<div className={'nav-mask' + (navVisible ? ' active' : '')} onClick={toggleNavVisible}></div>
|
2023-03-12 00:32:03 +08:00
|
|
|
</>
|
2023-02-06 13:27:28 -05:00
|
|
|
);
|
|
|
|
|
}
|