diff --git a/src/modules/prem-chat/components/PremChat.tsx b/src/modules/prem-chat/components/PremChat.tsx index 9859f489..47cc20b0 100644 --- a/src/modules/prem-chat/components/PremChat.tsx +++ b/src/modules/prem-chat/components/PremChat.tsx @@ -23,8 +23,8 @@ function PremChat() { ); diff --git a/src/modules/service/components/ServiceActions.tsx b/src/modules/service/components/ServiceActions.tsx index b52e3560..ea49604f 100644 --- a/src/modules/service/components/ServiceActions.tsx +++ b/src/modules/service/components/ServiceActions.tsx @@ -63,17 +63,17 @@ const ServiceActions = ({ const isPlayground = interfaces.some((app) => app.playground); if (isPlayground) { if (interfaces.some((app) => app.id === CHAT_ID)) { - navigate(`/prem-chat/${service.id}/${service.serviceType}`); + navigate(`/prem-chat/${service.id}/${service.serviceType ?? "docker"}`); } else if (interfaces.some((app) => app.id === DIFFUSER_ID)) { - navigate(`/prem-image/${service.id}/${service.serviceType}`); + navigate(`/prem-image/${service.id}/${service.serviceType ?? "docker"}`); } else if (interfaces.some((app) => app.id === AUDIO_TO_TEXT_ID)) { - navigate(`/prem-audio/${service.id}/${service.serviceType}`); + navigate(`/prem-audio/${service.id}/${service.serviceType ?? "docker"}`); } else if (interfaces.some((app) => app.id === TEXT_TO_AUDIO_ID)) { - navigate(`/prem-text-audio/${service.id}/${service.serviceType}`); + navigate(`/prem-text-audio/${service.id}/${service.serviceType ?? "docker"}`); } else if (interfaces.some((app) => app.id === UPSCALER_ID)) { - navigate(`/prem-upscaler/${service.id}/${service.serviceType}`); + navigate(`/prem-upscaler/${service.id}/${service.serviceType ?? "docker"}`); } else if (interfaces.some((app) => app.id === CODER_ID)) { - navigate(`/prem-coder/${service.id}/${service.serviceType}`); + navigate(`/prem-coder/${service.id}/${service.serviceType ?? "docker"}`); } return; } diff --git a/src/shared/hooks/usePremChatStream.ts b/src/shared/hooks/usePremChatStream.ts index 396b171f..a3e5b349 100644 --- a/src/shared/hooks/usePremChatStream.ts +++ b/src/shared/hooks/usePremChatStream.ts @@ -15,7 +15,7 @@ import useGetService from "./useGetService"; const usePremChatStream = ( serviceId: string, serviceType: Service["serviceType"], - chatId: string | null, + historyId: string | null, ): PremChatResponse => { const [question, setQuestion] = useState(""); const [tempQuestion, setTempQuestion] = useState(""); @@ -67,7 +67,7 @@ const usePremChatStream = ( // eslint-disable-next-line react-hooks/exhaustive-deps }, [service]); - const messages = history.find((_history) => _history.id === chatId)?.messages || []; + const messages = history.find((_history) => _history.id === historyId)?.messages || []; const onSubmit = useCallback( (e: React.FormEvent) => { @@ -143,8 +143,8 @@ const usePremChatStream = ( const onRegenerate = useCallback(() => { const newMessages = [...messages]; const lastConversation = newMessages.splice(-2); - if (chatId) { - updateHistoryMessages(chatId, newMessages); + if (historyId) { + updateHistoryMessages(historyId, newMessages); processQuestion(lastConversation[0].content); } // eslint-disable-next-line react-hooks/exhaustive-deps @@ -162,18 +162,18 @@ const usePremChatStream = ( if (!isLoading && pending) { setTempQuestion(""); setPending(undefined); - if (!chatId) { - const newChatId = uuid(); + if (!historyId) { + const newHistoryId = uuid(); addHistory({ - id: newChatId, + id: newHistoryId, model: serviceId, title: tempConversation[0].content, messages: [...tempConversation], timestamp: Date.now(), }); - navigate(`/prem-chat/${serviceId}/${serviceType}/${newChatId}`); + navigate(`/prem-chat/${serviceId}/${serviceType}/${newHistoryId}`); } else { - updateHistoryMessages(chatId, [...messages, ...tempConversation]); + updateHistoryMessages(historyId, [...messages, ...tempConversation]); } } // eslint-disable-next-line react-hooks/exhaustive-deps