Skip to content

test/playwright jest cicd - #418

Closed
danorlando wants to merge 300 commits into
LibreChat-AI:mainfrom
danorlando:feat/playwright-jest-cicd
Closed

danorlando wants to merge 300 commits into
LibreChat-AI:mainfrom
danorlando:feat/playwright-jest-cicd

Conversation

@danorlando

@danorlando danorlando commented Jun 2, 2023 •

Copy link
Copy Markdown
Collaborator

This PR makes changes to help streamline the development process by providing an automated authentication process for playwright, separating out configuration for local vs. pipeline runs, and setting up CI/CD pipelines for unit and integration tests with github workflows.

  • Create automated authentication process for playwright
  • Add new secrets to github actions settings on fork (will need to be done for this repo by @danny-avila)
  • Update e2e run scripts and remove e2e:auth and e2e:auth-test scripts
  • Create separate playwright configs for local and pipeline environments
  • Update github action for playwright
  • Update Jest config for frontend and create pipeline to run unit tests on each PR
  • Update test script in root package.json to run clientside unit tests from root folder
  • Move backend jest config to /api
  • Create action pipeline for backend unit test runs
  • Update documentation

Current Issues:

  • Playwright pipeline: While the playwright run with authentication works fine locally, It still has an issue in the pipeline where the UI does not seem to load properly. I have yet to determine why this happens, however getting it to install, build, and run so it could get to the point of running the tests was a significant feat.
  • API test pipeline: There is an issue with the api jest pipeline where it is unable to install the Sharp library. I tried the suggestion provided by the error by adding a step that manually installs the linux x64 distro of Sharp but it didn't make any difference. Once this is resolved I expect the pipeline to run fine.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Ran tests locally, confirmed to be working as expected
  • Ran pipelines against my branch on fork

Test Configuration:

  • Add E2E_USER_EMAIL and E2E_USER_PASSWORD to .env.test in /e2e folder (NOTE: this user must exist in the mongodb you are testing against)
  • Update project and run npm run e2e:debug, see that it automatically authenticates.
  • Run npm run test:client from root folder, see that the unit tests pass as expected.
  • Run npm run test:api from root
  • cd /client and npm run test:ci to test the ci script
  • cd /api and npm run test:ci to test the api ci script (note that tests will fail since they get the env vars from github secrets)

To get the github action working, the following should be added to the github action secrets (this should be done before merging the PR):

  • E2E_USER_EMAIL and E2E_USER_PASSWORD: this should be a valid user in the db that the MONGO_URI is connecting to
  • CREDS_KEY and CREDS_IV
  • JWT_SECRET

Note: you may opt to remove lines 4 and 5 of the pipelines as it may be unnecessary to also run unit tests when merging in addition to PRs.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

fix(langchain): remove zapierApiKey option from ChatAgent constructor
refactor(langchain): update langchain package to v0.0.64
misc(langchain): update test2, test3, and test4 scripts to use --inspect flag
…tion

fix(agent.js): pass progress callback to sendApiMessage function
…nstructor

feat(agent.js): add support for environment variable SERPAPI_API_KEY
feat(agent.js): add support for environment variable ZAPIER_NLA_API_KEY
docs(agent.js): remove commented out code and add comments to clarify code
feat(langchain): add support for GPT-4 model
fix(server/index.js): fix uncaughtException handler to ignore 'fetch failed' errors
…e concise message

refactor(agent.js): remove unused variable 'errorMessage'
refactor(agent.js): change 'result' variable initialization to an empty object instead of null
refactor(agent.js): change error message when response generation fails
refactor(agent.js): change output message when response generation fails
refactor(agent.js): change output message when response generation succeeds
feat(langchain): add test5 script to package.json for running test5.js script
refactor(test3.js, test5.js): remove commented out code and add comments

The changes in agent.js are to improve the message that is returned to the user. The word "response" has been changed to "answer" to better reflect the output of the chatbot. The message has also been updated to provide clearer instructions to the user.

The changes in test3.js and test5.js are to remove commented out code and add comments to improve readability.
fix: fix typo in BingAI/Settings.jsx
feat: add Dockerfile for app containerization

docs(google_search.md): add guide for setting up Google Custom Search API key and ID
…mponent

docs: update link to system message guidelines in GOOGLE_SEARCH.md
feat: add JAILBREAK_INFO.md guide for Bing AI jailbreak mode system message guidelines
style(agent.js): refactor getActions method to accept an input parameter
feat(agent.js): add handleChainEnd method to CustomChatAgent class
style(customAgent.js): add a new line to the end of the file
style(test5.js): comment out unused variable and update input1 variable
style(googleSearch.js): change tool name to kebab-case
feat(langchain): add browser tool to ChatAgent in test2.js
feat(langchain): add modelOptions to ChatAgent in test2.js
feat(langchain): change question in input1 and request article review summary in test5.js
…rentMessageId field

feat(askGPTPlugins.js): add default value of null to parentMessageId parameter in ask function
…ptPlugins'

feat(endpoints.js): add support for gptPlugins endpoint
feat(PresetItem.jsx): add support for gptPlugins endpoint
feat(HoverButtons.jsx): add support for gptPlugins endpoint
feat(createPayload.ts): add support for gptPlugins endpoint
feat(types.ts): add gptPlugins endpoint to EModelEndpoint enum
feat(endpoints.js): add gptPlugins endpoint to availableEndpoints selector
feat(cleanupPreset.js): add support for gptPlugins endpoint
feat(getDefaultConversation.js): add support for gptPlugins endpoint
feat(getIcon.jsx): add support for gptPlugins endpoint
feat(handleSubmit.js): add support for gptPlugins endpoint
refactor(agent.js): change tool name from 'google-search' to 'google'
refactor(agent.js): update description for 'google' tool
feat(agent.js): add support for citing sources when using web links in response message
fix(agent.js): update error message to not mention error to user
feat(agent.js): add unique message ids for user message and response message
feat(agent.js): limit number of search results to 5 in 'google' tool
refactor(validateTools.js): add console log to show valid tools
…ate model option

