Release: CI/CD Pipeline & Architecture Updates #177
@@ -66,9 +66,9 @@ export const Chat = forwardRef<ChatRef, ChatProps>(function Chat({
|
||||
clearError,
|
||||
} = useChat({
|
||||
model: "llama3.2",
|
||||
projectId: initialProjectId,
|
||||
onError: (err) => {
|
||||
console.error("Chat error:", err);
|
||||
...(initialProjectId !== undefined && { projectId: initialProjectId }),
|
||||
onError: (_err) => {
|
||||
// Error is handled by the useChat hook's state
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ export const ConversationSidebar = forwardRef<ConversationSidebarRef, Conversati
|
||||
|
||||
return {
|
||||
id: idea.id,
|
||||
title: idea.title,
|
||||
projectId: idea.projectId,
|
||||
updatedAt: idea.updatedAt,
|
||||
title: idea.title ?? null,
|
||||
projectId: idea.projectId ?? null,
|
||||
updatedAt: idea.updatedAt ?? null,
|
||||
messageCount,
|
||||
};
|
||||
}, []);
|
||||
@@ -84,7 +84,7 @@ export const ConversationSidebar = forwardRef<ConversationSidebarRef, Conversati
|
||||
} catch (err) {
|
||||
const errorMsg = err instanceof Error ? err.message : "Failed to load conversations";
|
||||
setError(errorMsg);
|
||||
console.error("Error fetching conversations:", err);
|
||||
// Error is set to state and will be displayed to the user
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
||||
@@ -173,9 +173,9 @@ export function useChat(options: UseChatOptions = {}): UseChatReturn {
|
||||
const request = {
|
||||
model,
|
||||
messages: apiMessages,
|
||||
temperature,
|
||||
maxTokens,
|
||||
systemPrompt,
|
||||
...(temperature !== undefined && { temperature }),
|
||||
...(maxTokens !== undefined && { maxTokens }),
|
||||
...(systemPrompt !== undefined && { systemPrompt }),
|
||||
};
|
||||
|
||||
// Call LLM API
|
||||
@@ -188,8 +188,8 @@ export function useChat(options: UseChatOptions = {}): UseChatReturn {
|
||||
content: response.message.content,
|
||||
createdAt: new Date().toISOString(),
|
||||
model: response.model,
|
||||
promptTokens: response.promptEvalCount,
|
||||
completionTokens: response.evalCount,
|
||||
promptTokens: response.promptEvalCount ?? 0,
|
||||
completionTokens: response.evalCount ?? 0,
|
||||
totalTokens: (response.promptEvalCount ?? 0) + (response.evalCount ?? 0),
|
||||
};
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ export async function createConversation(
|
||||
return createIdea({
|
||||
title,
|
||||
content,
|
||||
projectId,
|
||||
...(projectId !== undefined && { projectId }),
|
||||
category: "conversation",
|
||||
tags: ["chat"],
|
||||
metadata: { conversationType: "chat" },
|
||||
@@ -156,5 +156,8 @@ export async function updateConversation(
|
||||
content: string,
|
||||
title?: string
|
||||
): Promise<Idea> {
|
||||
return updateIdea(id, { content, title });
|
||||
return updateIdea(id, {
|
||||
content,
|
||||
...(title !== undefined && { title })
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user