-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
base: master
Are you sure you want to change the base?
Feat/ai/title #768
Conversation
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]>
There was a problem hiding this 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:
- 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 useconfig.firebase.projectId
for consistency and portability. - The service initializes a Firebase callable function (
httpsCallable
) but then bypasses it, making a direct HTTPfetch
request to the function URL instead, leading to inconsistent API usage.
src/services/aiTitleService.js#L21-L75
web-sequence/src/services/aiTitleService.js
Lines 21 to 75 in da397c3
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'; | |
} |
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
web-sequence/functions/firestore-debug.log
Lines 1 to 16 in da397c3
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 |
BugBot free trial expires on July 22, 2025
Learn more in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
No description provided.