@iota-uz/sdk 0.3.2 → 0.3.3

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.
@@ -60,292 +60,11 @@ var init_IotaContext = __esm({
60
60
  }
61
61
  });
62
62
 
63
- // ui/src/bichat/locales/defaults.ts
64
- var defaultTranslations;
65
- var init_defaults = __esm({
66
- "ui/src/bichat/locales/defaults.ts"() {
67
- defaultTranslations = {
68
- // Welcome screen
69
- "welcome.title": "Welcome to BiChat",
70
- "welcome.description": "Your intelligent business analytics assistant. Ask questions about your data, generate reports, or explore insights.",
71
- "welcome.tryAsking": "Try asking",
72
- "welcome.quickStart": "Quick Start",
73
- "welcome.disclaimer": "BiChat is powered by AI. Mistakes are possible.",
74
- // Chat header
75
- "chat.newChat": "New Chat",
76
- "chat.archived": "Archived",
77
- "chat.readOnly": "Read-only",
78
- "chat.pinned": "Pinned",
79
- "chat.goBack": "Go back",
80
- // Artifacts panel
81
- "artifacts.title": "Artifacts",
82
- "artifacts.loading": "Loading artifacts...",
83
- "artifacts.empty": "No artifacts yet",
84
- "artifacts.back": "Back",
85
- "artifacts.refresh": "Refresh",
86
- "artifacts.loadMore": "Load more",
87
- "artifacts.loadingMore": "Loading more...",
88
- "artifacts.toggleShow": "Show artifacts",
89
- "artifacts.toggleHide": "Hide artifacts",
90
- "artifacts.resize": "Resize panel",
91
- "artifacts.failedToLoad": "Failed to load artifacts",
92
- "artifacts.unsupported": "Artifacts panel is not available for this data source.",
93
- "artifacts.download": "Download",
94
- "artifacts.openInNewTab": "Open in new tab",
95
- "artifacts.downloadUnavailable": "Download URL is not available for this artifact.",
96
- "artifacts.imageUnavailable": "Image URL is not available for this artifact.",
97
- "artifacts.chartUnavailable": "Chart metadata is not in a renderable format.",
98
- "artifacts.previewLoading": "Loading preview...",
99
- "artifacts.previewUnavailable": "Preview is unavailable for this artifact.",
100
- "artifacts.previewNotSupported": "This file type cannot be previewed inline.",
101
- "artifacts.officePreviewUnavailable": "Office preview is unavailable. Open or download the file.",
102
- "artifacts.textPreviewFailed": "Failed to load text preview.",
103
- "artifacts.textPreviewTruncated": "Preview is truncated. Open the file to view full content.",
104
- "artifacts.rename": "Rename artifact",
105
- "artifacts.renameFailed": "Failed to rename artifact",
106
- "artifacts.delete": "Delete artifact",
107
- "artifacts.deleteConfirm": "Delete this uploaded artifact? This action cannot be undone.",
108
- "artifacts.deleteFailed": "Failed to delete artifact",
109
- "artifacts.metadata": "Metadata",
110
- "artifacts.typeLabel": "Type",
111
- "artifacts.mimeTypeLabel": "MIME type",
112
- "artifacts.sizeLabel": "Size",
113
- "artifacts.createdLabel": "Created",
114
- "artifacts.emptySubtitle": "Artifacts will appear here as you chat",
115
- "artifacts.groupCharts": "Charts",
116
- "artifacts.groupCodeOutputs": "Code Outputs",
117
- "artifacts.groupExports": "Exports",
118
- "artifacts.groupAttachments": "Attachments",
119
- "artifacts.groupOther": "Other",
120
- // Message input
121
- "input.placeholder": "Type a message...",
122
- "input.attachFiles": "Attach files",
123
- "input.attachImages": "Attach files",
124
- "input.dropImages": "Drop files here",
125
- "input.dropFiles": "Drop files here",
126
- "input.sendMessage": "Send message",
127
- "input.aiThinking": "AI is thinking...",
128
- "input.processing": "Processing...",
129
- "input.messagesQueued": "{count} message(s) queued",
130
- "input.filesAdded": "Files added successfully",
131
- "input.dismissError": "Dismiss error",
132
- "input.shiftEnterHint": "Shift + Enter for new line",
133
- "input.fileInput": "File input",
134
- "input.messageInput": "Message input",
135
- "slash.commandsList": "Slash commands",
136
- "slash.clearDescription": "Clear current chat history in place",
137
- "slash.debugDescription": "Toggle developer debug mode for this session",
138
- "slash.compactDescription": "Compact history into a concise summary",
139
- "slash.noMatches": "No matching slash command",
140
- "slash.debugBadge": "Debug mode ON",
141
- "slash.compactingTitle": "Compacting history",
142
- "slash.compactingSubtitle": "Summarizing previous turns and pruning tool traces...",
143
- "slash.compactedSummaryLabel": "Compacted Summary",
144
- "slash.debugPanelTitle": "Debug Trace",
145
- "slash.debugGeneration": "Generation time",
146
- "slash.debugTokensPerSecond": "Tokens/sec",
147
- "slash.debugUnavailable": "No persisted debug trace is available for this turn.",
148
- "slash.debugContextUsage": "Current context usage",
149
- "slash.debugContextWindow": "Model context window",
150
- "slash.debugPolicyMaxContextWindow": "Policy Max",
151
- "slash.debugModelMaxContextWindow": "Model Max",
152
- "slash.debugEffectiveContextWindow": "Effective Max",
153
- "slash.debugSessionUsageUnavailable": "Session usage will appear after the first debug response.",
154
- "slash.debugCopyTrace": "Copy trace",
155
- "slash.debugCopied": "Copied!",
156
- "slash.debugToolCalls": "Tool calls",
157
- "slash.debugArguments": "Arguments",
158
- "slash.debugResult": "Result",
159
- "slash.debugCachedTokens": "Cached",
160
- "slash.debugPromptTokens": "Prompt",
161
- "slash.debugCompletionTokens": "Completion",
162
- "slash.debugTotalTokens": "Total",
163
- "slash.debugError": "Error",
164
- "slash.error.noArguments": "This slash command does not accept arguments yet.",
165
- "slash.error.sessionRequired": "Create or open a chat session before using this command.",
166
- "slash.error.debugUnauthorized": "You do not have permission to enable debug mode.",
167
- "slash.error.unknownCommand": "Unknown slash command.",
168
- "slash.error.noAttachments": "Slash commands cannot be used with attachments.",
169
- "slash.error.clearFailed": "Failed to clear session history.",
170
- "slash.error.compactFailed": "Failed to compact session history.",
171
- // Message actions
172
- "message.copy": "Copy",
173
- "message.copied": "Copied!",
174
- "message.regenerate": "Regenerate",
175
- "message.edit": "Edit",
176
- "message.save": "Save",
177
- "message.cancel": "Cancel",
178
- // Assistant turn
179
- "assistant.thinking": "Thinking...",
180
- "assistant.toolCall": "Using tool: {name}",
181
- "assistant.generating": "Generating response...",
182
- "assistant.explanation": "How I arrived at this",
183
- // System message
184
- "system.conversationSummary": "Conversation summary",
185
- "system.loadingSummary": "Loading summary...",
186
- "system.showMore": "Show more",
187
- "system.showLess": "Show less",
188
- // Question form
189
- "question.submit": "Submit",
190
- "question.selectOne": "Select one option",
191
- "question.selectMulti": "Select one or more options",
192
- "question.required": "This field is required",
193
- "question.other": "Other",
194
- "question.specifyOther": "Please specify",
195
- // Errors
196
- "error.generic": "Something went wrong",
197
- "error.networkError": "Network error. Please try again.",
198
- "error.sessionExpired": "Session expired. Please refresh.",
199
- "error.fileTooLarge": "File is too large",
200
- "error.invalidFile": "Invalid file type",
201
- "error.maxFiles": "Maximum {max} files allowed",
202
- // Empty states
203
- "empty.noMessages": "No messages yet",
204
- "empty.noSessions": "No chat sessions",
205
- "empty.startChat": "Start a new chat to begin",
206
- // Sources panel
207
- "sources.title": "Sources",
208
- "sources.viewMore": "View more",
209
- "sources.citations": "{count} citation(s)",
210
- // Code outputs
211
- "codeOutputs.title": "Code Outputs",
212
- "codeOutputs.download": "Download",
213
- "codeOutputs.expand": "Expand",
214
- "codeOutputs.collapse": "Collapse",
215
- // Charts
216
- "chart.download": "Download chart",
217
- "chart.downloadPNG": "Download PNG",
218
- "chart.exporting": "Exporting...",
219
- "chart.fullscreen": "View fullscreen",
220
- "chart.noData": "No data available for chart visualization.",
221
- // Example prompt categories
222
- "category.analysis": "Data Analysis",
223
- "category.reports": "Reports",
224
- "category.insights": "Insights",
225
- // Sidebar
226
- "sidebar.chatSessions": "Chat Sessions",
227
- "sidebar.closeSidebar": "Close sidebar",
228
- "sidebar.searchChats": "Search chats...",
229
- "sidebar.createNewChat": "Create new chat",
230
- "sidebar.archivedChats": "Archived Chats",
231
- "sidebar.pinnedChats": "Pinned Chats",
232
- "sidebar.chatOptions": "Chat options",
233
- "sidebar.myChats": "My Chats",
234
- "sidebar.allChats": "All Chats",
235
- "sidebar.chatViewSelector": "Chat view selector",
236
- "sidebar.pinChat": "Pin chat",
237
- "sidebar.unpinChat": "Unpin chat",
238
- "sidebar.pin": "Pin",
239
- "sidebar.unpin": "Unpin",
240
- "sidebar.renameChat": "Rename chat",
241
- "sidebar.archiveChat": "Archive chat",
242
- "sidebar.deleteChat": "Delete chat",
243
- "sidebar.regenerateTitle": "Regenerate title",
244
- "sidebar.noChatsFound": 'No chats found for "{query}"',
245
- "sidebar.noChatsYet": "No chats yet",
246
- "sidebar.createOneToGetStarted": "Create one to get started",
247
- "sidebar.failedToLoadSessions": "Failed to load sessions",
248
- "sidebar.chatRenamedSuccessfully": "Chat renamed successfully",
249
- "sidebar.failedToRenameChat": "Failed to rename chat",
250
- "sidebar.titleRegenerated": "Title regenerated",
251
- "sidebar.failedToRegenerateTitle": "Failed to regenerate title",
252
- "sidebar.chatPinned": "Chat pinned",
253
- "sidebar.chatUnpinned": "Chat unpinned",
254
- "sidebar.failedToTogglePin": "Failed to toggle pin",
255
- "sidebar.archiveChatSession": "Archive Chat Session",
256
- "sidebar.archiveChatMessage": "Are you sure you want to archive this chat? You can restore it later from Archived Chats.",
257
- "sidebar.archiveButton": "Archive",
258
- "sidebar.deleteChatSession": "Delete Chat Session",
259
- "sidebar.deleteChatMessage": "Are you sure you want to delete this chat? This action cannot be undone.",
260
- "sidebar.deleteButton": "Delete",
261
- "sidebar.chatArchived": "Chat archived",
262
- "sidebar.failedToArchiveChat": "Failed to archive chat",
263
- "sidebar.chatDeleted": "Chat deleted",
264
- "sidebar.failedToDeleteChat": "Failed to delete chat",
265
- // Archived chats
266
- "archived.title": "Archived Chats",
267
- "archived.backToChats": "Back to chats",
268
- "archived.searchArchivedChats": "Search archived chats...",
269
- "archived.noArchivedChats": "No archived chats",
270
- "archived.noArchivedChatsDescription": "Archived chats will appear here",
271
- "archived.noResults": "No results found",
272
- "archived.noResultsDescription": 'No chats match "{query}"',
273
- "archived.restoreChat": "Restore Chat",
274
- "archived.restoreChatMessage": "Are you sure you want to restore this chat?",
275
- "archived.restoreButton": "Restore",
276
- "archived.chatRestoredSuccessfully": "Chat restored successfully",
277
- "archived.failedToRestoreChat": "Failed to restore chat",
278
- // All chats (organization-wide)
279
- "allChats.includeArchived": "Include archived",
280
- "allChats.chatFound": "{count} chat found",
281
- "allChats.chatsFound": "{count} chats found",
282
- "allChats.organizationChats": "Organization chats",
283
- "allChats.loadMore": "Load more",
284
- "allChats.noChatsFound": "No chats found",
285
- "allChats.noChatsFromUser": "No chats from {firstName} {lastName}",
286
- "allChats.noChatsInOrg": "No chats in organization",
287
- "allChats.noActiveChatsInOrg": "No active chats in organization",
288
- "allChats.failedToLoad": "Failed to load chats",
289
- "allChats.allUsers": "All users",
290
- "allChats.loadingUsers": "Loading users...",
291
- // Alert component
292
- "alert.retry": "Retry",
293
- "alert.dismiss": "Dismiss",
294
- // Retry / stream errors
295
- "retry.title": "No response received",
296
- "retry.description": "The assistant did not respond. Try sending again.",
297
- "retry.button": "Retry",
298
- "streamError.retry": "Retry",
299
- "streamError.regenerate": "Regenerate",
300
- // Attachment upload
301
- "attachment.selectFiles": "Select files",
302
- "attachment.uploading": "Uploading...",
303
- "attachment.maxReached": "Maximum {max} attachments",
304
- "attachment.fileAdded": "{count} file(s) added",
305
- "attachment.invalidFile": "Invalid file: {filename}",
306
- // Question form wizard
307
- "questionForm.title": "Questions",
308
- "questionForm.step": "Step {current} of {total}",
309
- "questionForm.back": "Back",
310
- "questionForm.next": "Next",
311
- "questionForm.confirm": "Confirm & Submit",
312
- "questionForm.submitting": "Submitting...",
313
- "questionForm.reviewTitle": "Review Your Answers",
314
- "questionForm.reviewDescription": "Please review your answers before submitting.",
315
- "questionForm.skip": "Skip",
316
- // Date grouping
317
- "dateGroup.today": "Today",
318
- "dateGroup.yesterday": "Yesterday",
319
- "dateGroup.last7Days": "Last 7 days",
320
- "dateGroup.last30Days": "Last 30 days",
321
- "dateGroup.older": "Older",
322
- // Relative time
323
- "relativeTime.justNow": "Just now",
324
- "relativeTime.minutesAgo": "{count}m ago",
325
- "relativeTime.hoursAgo": "{count}h ago",
326
- "relativeTime.daysAgo": "{count}d ago",
327
- // Common
328
- "common.pinned": "Pinned",
329
- "common.back": "Back",
330
- "common.clear": "Clear",
331
- "common.generating": "Generating...",
332
- "common.dismiss": "Dismiss",
333
- "common.close": "Close",
334
- "common.loading": "Loading...",
335
- "common.cancel": "Cancel",
336
- "common.untitled": "Untitled",
337
- "common.skipToContent": "Skip to content",
338
- // Skip link
339
- "skipLink.label": "Skip to content"
340
- };
341
- }
342
- });
343
-
344
63
  // ui/src/bichat/hooks/useTranslation.ts
345
64
  function useTranslation() {
346
65
  const { locale } = useIotaContext();
347
66
  const t = (key2, params) => {
348
- let text = locale.translations[key2] || defaultTranslations[key2] || key2;
67
+ let text = locale.translations[key2] || key2;
349
68
  if (params) {
350
69
  Object.keys(params).forEach((paramKey) => {
351
70
  const value = params[paramKey];
@@ -362,7 +81,6 @@ function useTranslation() {
362
81
  var init_useTranslation = __esm({
363
82
  "ui/src/bichat/hooks/useTranslation.ts"() {
364
83
  init_IotaContext();
365
- init_defaults();
366
84
  }
367
85
  });
368
86
  function ChartCard({ chartData }) {
@@ -8183,17 +7901,14 @@ function Sidebar2({
8183
7901
  React.useEffect(() => {
8184
7902
  fetchSessions();
8185
7903
  }, [fetchSessions, refreshKey]);
8186
- const sessionsKey = React.useMemo(
8187
- () => sessions.map((s) => `${s.id}:${s.title || ""}`).join(","),
8188
- [sessions]
8189
- );
8190
- React.useEffect(() => {
8191
- if (!Array.isArray(sessions) || sessions.length === 0) return;
7904
+ const sessionsRef = React.useRef(sessions);
7905
+ sessionsRef.current = sessions;
7906
+ const hasPlaceholderTitles = React.useMemo(() => {
8192
7907
  const newChatLabel = t("chat.newChat");
8193
- const sessionsWithPlaceholderTitles = sessions.filter(
8194
- (s) => s && (!s.title || s.title === newChatLabel)
8195
- );
8196
- if (sessionsWithPlaceholderTitles.length === 0) return;
7908
+ return sessions.some((s) => s && (!s.title || s.title === newChatLabel));
7909
+ }, [sessions, t]);
7910
+ React.useEffect(() => {
7911
+ if (!hasPlaceholderTitles) return;
8197
7912
  const pollInterval = 2e3;
8198
7913
  const maxPolls = 5;
8199
7914
  let pollCount = 0;
@@ -8203,13 +7918,15 @@ function Sidebar2({
8203
7918
  const result = await dataSource.listSessions({ limit: 50 });
8204
7919
  setSessions(result.sessions);
8205
7920
  } catch {
7921
+ clearInterval(intervalId);
7922
+ return;
8206
7923
  }
8207
7924
  if (pollCount >= maxPolls) {
8208
7925
  clearInterval(intervalId);
8209
7926
  }
8210
7927
  }, pollInterval);
8211
7928
  return () => clearInterval(intervalId);
8212
- }, [sessionsKey, dataSource, sessions, t]);
7929
+ }, [hasPlaceholderTitles, dataSource]);
8213
7930
  const handleArchiveRequest = (sessionId) => {
8214
7931
  setSessionToArchive(sessionId);
8215
7932
  setShowConfirm(true);