Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"zod": "^4.1.13"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@eslint/eslintrc": "^3.3.3",
Comment thread
JStaRFilms marked this conversation as resolved.
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/features/john-gpt/components/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const ChatInput: React.FC<ChatInputProps> = ({
input.onchange = (e) => {
const file = (e.target as HTMLInputElement).files?.[0];
if (file) {
console.log('File selected:', file);
// console.log('File selected:', file);
// TODO: Handle file upload
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/features/john-gpt/components/ChatMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export const ChatMessages = React.memo(function ChatMessages({
{message.parts?.map((part: any, index: number) => {
// AI SDK returns tool calls as parts with type 'tool-{toolName}'
if (part.type === 'tool-navigate' && part.state === 'output-available') {
console.log('🚀 [ChatMessages] Found tool-navigate part:', part);
// console.log('🚀 [ChatMessages] Found tool-navigate part:', part);
const result = part.output;

if (result.action === 'showLoginComponent') {
Expand Down Expand Up @@ -408,7 +408,7 @@ export const ChatMessages = React.memo(function ChatMessages({

// Handle unified goTo tool
if (part.type === 'tool-goTo' && part.state === 'output-available') {
console.log('🚀 [ChatMessages] Found tool-goTo part:', part);
// console.log('🚀 [ChatMessages] Found tool-goTo part:', part);
const result = part.output;

if (result.action === 'showLoginComponent') {
Expand Down
12 changes: 6 additions & 6 deletions src/features/john-gpt/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function ChatView({ user, className, conversationId: conversationIdProp,
// Small delay to allow navigation to complete first
const timeoutId = setTimeout(() => {
if (isFollowMeActive) {
console.log('[ChatView] Clearing follow-me state - arrived at full JohnGPT page');
// console.log('[ChatView] Clearing follow-me state - arrived at full JohnGPT page');
deactivateFollowMe();
}
}, 100);
Expand Down Expand Up @@ -129,7 +129,7 @@ export function ChatView({ user, className, conversationId: conversationIdProp,
if (!isModelInitialized) {
const stored = localStorage.getItem('johngpt-widget-model');
if (stored) {
console.log('[ChatView] Restored model from localStorage:', stored);
// console.log('[ChatView] Restored model from localStorage:', stored);
setSelectedModelId(stored);
fetchModelName(stored);
}
Expand Down Expand Up @@ -159,7 +159,7 @@ export function ChatView({ user, className, conversationId: conversationIdProp,
if (conversation && conversation.messages.length > 0) {
// Hydrate messages into chat
setMessages(conversation.messages as any);
console.log('[ChatView] Loaded conversation:', internalConversationId, conversation.messages.length, 'messages');
// console.log('[ChatView] Loaded conversation:', internalConversationId, conversation.messages.length, 'messages');
}
} catch (error) {
console.error('[ChatView] Failed to load conversation:', error);
Expand All @@ -177,13 +177,13 @@ export function ChatView({ user, className, conversationId: conversationIdProp,

const loadImportSession = async () => {
try {
console.log('[ChatView] Importing session:', importSessionId);
// console.log('[ChatView] Importing session:', importSessionId);
const session = await dbSyncManager.loadConversation(importSessionId, { isWidget: true });

if (session && session.messages.length > 0) {
setMessages(session.messages as any);
setIsImportBannerVisible(true);
console.log('[ChatView] Imported widget session with', session.messages.length, 'messages');
// console.log('[ChatView] Imported widget session with', session.messages.length, 'messages');
}
} catch (error) {
console.error('[ChatView] Failed to import session:', error);
Expand Down Expand Up @@ -251,7 +251,7 @@ export function ChatView({ user, className, conversationId: conversationIdProp,
const newId = crypto.randomUUID();
setInternalConversationId(newId);
currentConversationId = newId;
console.log('[ChatView] Generated new conversation ID:', newId);
// console.log('[ChatView] Generated new conversation ID:', newId);
}

// Send message first (don't block on navigation)
Expand Down
4 changes: 2 additions & 2 deletions src/features/john-gpt/components/ConversationSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function ConversationSidebar({ user, isDriveConnected, className, activeC

// Subscribe to ANY list changes (Created, Saved, Deleted)
const unsubscribe = dbSyncManager.onListChange(() => {
console.log('[ConversationSidebar] List changed, refreshing...');
// console.log('[ConversationSidebar] List changed, refreshing...');
fetchConversations();
});

Expand Down Expand Up @@ -198,7 +198,7 @@ export function ConversationSidebar({ user, isDriveConnected, className, activeC
// Use DB Sync Manager to delete (Handles Local + API + Drive)
await dbSyncManager.deleteConversation(deletingId);

console.log('[ConversationSidebar] Deleted conversation:', deletingId);
// console.log('[ConversationSidebar] Deleted conversation:', deletingId);
} catch (error) {
console.error('[ConversationSidebar] Delete failed:', error);
} finally {
Expand Down
6 changes: 3 additions & 3 deletions src/features/john-gpt/components/JohnGPTDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ function JohnGPTDialogContent({ open, onOpenChange, user, followMeConversationId
try {
const conversation = await dbSyncManager.loadConversation(followMeConversationId);
if (conversation && conversation.messages.length > 0) {
console.log('[JohnGPTDialog] Loading follow-me conversation:', followMeConversationId, 'with', conversation.messages.length, 'messages');
// console.log('[JohnGPTDialog] Loading follow-me conversation:', followMeConversationId, 'with', conversation.messages.length, 'messages');
setMessages(conversation.messages as any);
}
} catch (error) {
console.error('[JohnGPTDialog] Failed to load follow-me conversation:', error);
}
} else if (!isPersistenceLoading && initialMessages.length > 0 && messages.length === 0) {
console.log('[JohnGPTDialog] Loading', initialMessages.length, 'messages from IndexedDB');
// console.log('[JohnGPTDialog] Loading', initialMessages.length, 'messages from IndexedDB');
setMessages(initialMessages);
}
};
Expand Down Expand Up @@ -140,7 +140,7 @@ function JohnGPTDialogContent({ open, onOpenChange, user, followMeConversationId
React.useEffect(() => {
const storedModelId = localStorage.getItem('johngpt-widget-model');
if (storedModelId) {
console.log('[JohnGPTDialog] Inherited model from localStorage:', storedModelId);
// console.log('[JohnGPTDialog] Inherited model from localStorage:', storedModelId);
setInheritedModelId(storedModelId);
}
}, []);
Expand Down
6 changes: 3 additions & 3 deletions src/features/john-gpt/context/ActiveChatContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function ActiveChatProvider({ children }: { children: React.ReactNode })
if (stored) {
const parsed = JSON.parse(stored) as ActiveChatState;
setState(parsed);
console.log('[ActiveChatContext] Hydrated follow-me state:', parsed);
// console.log('[ActiveChatContext] Hydrated follow-me state:', parsed);
}
} catch (error) {
console.warn('[ActiveChatContext] Failed to hydrate state:', error);
Expand All @@ -70,7 +70,7 @@ export function ActiveChatProvider({ children }: { children: React.ReactNode })
}, [state]);

const activateFollowMe = useCallback((conversationId: string, userId: string) => {
console.log('[ActiveChatContext] Activating follow-me mode:', { conversationId, userId });
// console.log('[ActiveChatContext] Activating follow-me mode:', { conversationId, userId });
setState({
conversationId,
isFollowMeMode: true,
Expand All @@ -79,7 +79,7 @@ export function ActiveChatProvider({ children }: { children: React.ReactNode })
}, []);

const deactivateFollowMe = useCallback(() => {
console.log('[ActiveChatContext] Deactivating follow-me mode');
// console.log('[ActiveChatContext] Deactivating follow-me mode');
setState({
conversationId: null,
isFollowMeMode: false,
Expand Down
8 changes: 4 additions & 4 deletions src/features/john-gpt/context/ChatActionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function ChatActionProvider({ children }: { children: ReactNode }) {
useEffect(() => {
const spotlight = searchParams.get('spotlight');
if (spotlight) {
console.log('✨ [ChatActionContext] Spotlight param detected:', spotlight);
// console.log('✨ [ChatActionContext] Spotlight param detected:', spotlight);

// Clean up the URL by removing the spotlight param
const newUrl = new URL(window.location.href);
Expand Down Expand Up @@ -97,7 +97,7 @@ export function ChatActionProvider({ children }: { children: ReactNode }) {
}, []);

const navigateTo = useCallback((url: string, options?: { isMobile?: boolean }) => {
console.log('🚀 [ChatActionContext] navigateTo called with:', url);
// console.log('🚀 [ChatActionContext] navigateTo called with:', url);
const isMobile = options?.isMobile ?? (typeof window !== 'undefined' && window.innerWidth < 768);

// Minimize chat to show the page being navigated to
Expand All @@ -109,7 +109,7 @@ export function ChatActionProvider({ children }: { children: ReactNode }) {
}));

// Navigate to the URL - use router.push for client-side navigation (preserves state)
console.log('🚀 [ChatActionContext] Navigating to:', url);
// console.log('🚀 [ChatActionContext] Navigating to:', url);

// Use requestAnimationFrame to ensure state updates settle before navigation
requestAnimationFrame(() => {
Expand All @@ -128,7 +128,7 @@ export function ChatActionProvider({ children }: { children: ReactNode }) {
const scrollToSection = useCallback((sectionId: string) => {
const element = document.getElementById(sectionId);
if (element) {
console.log('✨ [ChatActionContext] Scrolling to section:', sectionId);
// console.log('✨ [ChatActionContext] Scrolling to section:', sectionId);

// 1. Scroll to element
element.scrollIntoView({ behavior: 'smooth', block: 'start' });
Expand Down
16 changes: 8 additions & 8 deletions src/features/john-gpt/hooks/useBranchingChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function useBranchingChat(options: UseBranchingChatOptions = {}) {
const [currentMode, setCurrentMode] = useState<string | null>(null);

// 2. Initialize useChat with currentPath for navigation context
console.log('[useBranchingChat] Options received:', { body: options.body, api: options.api, currentPath: pathname });
// console.log('[useBranchingChat] Options received:', { body: options.body, api: options.api, currentPath: pathname });

const chatHelpers = useChat({
...options,
Expand All @@ -76,7 +76,7 @@ export function useBranchingChat(options: UseBranchingChatOptions = {}) {
case 'navigate':
// Navigate to page with spotlight effect
setTimeout(() => {
console.log('[goTo] Navigating to:', result.url);
// console.log('[goTo] Navigating to:', result.url);
// Add spotlight=page param to trigger page glow on arrival
const separator = result.url.includes('?') ? '&' : '?';
router.push(`${result.url}${separator}spotlight=page`);
Expand All @@ -87,7 +87,7 @@ export function useBranchingChat(options: UseBranchingChatOptions = {}) {
// Scroll to section on current page
if (result.sectionId && scrollFn) {
setTimeout(() => {
console.log('[goTo] Scrolling to:', result.sectionId);
// console.log('[goTo] Scrolling to:', result.sectionId);
scrollFn(result.sectionId);
}, 500);
}
Expand All @@ -96,7 +96,7 @@ export function useBranchingChat(options: UseBranchingChatOptions = {}) {
case 'navigateAndScroll':
// Navigate to page, then scroll to section
setTimeout(() => {
console.log('[goTo] Navigate + Scroll:', result.url, result.sectionId);
// console.log('[goTo] Navigate + Scroll:', result.url, result.sectionId);
// Add spotlight param with section ID
const sep = result.url.includes('?') ? '&' : '?';
router.push(`${result.url}${sep}spotlight=${result.sectionId}`);
Expand Down Expand Up @@ -141,7 +141,7 @@ export function useBranchingChat(options: UseBranchingChatOptions = {}) {
if (lastMessage.role === 'assistant' && (lastMessage as any).metadata) {
const mode = (lastMessage as any).metadata.mode;
if (mode) {
console.log('[useBranchingChat] Found mode in metadata:', mode);
// console.log('[useBranchingChat] Found mode in metadata:', mode);
setCurrentMode(mode);
}
}
Expand Down Expand Up @@ -290,7 +290,7 @@ export function useBranchingChat(options: UseBranchingChatOptions = {}) {
}
);

console.log('[useBranchingChat] Conversation saved to IndexedDB:', conversationId);
// console.log('[useBranchingChat] Conversation saved to IndexedDB:', conversationId);
} catch (error) {
console.error('[useBranchingChat] Save failed:', error);
}
Expand All @@ -308,7 +308,7 @@ export function useBranchingChat(options: UseBranchingChatOptions = {}) {

const generateTitle = async () => {
try {
console.log('[useBranchingChat] Generating AI title after 6 messages...');
// console.log('[useBranchingChat] Generating AI title after 6 messages...');

// Convert messages to API format
const messagesToSend = messages.map((msg: any) => ({
Expand All @@ -329,7 +329,7 @@ export function useBranchingChat(options: UseBranchingChatOptions = {}) {
}

const { title } = await res.json();
console.log('[useBranchingChat] AI-generated title:', title);
// console.log('[useBranchingChat] AI-generated title:', title);

// Update via SyncManager
const messagesToSave = messages.map((msg: any) => {
Expand Down
8 changes: 4 additions & 4 deletions src/features/john-gpt/hooks/useWidgetPersistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function useWidgetPersistence(

// Check if IndexedDB is supported
if (!indexedDBClient || typeof indexedDB === 'undefined') {
console.log('[useWidgetPersistence] IndexedDB not supported');
// console.log('[useWidgetPersistence] IndexedDB not supported');
setIsLoading(false);
return;
}
Expand All @@ -123,10 +123,10 @@ export function useWidgetPersistence(
const cachedSession = await dbSyncManager.loadConversation(sessionId, { isWidget: true });

if (cachedSession && cachedSession.messages && cachedSession.messages.length > 0) {
console.log('[useWidgetPersistence] Loaded session:', sessionId, 'with', cachedSession.messages.length, 'messages');
// console.log('[useWidgetPersistence] Loaded session:', sessionId, 'with', cachedSession.messages.length, 'messages');
setInitialMessages(cachedSession.messages);
} else {
console.log('[useWidgetPersistence] No existing session found for:', sessionId);
// console.log('[useWidgetPersistence] No existing session found for:', sessionId);
}
} catch (error) {
console.error('[useWidgetPersistence] Error loading session:', error);
Expand All @@ -143,7 +143,7 @@ export function useWidgetPersistence(
try {
await dbSyncManager.deleteConversation(sessionId);
setInitialMessages([]);
console.log('[useWidgetPersistence] Session cleared:', sessionId);
// console.log('[useWidgetPersistence] Session cleared:', sessionId);
} catch (error) {
console.error('[useWidgetPersistence] Error clearing session:', error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/john-gpt/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const JohnGPTFeature = ({ user }: { user?: WorkOSUser | null }) => {
useEffect(() => {
if (isFollowMeMode && !isOpen) {
// Don't auto-open, but the button will pulse to indicate active chat
console.log('[JohnGPTFeature] Follow-me mode active, conversation:', activeChat?.state.conversationId);
// console.log('[JohnGPTFeature] Follow-me mode active, conversation:', activeChat?.state.conversationId);
}
}, [isFollowMeMode, isOpen, activeChat?.state.conversationId]);

Expand Down
6 changes: 3 additions & 3 deletions src/lib/storage/db-sync-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class DBSyncManager {
// Authenticated if userId exists AND is not anonymous
this.isAuthenticated = !!userId && !userId.startsWith('anonymous-');

console.log(`[DBSyncManager] Initialized. User: ${userId || 'Guest'} (Auth: ${this.isAuthenticated}), Online: ${this.isOnline}`);
// console.log(`[DBSyncManager] Initialized. User: ${userId || 'Guest'} (Auth: ${this.isAuthenticated}), Online: ${this.isOnline}`);

if (this.isAuthenticated && this.isOnline) {
this.processOfflineQueue();
Expand All @@ -111,7 +111,7 @@ export class DBSyncManager {
const { accessToken } = await res.json();
googleDriveClient.setAccessToken(accessToken);
this.isDriveConnected = true;
console.log('[DBSyncManager] Google Drive connected');
// console.log('[DBSyncManager] Google Drive connected');
return true;
} catch (error) {
console.warn('[DBSyncManager] Failed to initialize Google Drive:', error);
Expand Down Expand Up @@ -141,7 +141,7 @@ export class DBSyncManager {
};

await googleDriveClient.saveConversation(driveData);
console.log(`[DBSyncManager] Backed up ${conversationId} to Drive`);
// console.log(`[DBSyncManager] Backed up ${conversationId} to Drive`);
} catch (error) {
console.error('[DBSyncManager] Drive backup failed:', error);
}
Expand Down