chore: should not block users from creating new threads
This commit is contained in:
parent
92d7e33b7e
commit
9c1f0f8a33
@ -59,21 +59,6 @@ export const useCreateNewThread = () => {
|
|||||||
) => {
|
) => {
|
||||||
const defaultModel = model || selectedModel || recommendedModel
|
const defaultModel = model || selectedModel || recommendedModel
|
||||||
|
|
||||||
if (!model) {
|
|
||||||
// if we have model, which means user wants to create new thread from Model hub. Allow them.
|
|
||||||
|
|
||||||
// check last thread message, if there empty last message use can not create thread
|
|
||||||
const lastMessage = threads[0]?.metadata?.lastMessage
|
|
||||||
|
|
||||||
if (!lastMessage && threads.length) {
|
|
||||||
return toaster({
|
|
||||||
title: 'No new thread created.',
|
|
||||||
description: `To avoid piling up empty threads, please reuse previous one before creating new.`,
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// modify assistant tools when experimental on, retieval toggle enabled in default
|
// modify assistant tools when experimental on, retieval toggle enabled in default
|
||||||
const assistantTools: AssistantTool = {
|
const assistantTools: AssistantTool = {
|
||||||
type: 'retrieval',
|
type: 'retrieval',
|
||||||
@ -146,7 +131,7 @@ export const useCreateNewThread = () => {
|
|||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
return toaster({
|
return toaster({
|
||||||
title: 'Thread created failed.',
|
title: 'Thread created failed.',
|
||||||
description: `To avoid piling up empty threads, please reuse previous one before creating new.`,
|
description: `Could not create a new thread. Please try again.`,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ export default function useDeleteThread() {
|
|||||||
?.deleteMessage(threadId, message.id)
|
?.deleteMessage(threadId, message.id)
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
}
|
}
|
||||||
|
|
||||||
const thread = threads.find((e) => e.id === threadId)
|
const thread = threads.find((e) => e.id === threadId)
|
||||||
if (thread) {
|
if (thread) {
|
||||||
const updatedThread = {
|
const updatedThread = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user