diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..37ef799acb --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: [danny-avila] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/api/server/routes/askBing.js b/api/server/routes/askBing.js index 535b580ed5..ffadc8a493 100644 --- a/api/server/routes/askBing.js +++ b/api/server/routes/askBing.js @@ -2,7 +2,7 @@ const express = require('express'); const crypto = require('crypto'); const router = express.Router(); const { titleConvo, askBing } = require('../../app/'); -const { saveBingMessage, getConvoTitle, saveConvo, updateConvo } = require('../../models'); +const { saveBingMessage, getConvoTitle, saveConvo } = require('../../models'); const { handleError, sendMessage, createOnProgress, handleText } = require('./handlers'); router.post('/', async (req, res) => { @@ -123,7 +123,7 @@ const ask = async ({ // Attition: the api will also create new conversationId while using invalid userMessage.parentMessageId, // but in this situation, don't change the conversationId, but create new convo. if (conversationId != userMessage.conversationId && isNewConversation) - await updateConvo( + await saveConvo( req?.session?.user?.username, { conversationId: conversationId, @@ -148,7 +148,7 @@ const ask = async ({ response.text = await handleText(response, true); await saveBingMessage(response); - await updateConvo(req?.session?.user?.username, { model, chatGptLabel: null, promptPrefix: null, ...convo, ...response }); + await saveConvo(req?.session?.user?.username, { model, chatGptLabel: null, promptPrefix: null, ...convo, ...response }); sendMessage(res, { title: await getConvoTitle(req?.session?.user?.username, conversationId), @@ -161,9 +161,11 @@ const ask = async ({ if (userParentMessageId == '00000000-0000-0000-0000-000000000000') { const title = await titleConvo({ model, text, response }); - await updateConvo( + await saveConvo( req?.session?.user?.username, { + ...convo, + ...response, conversationId, title } @@ -185,4 +187,4 @@ const ask = async ({ } }; -module.exports = router; +module.exports = router; \ No newline at end of file diff --git a/api/server/routes/convos.js b/api/server/routes/convos.js index 0774b92ddf..ed3f6db15c 100644 --- a/api/server/routes/convos.js +++ b/api/server/routes/convos.js @@ -20,11 +20,17 @@ router.get('/:conversationId', async (req, res) => { router.post('/clear', async (req, res) => { let filter = {}; - const { conversationId } = req.body.arg; + const { conversationId, source } = req.body.arg; if (conversationId) { filter = { conversationId }; } + console.log('source:', source); + + if (source === 'button' && !conversationId) { + return res.status(200).send('No conversationId provided'); + } + try { const dbResponse = await deleteConvos(req?.session?.user?.username, filter); res.status(201).send(dbResponse); diff --git a/client/src/components/Conversations/DeleteButton.jsx b/client/src/components/Conversations/DeleteButton.jsx index 699cc73a85..079a1e8296 100644 --- a/client/src/components/Conversations/DeleteButton.jsx +++ b/client/src/components/Conversations/DeleteButton.jsx @@ -16,7 +16,7 @@ export default function DeleteButton({ conversationId, renaming, cancelHandler, retainView(); }); - const clickHandler = () => trigger({ conversationId }); + const clickHandler = () => trigger({ conversationId, source: 'button' }); const handler = renaming ? cancelHandler : clickHandler; return (