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