fix: use correct space context when sending messages (#772)

This commit is contained in:
sreedharsreeram 2026-03-07 21:11:10 +00:00
parent 3d916d038f
commit d0d90e9359

View file

@ -154,7 +154,7 @@ export function ChatSidebar({
const chatTransport = useMemo(
() =>
new DefaultChatTransport({
api: `${process.env.NEXT_PUBLIC_BACKEND_URL}/chat/v2`,
api: `${process.env.NEXT_PUBLIC_BACKEND_URL ?? "https://api.supermemory.ai"}/chat/v2`,
credentials: "include",
prepareSendMessagesRequest: ({ messages }) => ({
body: {
@ -162,11 +162,12 @@ export function ChatSidebar({
metadata: {
chatId: chatIdRef.current,
projectId: selectedProject,
model: selectedModel,
},
},
}),
}),
[currentChatId, selectedProject],
[selectedProject, selectedModel],
)
const [pendingThreadLoad, setPendingThreadLoad] = useState<{
id: string
@ -194,17 +195,7 @@ export function ChatSidebar({
const { messages, sendMessage, status, setMessages, stop } = useChat({
id: currentChatId ?? undefined,
transport: new DefaultChatTransport({
api: `${process.env.NEXT_PUBLIC_BACKEND_URL ?? "https://api.supermemory.ai"}/chat/v2`,
credentials: "include",
body: {
metadata: {
chatId: currentChatId,
projectId: selectedProject,
model: selectedModel,
},
},
}),
transport: chatTransport,
onFinish: async (result) => {
if (result.message.role !== "assistant") return