Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

get convos endpoint

Danny Avila2869638cc0a7
diff --git a/models/Conversation.js b/models/Conversation.js
index 26e73f8ded..6f95fbc1b1 100644
--- a/models/Conversation.js
+++ b/models/Conversation.js
@@ -38,5 +38,8 @@ module.exports = {
{ $set: update },
{ new: true, upsert: true }
).exec();
- }
+ },
+ getConversations: async () => {
+ return await Conversation.find({}).exec();
+ },
};
diff --git a/package-lock.json b/package-lock.json
index f1cdbbbd23..d7a362fb1b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21,6 +21,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-textarea-autosize": "^8.4.0",
+ "swr": "^2.0.3",
"url": "^0.11.0"
},
"devDependencies": {
@@ -11252,6 +11253,20 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/swr": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/swr/-/swr-2.0.3.tgz",
+ "integrity": "sha512-sGvQDok/AHEWTPfhUWXEHBVEXmgGnuahyhmRQbjl9XBYxT/MSlAzvXEKQpyM++bMPaI52vcWS2HiKNaW7+9OFw==",
+ "dependencies": {
+ "use-sync-external-store": "^1.2.0"
+ },
+ "engines": {
+ "pnpm": "7"
+ },
+ "peerDependencies": {
+ "react": "^16.11.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/tailwindcss": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.2.4.tgz",
@@ -11711,6 +11726,14 @@
}
}
},
+ "node_modules/use-sync-external-store": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz",
+ "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==",
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/util": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
@@ -20458,6 +20481,14 @@
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true
},
+ "swr": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/swr/-/swr-2.0.3.tgz",
+ "integrity": "sha512-sGvQDok/AHEWTPfhUWXEHBVEXmgGnuahyhmRQbjl9XBYxT/MSlAzvXEKQpyM++bMPaI52vcWS2HiKNaW7+9OFw==",
+ "requires": {
+ "use-sync-external-store": "^1.2.0"
+ }
+ },
"tailwindcss": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.2.4.tgz",
@@ -20785,6 +20816,12 @@
"use-isomorphic-layout-effect": "^1.1.1"
}
},
+ "use-sync-external-store": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz",
+ "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==",
+ "requires": {}
+ },
"util": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
diff --git a/package.json b/package.json
index 92109a3a1e..197ef74c1f 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-textarea-autosize": "^8.4.0",
+ "swr": "^2.0.3",
"url": "^0.11.0"
},
"devDependencies": {
diff --git a/server/index.js b/server/index.js
index 04279c6165..5b5949381c 100644
--- a/server/index.js
+++ b/server/index.js
@@ -2,7 +2,7 @@ const express = require('express');
const { ask, titleConversation } = require('../app/chatgpt');
const dbConnect = require('../models/dbConnect');
const { saveMessage } = require('../models/Message');
-const { saveConversation } = require('../models/Conversation');
+const { saveConversation, getConversations } = require('../models/Conversation');
const crypto = require('crypto');
const path = require('path');
const cors = require('cors');
@@ -21,6 +21,10 @@ app.get('/', function (req, res) {
res.sendFile(path.join(projectPath, 'public', 'index.html'));
});
+app.get('/convos', async (req, res) => {
+ res.status(200).send(await getConversations());
+});
+
app.post('/ask', async (req, res) => {
console.log(req.body);
const { text, parentMessageId, conversationId } = req.body;
diff --git a/src/App.jsx b/src/App.jsx
index df5575ffa2..541f9ffb10 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -13,8 +13,8 @@ const App = () => {
<Nav />
{/* <div className="flex h-full flex-1 flex-col md:pl-[260px]"> */}
<div className="flex h-full w-full flex-1 flex-col bg-gray-50 md:pl-[260px]">
- <MobileNav />
{/* <main className="relative h-full w-full transition-width flex flex-col overflow-hidden items-stretch flex-1"> */}
+ <MobileNav />
<Messages messages={messages} />
<TextChat
messages={messages}
diff --git a/src/components/Conversation.jsx b/src/components/Conversation.jsx
index 351730510a..550e723d59 100644
--- a/src/components/Conversation.jsx
+++ b/src/components/Conversation.jsx
@@ -58,13 +58,13 @@ export default function Conversation({ id, title = 'New conversation'}) {
y1="11"
x2="10"
y2="17"
- ></line>
+ />
<line
x1="14"
y1="11"
x2="14"
y2="17"
- ></line>
+ />
</svg>
</button>
</div>