@tpitre/story-ui 2.1.4 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpitre/story-ui",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "AI-powered Storybook story generator with dynamic component discovery",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -145,15 +145,33 @@ const syncWithActualStories = async (): Promise<ChatSession[]> => {
145
145
  // Delete story and chat
146
146
  const deleteStoryAndChat = async (chatId: string): Promise<boolean> => {
147
147
  try {
148
+ // Remove .stories.tsx extension if present to get the actual story ID
149
+ const storyId = chatId.replace(/\.stories\.tsx$/, '');
150
+ console.log(`Attempting to delete story: chatId="${chatId}", storyId="${storyId}"`);
151
+
148
152
  // First try to delete from backend
149
- const response = await fetch(`${DELETE_API_BASE}/${chatId}`, {
153
+ const response = await fetch(`${DELETE_API_BASE}/${storyId}`, {
150
154
  method: 'DELETE',
151
155
  headers: { 'Content-Type': 'application/json' }
152
156
  });
153
157
 
154
158
  if (!response.ok) {
155
- console.error('Failed to delete story from backend');
156
- return false;
159
+ console.error('Failed to delete story from backend, trying legacy endpoint');
160
+
161
+ // Try legacy endpoint as fallback
162
+ const legacyResponse = await fetch(`http://localhost:${getApiPort()}/story-ui/delete`, {
163
+ method: 'POST',
164
+ headers: { 'Content-Type': 'application/json' },
165
+ body: JSON.stringify({
166
+ chatId: storyId,
167
+ storyId: storyId
168
+ })
169
+ });
170
+
171
+ if (!legacyResponse.ok) {
172
+ console.error('Legacy delete endpoint also failed');
173
+ return false;
174
+ }
157
175
  }
158
176
 
159
177
  // Check if response is JSON