diff --git a/README.md b/README.md
index 472276c073..3b65d0820f 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,18 @@ https://user-images.githubusercontent.com/110412045/223754183-8b7f45ce-6517-4bd5
## Updates
+2023-03-12
+Really thankful for all the issues reported and contributions made, the project's features and improvements have accelerated as result. Honorable mention is [wtlyu](https://github.com/wtlyu) for contributing a lot of mindful code, namely hostname configuration and mobile styling. I will upload images on next release for faster docker setup, and starting updating them simultaneously with this repo.
+
+
+Many improvements across the board, the biggest is being able to start conversations simultaneously (again thanks to [wtlyu](https://github.com/wtlyu) for bringing it to my attention), as you can switch conversations or start a new chat without any response streaming from a prior one, as the backend will still process/save client responses. Just watch out for any rate limiting from OpenAI/Microsoft if this is done excessively.
+
+
+Adding support for conversation search is next! Thank you [mysticaltech](https://github.com/mysticaltech) for bringing up a method I can use for this.
+
+
+
+
2023-03-09
Released v.0.0.2
@@ -16,8 +28,6 @@ Adds Sydney (jailbroken Bing AI) to the model menu. Thank you [DavesDevFails](ht
I've re-enabled the ChatGPT browser client (free version) since it might be working for most people, it no longer works for me. Sydney is the best free route anyway.
-
-
2023-03-07
Due to increased interest in the repo, I've dockerized the app as of this update for quick setup! See setup instructions below. I realize this still takes some time with installing docker dependencies, so it's on the roadmap to have a deployed demo. Besides this, I've made major improvements for a lot of the existing features across the board, mainly UI/UX.
@@ -95,6 +105,7 @@ Here are my recently completed and planned features:
- [x] Customize prompt prefix/label (custom ChatGPT using official API)
- [x] Server convo pagination (limit fetch and load more with 'show more' button)
- [x] Config file for easy startup (docker compose)
+- [x] Mobile styling (thanks to [wtlyu](https://github.com/wtlyu))
- [ ] Bing AI Styling (for suggested responses, convo end, etc.) - **In progress**
- [ ] Add warning before clearing convos
- [ ] Build test suite for CI/CD
@@ -104,7 +115,6 @@ Here are my recently completed and planned features:
- [ ] Prompt Templates/Search
- [ ] Refactor/clean up code (tech debt)
- [ ] Optional use of local storage for credentials
-- [ ] Mobile styling (half-finished)
- [ ] Deploy demo
### Features
diff --git a/api/app/chatgpt-browser.js b/api/app/chatgpt-browser.js
index a17f277822..8a3c903641 100644
--- a/api/app/chatgpt-browser.js
+++ b/api/app/chatgpt-browser.js
@@ -3,7 +3,7 @@ const { KeyvFile } = require('keyv-file');
const clientOptions = {
// Warning: This will expose your access token to a third party. Consider the risks before using this.
- reverseProxyUrl: 'https://chatgpt.duti.tech/api/conversation',
+ reverseProxyUrl: 'https://bypass.duti.tech/api/conversation',
// Access token from https://chat.openai.com/api/auth/session
accessToken: process.env.CHATGPT_TOKEN,
// debug: true
diff --git a/api/app/detectCode.js b/api/app/detectCode.js
index b631d1921e..0d6fad0534 100644
--- a/api/app/detectCode.js
+++ b/api/app/detectCode.js
@@ -2,7 +2,7 @@ const { ModelOperations } = require('@vscode/vscode-languagedetection');
const languages = require('../utils/languages.js');
const codeRegex = /(```[\s\S]*?```)/g;
// const languageMatch = /```(\w+)/;
-const replaceRegex = /```\w+/g;
+const replaceRegex = /```\w+\n/g;
const detectCode = async (input) => {
try {
@@ -22,7 +22,7 @@ const detectCode = async (input) => {
}
console.log('[detectCode.js] replacing', match, 'with', '```shell');
- text = text.replace(match, '```shell');
+ text = text.replace(match, '```shell\n');
});
return text;
diff --git a/api/server/routes/ask.js b/api/server/routes/ask.js
index 6fa1589fbd..1f18082dd4 100644
--- a/api/server/routes/ask.js
+++ b/api/server/routes/ask.js
@@ -77,6 +77,10 @@ router.post('/', async (req, res) => {
sendMessage(res, { ...partial, message: true });
} else {
tokens += partial === text ? '' : partial;
+ if (tokens.match(/^\n/)) {
+ tokens = tokens.replace(/^\n/, '');
+ }
+
if (tokens.includes('[DONE]')) {
tokens = tokens.replace('[DONE]', '');
}
diff --git a/api/server/routes/stopStream.js b/api/server/routes/stopStream.js
new file mode 100644
index 0000000000..f12ef34de2
--- /dev/null
+++ b/api/server/routes/stopStream.js
@@ -0,0 +1,11 @@
+module.exports = (req, res, next) => {
+ let { stopStream } = req.body;
+ if (stopStream) {
+ console.log('stopStream');
+ res.write('event: stop\ndata:\n\n');
+ res.end();
+ return;
+ } else {
+ next();
+ }
+};
diff --git a/client/src/components/Conversations/Conversation.jsx b/client/src/components/Conversations/Conversation.jsx
index ce4cf3c6be..34e384f624 100644
--- a/client/src/components/Conversations/Conversation.jsx
+++ b/client/src/components/Conversations/Conversation.jsx
@@ -3,8 +3,8 @@ import RenameButton from './RenameButton';
import DeleteButton from './DeleteButton';
import { useSelector, useDispatch } from 'react-redux';
import { setConversation } from '~/store/convoSlice';
-import { setCustomGpt, setModel, setCustomModel } from '~/store/submitSlice';
-import { setMessages } from '~/store/messageSlice';
+import { setSubmission, setStopStream, setCustomGpt, setModel, setCustomModel } from '~/store/submitSlice';
+import { setMessages, setEmptyMessage } from '~/store/messageSlice';
import { setText } from '~/store/textSlice';
import manualSWR from '~/utils/fetchers';
import ConvoIcon from '../svg/ConvoIcon';
@@ -14,13 +14,15 @@ export default function Conversation({
parentMessageId,
conversationId,
title = 'New conversation',
- bingData,
chatGptLabel = null,
- promptPrefix = null
+ promptPrefix = null,
+ bingData,
+ retainView,
}) {
const [renaming, setRenaming] = useState(false);
const [titleInput, setTitleInput] = useState(title);
const { modelMap } = useSelector((state) => state.models);
+ const { stopStream } = useSelector((state) => state.submit);
const inputRef = useRef(null);
const dispatch = useDispatch();
const { trigger } = manualSWR(`/api/messages/${id}`, 'get');
@@ -31,6 +33,12 @@ export default function Conversation({
return;
}
+ if (!stopStream) {
+ dispatch(setStopStream(true));
+ dispatch(setSubmission({}));
+ }
+ dispatch(setEmptyMessage());
+
const convo = { title, error: false, conversationId: id, chatGptLabel, promptPrefix };
if (bingData) {
@@ -81,6 +89,7 @@ export default function Conversation({
dispatch(setMessages(data));
dispatch(setCustomGpt(convo));
dispatch(setText(''));
+ dispatch(setStopStream(false));
};
const renameHandler = (e) => {
@@ -154,6 +163,7 @@ export default function Conversation({
conversationId={id}
renaming={renaming}
cancelHandler={cancelHandler}
+ retainView={retainView}
/>
) : (
diff --git a/client/src/components/Conversations/DeleteButton.jsx b/client/src/components/Conversations/DeleteButton.jsx
index 9b8e688cd0..d2be57c4fc 100644
--- a/client/src/components/Conversations/DeleteButton.jsx
+++ b/client/src/components/Conversations/DeleteButton.jsx
@@ -5,8 +5,9 @@ import manualSWR from '~/utils/fetchers';
import { useDispatch } from 'react-redux';
import { setNewConvo, removeConvo } from '~/store/convoSlice';
import { setMessages } from '~/store/messageSlice';
+import { setSubmission } from '~/store/submitSlice';
-export default function DeleteButton({ conversationId, renaming, cancelHandler }) {
+export default function DeleteButton({ conversationId, renaming, cancelHandler, retainView }) {
const dispatch = useDispatch();
const { trigger } = manualSWR(
`/api/convos/clear`,
@@ -15,6 +16,8 @@ export default function DeleteButton({ conversationId, renaming, cancelHandler }
dispatch(setMessages([]));
dispatch(removeConvo(conversationId));
dispatch(setNewConvo());
+ dispatch(setSubmission({}));
+ retainView();
}
);
diff --git a/client/src/components/Conversations/index.jsx b/client/src/components/Conversations/index.jsx
index 13b1e64b00..6fcac5e27f 100644
--- a/client/src/components/Conversations/index.jsx
+++ b/client/src/components/Conversations/index.jsx
@@ -32,10 +32,11 @@ export default function Conversations({ conversations, conversationId, showMore
chatGptLabel={convo.chatGptLabel}
promptPrefix={convo.promptPrefix}
bingData={bingData}
+ retainView={showMore.bind(null, false)}
/>
);
})}
- {conversations && conversations.length >= 12 && conversations.length % 12 === 0 && (
+ {conversations?.length >= 12 && (