mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-21 21:50:49 +02:00
fix code parsing bug
This commit is contained in:
parent
cbcc1a1bb4
commit
897c384ac9
3 changed files with 12 additions and 35 deletions
29
.eslintrc.js
29
.eslintrc.js
|
@ -1,29 +0,0 @@
|
|||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true,
|
||||
"node": true,
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:react/recommended",
|
||||
"plugin:react-hooks/recommended"
|
||||
],
|
||||
"overrides": [
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
},
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"react"
|
||||
],
|
||||
"rules": {
|
||||
'react/prop-types': ['off'],
|
||||
}
|
||||
}
|
|
@ -1,10 +1,7 @@
|
|||
# ChatGPT Clone #
|
||||

|
||||
## Wrap all conversational AIs under one roof. ##
|
||||
Conversational/Utility AIs are the future and OpenAI revolutionized this movement with ChatGPT. While numerous methods exist to integrate conversational AIs, this app commemorates the original styling of ChatGPT, with the ability to integrate any current/future conversational AI models through user-provided APIs, while also having in mind improved client features, such as conversation search, and prompt templates. This project was also built with the anticipation of the official ChatGPT API from OpenAI, though it uses unofficial packages. Through this clone, you can avoid subscription-based models in favor of either free or pay-per-call APIs. I will most likely not deploy this app, as it's mainly a learning experience, but feel free to clone or fork to create your own custom wrapper.
|
||||
|
||||
## Origin ##
|
||||
This project was originally created as a Minimum Viable Product (or MVP) for the [@HackReactor](https://github.com/hackreactor/) Bootcamp. It was built with OpenAI response streaming and most of the UI completed in under 20 hours. 20 hours in, I had most of the UI and basic functionality done. This was created without using any boilerplates or templates, including create-react-app and other toolchains. The purpose of the exercise was to learn setting up a full stack project from scratch. Please feel free to give feedback, suggestions, or fork the project for your own use.
|
||||
Assistant AIs are the future and OpenAI revolutionized this movement with ChatGPT. While numerous methods exist to integrate these AIs, this app commemorates the original styling of ChatGPT, with the ability to integrate any current/future AI models through user-provided API keys, while improving upon original client features, such as conversation search and prompt templates. This project was built with the anticipation of the official ChatGPT API from OpenAI, and now uses it along with the free access method. Through this clone, you can avoid subscription-based models in favor of free or pay-per-call APIs. I will most likely not deploy this app, as it's mainly a learning experience, but feel free to clone or fork to create your own custom wrapper.
|
||||
|
||||
## Updates
|
||||
<details open>
|
||||
|
@ -77,6 +74,9 @@ Currently, this project is only functional with the `text-davinci-003` model.
|
|||
cannot be searched past a certain timeframe.
|
||||
- Quick one stop shop for all conversational AIs, with the added bonus of searching
|
||||
|
||||
## Origin ##
|
||||
This project was originally created as a Minimum Viable Product (or MVP) for the [@HackReactor](https://github.com/hackreactor/) Bootcamp. It was built with OpenAI response streaming and most of the UI completed in under 20 hours. 20 hours in, I had most of the UI and basic functionality done. This was created without using any boilerplates or templates, including create-react-app and other toolchains. The purpose of the exercise was to learn setting up a full stack project from scratch. Please feel free to give feedback, suggestions, or fork the project for your own use.
|
||||
|
||||
<!-- ## Solution ##
|
||||
Serves and searches all conversations reliably. All AI convos under one house.
|
||||
Pay per call and not per month (cents compared to dollars). -->
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const regex = /```([^`\n]*?)\n([\s\S]*?)\n```/g;
|
||||
const primaryRegex = /```([^`\n]*?)\n([\s\S]*?)\n```/g;
|
||||
const secondaryRegex = /```([^`\n]*?)\n?([\s\S]*?)\n?```/g;
|
||||
|
||||
const unenclosedCodeTest = (text) => {
|
||||
let workingText = text;
|
||||
|
@ -10,7 +11,12 @@ const unenclosedCodeTest = (text) => {
|
|||
};
|
||||
|
||||
export default function regexSplit(string) {
|
||||
const matches = [...string.matchAll(regex)];
|
||||
let matches = [...string.matchAll(primaryRegex)];
|
||||
|
||||
if (!matches[0]) {
|
||||
matches = [...string.matchAll(secondaryRegex)];
|
||||
}
|
||||
|
||||
const output = [matches[0].input.slice(0, matches[0].index)];
|
||||
|
||||
// console.log(matches);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue