mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Improve chats icon
This commit is contained in:
4 files changed
+60
-15
No files matched your search
@@ -13,6 +13,7 @@ interface UseAIChatSessionOptions {
|
||||
maxSteps?: number;
|
||||
onUpdateMetadata?: (title: string, description: string) => void;
|
||||
onAIError?: (error: Error) => void;
|
||||
workingDir?: string; // Optional working directory (for chats)
|
||||
}
|
||||
|
||||
interface StreamingMessage {
|
||||
@@ -32,7 +33,8 @@ export function useAIChat({
|
||||
customTools = {},
|
||||
maxSteps = 50,
|
||||
onUpdateMetadata,
|
||||
onAIError
|
||||
onAIError,
|
||||
workingDir
|
||||
}: UseAIChatSessionOptions) {
|
||||
const sessionManager = useSessionManager();
|
||||
const { isConfigured } = useAISettings();
|
||||
@@ -46,14 +48,14 @@ export function useAIChat({
|
||||
|
||||
const initSession = useCallback(async () => {
|
||||
// Load or update session
|
||||
const session = await sessionManager.loadSession(projectId, tools, customTools, maxSteps);
|
||||
const session = await sessionManager.loadSession(projectId, tools, customTools, maxSteps, workingDir);
|
||||
// Initialize individual state variables from existing session
|
||||
setMessages([...session.messages]);
|
||||
setStreamingMessage(session.streamingMessage ? { ...session.streamingMessage } : undefined);
|
||||
setIsLoading(session.isLoading);
|
||||
setTotalCost(session.totalCost || 0);
|
||||
setLastInputTokens(session.lastInputTokens || 0);
|
||||
}, [sessionManager, projectId, tools, customTools, maxSteps]);
|
||||
}, [sessionManager, projectId, tools, customTools, maxSteps, workingDir]);
|
||||
|
||||
// Initialize session
|
||||
useEffect(() => {
|
||||
|
||||
Reference in new issue
Block a user