refactor(askGPTPlugins.js): remove unused imports and variables
refactor(askGPTPlugins.js): remove commented code
refactor(askGPTPlugins.js): remove unused parameters in ask function
feat(ask/index.js): add askGPTPlugins route to router
feat(askGPTPlugins.js): add support for debug option in endpointOption
feat(askGPTPlugins.js): add support for chatGptLabel, promptPrefix, temperature, top_p, presence_penalty, and frequency_penalty in endpointOption
feat(askGPTPlugins.js): add support for sending plugin and pluginend events
feat(askGPTPlugins.js): add onAgentAction and onChainEnd callbacks to ChatAgent.sendMessage
refactor(titleConvo.js): comment out unused imports
refactor(validateTools.js): comment out console.log statement
refactor(agent.js): change saveMessage to include unfinished property
feat(agent.js): add endpoint property to saveConvo call in saveMessageToDatabase
feat(askGPTPlugins.js): add validateTools import and use it to validate endpointOption.tools before passing to ChatAgent constructor
feat(askGPTPlugins.js
…variable and add support for gptPlugins endpoint

fix(MessageHeader.jsx): disable clicking on non-clickable endpoints
…gin name

feat(Plugin.jsx): add loading state and display loading spinner
feat(Plugin.jsx): add Disclosure component to Plugin component
feat(Plugin.jsx): add Disclosure.Panel to Plugin component to display team pricing information
feat(Spinner.jsx): add classProp prop to Spinner component to allow for custom styling
feat(Landing.jsx): add Plugin component to Landing page for testing

testing gpt plugins

feat(plugins): Milestone commit

- Add formatAction function to format plugin actions.
- Add prefix.js file to store the prefix message for ChatAgent.
- Update ask function to include plugin object to store plugin data.
- Update onAgentAction and onChainEnd functions to format plugin data and send intermediate messages.
- Update response object to include plugin data.

The `handlers.js` file now includes a `formatAction` function that formats the action object for display in the UI. The `createOnProgress` function now returns a `sendIntermediateMessage` function that sends intermediate messages to the client.

feat (client): add support for plugins in messages

This commit adds support for plugins in messages. It includes changes to the `handlers.js`, `index.jsx`, `CodeBlock.jsx`, `Message.jsx`, `MessageHeader.jsx`, and `Plugin.jsx` files.

The `index.jsx` file now includes a `plugin` property in the `messageHandler` function.

The `CodeBlock.jsx` file now includes a `plugin` property that determines the language of the code block.

The `Message.jsx` file now includes a `Plugin` component that displays the plugin used in the message.

The `MessageHeader.jsx` file now includes a `Plugins` component that displays the enabled plugins.

feat(langchain): add OpenAICreateImage tool for generating images based on user prompts
fix(langchain): update validateTools to include create-image tool
fix(langchain): save plugin data to messageSchema
fix(server/routes/askGPTPlugins.js): save userMessage and response to messageSchema

feat(langchain): add SelfReflectionTool

Add a new tool to the LangChain agent, SelfReflectionTool, which enhances the agent's self-awareness by reflecting on its thoughts before taking action. The tool provides a space for the agent to explore and organize its ideas in response to the user's message.

Also, update the prefix message to reflect the changes in the agent's behavior and the way it should engage with the user. The prefix message now emphasizes the use of tools when necessary, and relying on the agent's knowledge for creative requests. It also provides clear instructions on how to use the 'Action' input and how to carry out tasks in the sequence written by the human.

Finally, update the OpenAICreateImage tool to return the image URL in markdown format. The tool replaces newlines and spaces in the input text with hyphens to create a valid markdown link.

Milestone commit: better error handling with custom output parser, dir and file re-org

style(langchain): fix formatting and add comments to prefix.js
fix(langchain): remove commented out code in test6.js
feat(langchain): reduce maxAttempts from 3 to 2 in CustomChatAgent's buildPromptPrefix method
feat(langchain): add null check for result.output in CustomChatAgent's buildPromptPrefix method

style(langchain): improve consistency and readability of code

This commit improves the consistency and readability of the code in the langchain directory. Specifically, it:

- Changes the case of the "Thought" output in the CustomChatAgent class to match the "Thought" output in the SelfReflectionTool class.
- Adds a currentDateString property to the CustomChatAgent class to avoid repeating the same code in multiple places.
- Updates the prefix in the prefix.js file to match the current objectives of the ChatGPT model.
- Changes the description of the OpenAICreateImage tool to request a description of the image to be generated.
- Updates the tools used by the ChatAgent in the askGPTPlugins.js file to include the Google and Browser tools instead of the Calculator and Create-Image tools.

feat: add wolfram, improve image creation, rename to dall-e
- Update tool-based instructions to use proper Markdown syntax for image URLs
- Adjust temperature for modelOptions in CustomChatAgent class
- Comment out console.debug statement in CustomChatAgent class
- Update prefix in initializeCustomAgent function to use proper line breaks
- Update prefix in instructions.js to use proper line breaks and change "user" to "human"
- Update input in test6.js to use Ezra Pound instead of Hemingway
- Update return statement in OpenAICreateImage class to use "generated-image" as alt-text
- Update description in SelfReflectionTool class to provide clearer instructions
- Update tools in ask function in askGPTPlugins.js to use only the DALL-E tool and enable debug mode

feat(ask): add support for DALL-E tool in formatAction function
feat(ask): add support for self-reflection tool in formatAction function
feat(Plugin.jsx): add support for self-reflection tool in Plugin component
fix(Plugin.jsx): fix Plugin component to not display 'None' when latest is not available
feat(agent.js): pass message parameter to SelfReflectionTool constructor
feat(customAgent.js): add longestToolName variable to CustomOutputParser
feat(openaiCreateImage.js): replace new lines with spaces in prompt parameter
feat(selfReflection.js): add message parameter to SelfReflectionTool constructor
feat(selfReflection.js): add placeholder response to selfReflect function
@danny-avila

Copy link
Copy Markdown
Collaborator

Sorry, I just realized I should've merged this first. I can work on the merge conflicts

@danny-avila

Copy link
Copy Markdown
Collaborator

Closing after resolving conflicts and continuing the original branch in #478

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants