Skip to content

Feat/ai/title #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Feat/ai/title #768

wants to merge 3 commits into from

Conversation

MrCoder
Copy link
Contributor

@MrCoder MrCoder commented Jul 16, 2025

No description provided.

MrCoder and others added 3 commits July 15, 2025 22:06
Removed the page count badge that showed 'X page(s)' next to
the title in the main header for a cleaner, more streamlined
user interface.

- Removed: span element displaying page count
- Result: Header now shows only title and edit icon
- Add AI title generation service for sequence diagrams
- Integrate OpenAI GPT-4 API for intelligent title suggestions
- Implement content analysis to infer diagram domain and context
- Add rate limiting (10 requests/minute) and 24-hour caching
- Include comprehensive fallback logic for offline/error scenarios
- Add Generate Title button in main header for authenticated users
- Track usage with Mixpanel analytics
- Support domain inference across e-commerce, auth, banking, and more

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Firebase Project ID Hardcoding and API Usage Inconsistency

The AITitleService has two issues:

  1. The local Firebase Functions emulator URL (in getFunctionUrl) hardcodes the project ID 'staging-zenuml-27954'. This prevents the AI title generation service from working correctly in local development environments if the actual Firebase project ID differs, and should instead dynamically use config.firebase.projectId for consistency and portability.
  2. The service initializes a Firebase callable function (httpsCallable) but then bypasses it, making a direct HTTP fetch request to the function URL instead, leading to inconsistent API usage.

src/services/aiTitleService.js#L21-L75

this.generateTitleFunction = this.functions.httpsCallable('generateTitle');
}
}
async generateTitle(diagramContent) {
if (!diagramContent || typeof diagramContent !== 'string') {
throw new Error('Invalid diagram content provided');
}
// Initialize Firebase if not already done
this.initializeFirebase();
// Check if user is authenticated
const user = firebase.auth().currentUser;
if (!user) {
throw new Error('User must be authenticated to generate titles');
}
try {
// Get user token for authentication
const token = await user.getIdToken();
// Call the Firebase function
const response = await fetch(this.getFunctionUrl(), {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': token
},
body: JSON.stringify({
content: diagramContent
})
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(errorData.error || `HTTP ${response.status}: ${response.statusText}`);
}
const data = await response.json();
return data.title;
} catch (error) {
console.error('AI title generation failed:', error);
// Return fallback title for better UX
return this.generateFallbackTitle(diagramContent);
}
}
getFunctionUrl() {
// Use local emulator for development
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
return 'http://localhost:5001/staging-zenuml-27954/us-central1/generateTitle';
}

Fix in CursorFix in Web


Bug: Local Debug Log Committed to Repo

A local Firestore emulator debug log file (functions/firestore-debug.log) was accidentally committed to the repository. This file is a local development artifact and should not be included in version control.

functions/firestore-debug.log#L1-L16

July 15, 2025 10:39:51 PM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer start
INFO: Started WebSocket server on ws://127.0.0.1:9150
API endpoint: http://127.0.0.1:8080
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
export FIRESTORE_EMULATOR_HOST=127.0.0.1:8080
If you are running a Firestore in Datastore Mode project, run:
export DATASTORE_EMULATOR_HOST=127.0.0.1:8080
Note: Support for Datastore Mode is in preview. If you encounter any bugs please file at https://github.com/firebase/firebase-tools/issues.
Dev App Server is now running.
*** shutting down gRPC server since JVM is shutting down
*** server shut down

Fix in CursorFix in Web


BugBot free trial expires on July 22, 2025
Learn more in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant