@iota-uz/sdk 0.4.26 → 0.4.28
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/README.md +5 -3
- package/dist/bichat/index.cjs +143 -63
- package/dist/bichat/index.cjs.map +1 -1
- package/dist/bichat/index.d.cts +3 -0
- package/dist/bichat/index.d.ts +3 -0
- package/dist/bichat/index.mjs +143 -63
- package/dist/bichat/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bichat/index.d.cts
CHANGED
|
@@ -654,6 +654,7 @@ interface ChatSessionStateValue {
|
|
|
654
654
|
sessionDebugUsage: SessionDebugUsage;
|
|
655
655
|
debugLimits: DebugLimits | null;
|
|
656
656
|
reasoningEffort: string | undefined;
|
|
657
|
+
reasoningEffortOptions: string[] | undefined;
|
|
657
658
|
setError: (error: string | null) => void;
|
|
658
659
|
retryFetchSession: () => void;
|
|
659
660
|
setReasoningEffort: (effort: string) => void;
|
|
@@ -3871,6 +3872,7 @@ interface SessionSnapshot {
|
|
|
3871
3872
|
sessionDebugUsage: SessionDebugUsage;
|
|
3872
3873
|
debugLimits: DebugLimits | null;
|
|
3873
3874
|
reasoningEffort: string | undefined;
|
|
3875
|
+
reasoningEffortOptions: string[] | undefined;
|
|
3874
3876
|
setError: (error: string | null) => void;
|
|
3875
3877
|
retryFetchSession: () => void;
|
|
3876
3878
|
setReasoningEffort: (effort: string) => void;
|
|
@@ -3952,6 +3954,7 @@ declare class ChatMachine {
|
|
|
3952
3954
|
private fetchCancelled;
|
|
3953
3955
|
private disposed;
|
|
3954
3956
|
private reasoningEffortOptions;
|
|
3957
|
+
private reasoningEffortOptionSet;
|
|
3955
3958
|
/** Memoized sessionDebugUsage — avoids unnecessary session re-renders during streaming. */
|
|
3956
3959
|
private lastSessionDebugUsage;
|
|
3957
3960
|
/** Interval handle for passive polling when another tab has an active stream. */
|
package/dist/bichat/index.d.ts
CHANGED
|
@@ -654,6 +654,7 @@ interface ChatSessionStateValue {
|
|
|
654
654
|
sessionDebugUsage: SessionDebugUsage;
|
|
655
655
|
debugLimits: DebugLimits | null;
|
|
656
656
|
reasoningEffort: string | undefined;
|
|
657
|
+
reasoningEffortOptions: string[] | undefined;
|
|
657
658
|
setError: (error: string | null) => void;
|
|
658
659
|
retryFetchSession: () => void;
|
|
659
660
|
setReasoningEffort: (effort: string) => void;
|
|
@@ -3871,6 +3872,7 @@ interface SessionSnapshot {
|
|
|
3871
3872
|
sessionDebugUsage: SessionDebugUsage;
|
|
3872
3873
|
debugLimits: DebugLimits | null;
|
|
3873
3874
|
reasoningEffort: string | undefined;
|
|
3875
|
+
reasoningEffortOptions: string[] | undefined;
|
|
3874
3876
|
setError: (error: string | null) => void;
|
|
3875
3877
|
retryFetchSession: () => void;
|
|
3876
3878
|
setReasoningEffort: (effort: string) => void;
|
|
@@ -3952,6 +3954,7 @@ declare class ChatMachine {
|
|
|
3952
3954
|
private fetchCancelled;
|
|
3953
3955
|
private disposed;
|
|
3954
3956
|
private reasoningEffortOptions;
|
|
3957
|
+
private reasoningEffortOptionSet;
|
|
3955
3958
|
/** Memoized sessionDebugUsage — avoids unnecessary session re-renders during streaming. */
|
|
3956
3959
|
private lastSessionDebugUsage;
|
|
3957
3960
|
/** Interval handle for passive polling when another tab has an active stream. */
|
package/dist/bichat/index.mjs
CHANGED
|
@@ -1818,7 +1818,11 @@ function readReasoningEffortOptionsFromGlobalContext() {
|
|
|
1818
1818
|
if (!Array.isArray(opts) || opts.length === 0) {
|
|
1819
1819
|
return void 0;
|
|
1820
1820
|
}
|
|
1821
|
-
|
|
1821
|
+
const filtered = opts.filter((o) => typeof o === "string");
|
|
1822
|
+
if (filtered.length === 0) {
|
|
1823
|
+
return void 0;
|
|
1824
|
+
}
|
|
1825
|
+
return filtered;
|
|
1822
1826
|
}
|
|
1823
1827
|
|
|
1824
1828
|
// ui/src/bichat/machine/selectors.ts
|
|
@@ -1837,6 +1841,7 @@ function deriveSessionSnapshot(state, methods) {
|
|
|
1837
1841
|
sessionDebugUsage: getSessionDebugUsage(state.messaging.turns),
|
|
1838
1842
|
debugLimits: state.session.debugLimits,
|
|
1839
1843
|
reasoningEffort: state.session.reasoningEffort,
|
|
1844
|
+
reasoningEffortOptions: state.session.reasoningEffortOptions,
|
|
1840
1845
|
setError: methods.setError,
|
|
1841
1846
|
retryFetchSession: methods.retryFetchSession,
|
|
1842
1847
|
setReasoningEffort: methods.setReasoningEffort
|
|
@@ -1891,6 +1896,50 @@ function deriveInputSnapshot(state, methods) {
|
|
|
1891
1896
|
};
|
|
1892
1897
|
}
|
|
1893
1898
|
|
|
1899
|
+
// ui/src/bichat/utils/assistantTurnState.ts
|
|
1900
|
+
function isEmptyAssistantTurn(turn) {
|
|
1901
|
+
if (turn.content.trim().length > 0) {
|
|
1902
|
+
return false;
|
|
1903
|
+
}
|
|
1904
|
+
if ((turn.explanation?.trim().length ?? 0) > 0) {
|
|
1905
|
+
return false;
|
|
1906
|
+
}
|
|
1907
|
+
if ((turn.citations?.length ?? 0) > 0) {
|
|
1908
|
+
return false;
|
|
1909
|
+
}
|
|
1910
|
+
if ((turn.toolCalls?.length ?? 0) > 0) {
|
|
1911
|
+
return false;
|
|
1912
|
+
}
|
|
1913
|
+
if ((turn.charts?.length ?? 0) > 0) {
|
|
1914
|
+
return false;
|
|
1915
|
+
}
|
|
1916
|
+
if ((turn.renderTables?.length ?? 0) > 0) {
|
|
1917
|
+
return false;
|
|
1918
|
+
}
|
|
1919
|
+
if ((turn.artifacts?.length ?? 0) > 0) {
|
|
1920
|
+
return false;
|
|
1921
|
+
}
|
|
1922
|
+
if ((turn.codeOutputs?.length ?? 0) > 0) {
|
|
1923
|
+
return false;
|
|
1924
|
+
}
|
|
1925
|
+
if (turn.debug) {
|
|
1926
|
+
return false;
|
|
1927
|
+
}
|
|
1928
|
+
return true;
|
|
1929
|
+
}
|
|
1930
|
+
function isPlaceholderWaitingAssistantTurn(turn) {
|
|
1931
|
+
return turn.lifecycle === "waiting_for_human_input" && isEmptyAssistantTurn(turn);
|
|
1932
|
+
}
|
|
1933
|
+
function shouldRenderInlineRetry(turn, canRegenerate) {
|
|
1934
|
+
if (!canRegenerate) {
|
|
1935
|
+
return false;
|
|
1936
|
+
}
|
|
1937
|
+
if (turn.lifecycle === "waiting_for_human_input") {
|
|
1938
|
+
return false;
|
|
1939
|
+
}
|
|
1940
|
+
return isEmptyAssistantTurn(turn);
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1894
1943
|
// ui/src/bichat/machine/hitlLifecycle.ts
|
|
1895
1944
|
function normalizeQuestionType(rawType) {
|
|
1896
1945
|
const normalized = String(rawType || "").trim().toUpperCase().replace(/[\s-]+/g, "_");
|
|
@@ -1970,6 +2019,13 @@ function applyTurnLifecycleForPendingQuestion(turns, pendingQuestion) {
|
|
|
1970
2019
|
}
|
|
1971
2020
|
};
|
|
1972
2021
|
}
|
|
2022
|
+
if (!shouldWaitForInput && isPlaceholderWaitingAssistantTurn(turn.assistantTurn)) {
|
|
2023
|
+
changed = true;
|
|
2024
|
+
return {
|
|
2025
|
+
...turn,
|
|
2026
|
+
assistantTurn: void 0
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
1973
2029
|
if (turn.assistantTurn.lifecycle === desiredLifecycle) {
|
|
1974
2030
|
return turn;
|
|
1975
2031
|
}
|
|
@@ -2030,6 +2086,7 @@ var ChatMachine = class {
|
|
|
2030
2086
|
this.fetchCancelled = false;
|
|
2031
2087
|
this.disposed = false;
|
|
2032
2088
|
this.reasoningEffortOptions = null;
|
|
2089
|
+
this.reasoningEffortOptionSet = null;
|
|
2033
2090
|
/** Memoized sessionDebugUsage — avoids unnecessary session re-renders during streaming. */
|
|
2034
2091
|
this.lastSessionDebugUsage = null;
|
|
2035
2092
|
/** Interval handle for passive polling when another tab has an active stream. */
|
|
@@ -2117,6 +2174,7 @@ var ChatMachine = class {
|
|
|
2117
2174
|
this.rateLimiter = config.rateLimiter;
|
|
2118
2175
|
this.onSessionCreated = config.onSessionCreated;
|
|
2119
2176
|
this.reasoningEffortOptions = this.buildReasoningEffortOptions();
|
|
2177
|
+
this.reasoningEffortOptionSet = this.reasoningEffortOptions ? new Set(this.reasoningEffortOptions) : null;
|
|
2120
2178
|
const initialReasoningEffort = this.sanitizeReasoningEffort(loadReasoningEffort() || void 0);
|
|
2121
2179
|
if (!initialReasoningEffort) {
|
|
2122
2180
|
clearReasoningEffort();
|
|
@@ -2130,7 +2188,8 @@ var ChatMachine = class {
|
|
|
2130
2188
|
errorRetryable: false,
|
|
2131
2189
|
debugModeBySession: {},
|
|
2132
2190
|
debugLimits: readDebugLimitsFromGlobalContext(),
|
|
2133
|
-
reasoningEffort: initialReasoningEffort
|
|
2191
|
+
reasoningEffort: initialReasoningEffort,
|
|
2192
|
+
reasoningEffortOptions: this.reasoningEffortOptions ?? void 0
|
|
2134
2193
|
},
|
|
2135
2194
|
messaging: {
|
|
2136
2195
|
turns: [],
|
|
@@ -2179,14 +2238,14 @@ var ChatMachine = class {
|
|
|
2179
2238
|
if (!options || options.length === 0) {
|
|
2180
2239
|
return null;
|
|
2181
2240
|
}
|
|
2182
|
-
return
|
|
2241
|
+
return options;
|
|
2183
2242
|
}
|
|
2184
2243
|
// Keep outbound payloads constrained to server-declared options.
|
|
2185
2244
|
sanitizeReasoningEffort(effort) {
|
|
2186
|
-
if (!effort || !this.
|
|
2245
|
+
if (!effort || !this.reasoningEffortOptionSet || this.reasoningEffortOptionSet.size === 0) {
|
|
2187
2246
|
return void 0;
|
|
2188
2247
|
}
|
|
2189
|
-
return this.
|
|
2248
|
+
return this.reasoningEffortOptionSet.has(effort) ? effort : void 0;
|
|
2190
2249
|
}
|
|
2191
2250
|
// =====================================================================
|
|
2192
2251
|
// Lifecycle
|
|
@@ -4417,7 +4476,7 @@ init_useTranslation();
|
|
|
4417
4476
|
var COPY_FEEDBACK_MS = 2e3;
|
|
4418
4477
|
var defaultClassNames = {
|
|
4419
4478
|
root: "flex gap-3 justify-end group",
|
|
4420
|
-
wrapper: "flex-1 flex flex-col items-end max-w-[var(--bichat-bubble-max-width)]",
|
|
4479
|
+
wrapper: "flex-1 min-w-0 flex flex-col items-end max-w-[var(--bichat-bubble-max-width)]",
|
|
4421
4480
|
avatar: "flex-shrink-0 w-8 h-8 rounded-full bg-primary-600 flex items-center justify-center text-white font-medium text-sm",
|
|
4422
4481
|
bubble: "bg-primary-600 text-white rounded-2xl rounded-br-sm px-4 py-3 shadow-sm",
|
|
4423
4482
|
content: "text-sm whitespace-pre-wrap break-words leading-relaxed",
|
|
@@ -5981,6 +6040,7 @@ function FullscreenOverlay({ title, onClose, closeLabel, children }) {
|
|
|
5981
6040
|
)
|
|
5982
6041
|
] });
|
|
5983
6042
|
}
|
|
6043
|
+
var FULL_WIDTH_CLASS = "w-full min-w-0 max-w-full";
|
|
5984
6044
|
function getPageNumbers(current, total) {
|
|
5985
6045
|
if (total <= 7) {
|
|
5986
6046
|
return Array.from({ length: total }, (_, i) => i + 1);
|
|
@@ -6075,6 +6135,8 @@ var InteractiveTableCard = memo(function InteractiveTableCard2({
|
|
|
6075
6135
|
const hasHiddenColumns = dt.columns.some((c) => !c.visible);
|
|
6076
6136
|
const from = dt.totalFilteredRows === 0 ? 0 : (dt.page - 1) * dt.pageSize + 1;
|
|
6077
6137
|
const to = Math.min(dt.page * dt.pageSize, dt.totalFilteredRows);
|
|
6138
|
+
const loadedRowsCount = table.rows.length;
|
|
6139
|
+
const reportedRowsCount = Math.max(table.totalRows || 0, loadedRowsCount);
|
|
6078
6140
|
const renderToolbar = () => /* @__PURE__ */ jsx(
|
|
6079
6141
|
DataTableToolbar,
|
|
6080
6142
|
{
|
|
@@ -6095,9 +6157,12 @@ var InteractiveTableCard = memo(function InteractiveTableCard2({
|
|
|
6095
6157
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
6096
6158
|
/* @__PURE__ */ jsx("h4", { className: "truncate text-sm font-semibold text-gray-900 dark:text-gray-100", children: table.title || t("BiChat.Table.QueryResults") }),
|
|
6097
6159
|
/* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
|
|
6098
|
-
dt.totalFilteredRows ===
|
|
6160
|
+
dt.totalFilteredRows === loadedRowsCount ? loadedRowsCount === reportedRowsCount ? loadedRowsCount === 1 ? t("BiChat.Table.OneRowLoaded") : t("BiChat.Table.RowsLoaded", { count: String(loadedRowsCount) }) : t("BiChat.DataTable.FilteredRows", {
|
|
6161
|
+
filtered: String(loadedRowsCount),
|
|
6162
|
+
total: String(reportedRowsCount)
|
|
6163
|
+
}) : t("BiChat.DataTable.FilteredRows", {
|
|
6099
6164
|
filtered: String(dt.totalFilteredRows),
|
|
6100
|
-
total: String(
|
|
6165
|
+
total: String(loadedRowsCount)
|
|
6101
6166
|
}),
|
|
6102
6167
|
table.truncated ? ` ${t("BiChat.Table.TruncatedSuffix")}` : ""
|
|
6103
6168
|
] })
|
|
@@ -6112,7 +6177,7 @@ var InteractiveTableCard = memo(function InteractiveTableCard2({
|
|
|
6112
6177
|
}
|
|
6113
6178
|
)
|
|
6114
6179
|
] });
|
|
6115
|
-
const renderTable = (scrollClass) => /* @__PURE__ */ jsx("div", { className: scrollClass
|
|
6180
|
+
const renderTable = (scrollClass) => /* @__PURE__ */ jsx("div", { className: `${FULL_WIDTH_CLASS} ${scrollClass}`, children: /* @__PURE__ */ jsxs("table", { className: "min-w-full border-collapse text-sm", children: [
|
|
6116
6181
|
/* @__PURE__ */ jsx(
|
|
6117
6182
|
DataTableHeader,
|
|
6118
6183
|
{
|
|
@@ -6253,7 +6318,7 @@ var InteractiveTableCard = memo(function InteractiveTableCard2({
|
|
|
6253
6318
|
] });
|
|
6254
6319
|
const renderTruncationNotice = () => table.truncated ? /* @__PURE__ */ jsx("p", { className: "border-t border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700 dark:border-amber-700/60 dark:bg-amber-900/20 dark:text-amber-300", children: t("BiChat.Table.TruncatedNotice") }) : null;
|
|
6255
6320
|
const fillHeight = host?.isFullscreen ?? false;
|
|
6256
|
-
const sectionClassName = host ?
|
|
6321
|
+
const sectionClassName = host ? `${FULL_WIDTH_CLASS} overflow-hidden${fillHeight ? " flex flex-col flex-1" : ""}` : `${FULL_WIDTH_CLASS} rounded-xl border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-900/40 overflow-hidden`;
|
|
6257
6322
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6258
6323
|
/* @__PURE__ */ jsxs("section", { className: sectionClassName, children: [
|
|
6259
6324
|
renderToolbar(),
|
|
@@ -6406,7 +6471,7 @@ var TabbedTableGroup = memo(function TabbedTableGroup2({
|
|
|
6406
6471
|
const tabs = useMemo(
|
|
6407
6472
|
() => tables.map((table, i) => ({
|
|
6408
6473
|
id: table.id,
|
|
6409
|
-
label: `${table.title || `${t("BiChat.Table.QueryResults")} ${i + 1}`} (${table.rows.length})`
|
|
6474
|
+
label: `${table.title || `${t("BiChat.Table.QueryResults")} ${i + 1}`} (${Math.max(table.totalRows || 0, table.rows.length)})`
|
|
6410
6475
|
})),
|
|
6411
6476
|
[tables, t]
|
|
6412
6477
|
);
|
|
@@ -7153,21 +7218,15 @@ function calculateContextUsagePercent(promptTokens, effectiveMaxTokens) {
|
|
|
7153
7218
|
}
|
|
7154
7219
|
return promptTokens / effectiveMaxTokens * 100;
|
|
7155
7220
|
}
|
|
7156
|
-
function
|
|
7221
|
+
function useCopyFeedback() {
|
|
7157
7222
|
const [copied, setCopied] = useState(false);
|
|
7158
7223
|
const timerRef = useRef(null);
|
|
7159
|
-
|
|
7160
|
-
if (timerRef.current !== null) {
|
|
7161
|
-
clearTimeout(timerRef.current);
|
|
7162
|
-
}
|
|
7163
|
-
}, []);
|
|
7164
|
-
const handleCopy = async (e) => {
|
|
7165
|
-
e.stopPropagation();
|
|
7224
|
+
const copy = useCallback(async (text) => {
|
|
7166
7225
|
try {
|
|
7167
7226
|
await navigator.clipboard.writeText(text);
|
|
7168
7227
|
setCopied(true);
|
|
7169
7228
|
if (timerRef.current !== null) {
|
|
7170
|
-
clearTimeout(timerRef.current);
|
|
7229
|
+
window.clearTimeout(timerRef.current);
|
|
7171
7230
|
}
|
|
7172
7231
|
timerRef.current = window.setTimeout(() => {
|
|
7173
7232
|
setCopied(false);
|
|
@@ -7176,6 +7235,19 @@ function CopyPill({ text }) {
|
|
|
7176
7235
|
} catch (err) {
|
|
7177
7236
|
console.error("Copy failed:", err);
|
|
7178
7237
|
}
|
|
7238
|
+
}, []);
|
|
7239
|
+
useEffect(() => () => {
|
|
7240
|
+
if (timerRef.current !== null) {
|
|
7241
|
+
window.clearTimeout(timerRef.current);
|
|
7242
|
+
}
|
|
7243
|
+
}, []);
|
|
7244
|
+
return { copied, copy };
|
|
7245
|
+
}
|
|
7246
|
+
function CopyPill({ text }) {
|
|
7247
|
+
const { copied, copy } = useCopyFeedback();
|
|
7248
|
+
const handleCopy = async (e) => {
|
|
7249
|
+
e.stopPropagation();
|
|
7250
|
+
await copy(text);
|
|
7179
7251
|
};
|
|
7180
7252
|
return /* @__PURE__ */ jsxs(
|
|
7181
7253
|
"button",
|
|
@@ -7194,28 +7266,10 @@ function CopyPill({ text }) {
|
|
|
7194
7266
|
);
|
|
7195
7267
|
}
|
|
7196
7268
|
function InlineCopyButton({ text }) {
|
|
7197
|
-
const
|
|
7198
|
-
const timerRef = useRef(null);
|
|
7199
|
-
useEffect(() => () => {
|
|
7200
|
-
if (timerRef.current !== null) {
|
|
7201
|
-
clearTimeout(timerRef.current);
|
|
7202
|
-
}
|
|
7203
|
-
}, []);
|
|
7269
|
+
const { copied, copy } = useCopyFeedback();
|
|
7204
7270
|
const handleCopy = async (e) => {
|
|
7205
7271
|
e.stopPropagation();
|
|
7206
|
-
|
|
7207
|
-
await navigator.clipboard.writeText(text);
|
|
7208
|
-
setCopied(true);
|
|
7209
|
-
if (timerRef.current !== null) {
|
|
7210
|
-
clearTimeout(timerRef.current);
|
|
7211
|
-
}
|
|
7212
|
-
timerRef.current = window.setTimeout(() => {
|
|
7213
|
-
setCopied(false);
|
|
7214
|
-
timerRef.current = null;
|
|
7215
|
-
}, 2e3);
|
|
7216
|
-
} catch (err) {
|
|
7217
|
-
console.error("Copy failed:", err);
|
|
7218
|
-
}
|
|
7272
|
+
await copy(text);
|
|
7219
7273
|
};
|
|
7220
7274
|
return /* @__PURE__ */ jsx(
|
|
7221
7275
|
"button",
|
|
@@ -7480,8 +7534,8 @@ var MarkdownRenderer2 = lazy(
|
|
|
7480
7534
|
);
|
|
7481
7535
|
var COPY_FEEDBACK_MS2 = 2e3;
|
|
7482
7536
|
var defaultClassNames2 = {
|
|
7483
|
-
root: "flex gap-3 group",
|
|
7484
|
-
wrapper: "flex-1 min-w-0 flex flex-col gap-3 max-w-[var(--bichat-bubble-assistant-max-width,85%)]",
|
|
7537
|
+
root: "flex min-w-0 gap-3 group",
|
|
7538
|
+
wrapper: "flex-1 w-full min-w-0 flex flex-col gap-3 max-w-[var(--bichat-bubble-assistant-max-width,85%)]",
|
|
7485
7539
|
avatar: "flex-shrink-0 w-8 h-8 rounded-full bg-primary-600 flex items-center justify-center text-white font-medium text-xs",
|
|
7486
7540
|
bubble: "bg-white dark:bg-gray-800 rounded-2xl rounded-bl-sm px-4 py-3 shadow-sm",
|
|
7487
7541
|
codeOutputs: "",
|
|
@@ -7559,8 +7613,8 @@ function AssistantMessage({
|
|
|
7559
7613
|
const hasDebug = showDebug && !!turn.debug;
|
|
7560
7614
|
const hasAnyRenderedContent = hasContent || hasExplanation || hasCodeOutputs || hasChart || hasTables || hasArtifacts || hasDebug;
|
|
7561
7615
|
const canRegenerate = !!onRegenerate && !!turnId && !isSystemMessage && isLastTurn;
|
|
7562
|
-
const
|
|
7563
|
-
const
|
|
7616
|
+
const showInlineRetry = shouldRenderInlineRetry(turn, canRegenerate) && !hasAnyRenderedContent;
|
|
7617
|
+
const renderMode = hasPendingQuestion ? "hitl_form" : isAwaitingHumanInput ? "hitl_waiting" : hasAnyRenderedContent ? "content" : showInlineRetry ? "retry" : "empty";
|
|
7564
7618
|
const handleCopyClick = useCallback(async () => {
|
|
7565
7619
|
try {
|
|
7566
7620
|
if (onCopy) {
|
|
@@ -7952,7 +8006,7 @@ function AssistantTurnView({
|
|
|
7952
8006
|
);
|
|
7953
8007
|
}
|
|
7954
8008
|
var defaultClassNames3 = {
|
|
7955
|
-
root: "space-y-4",
|
|
8009
|
+
root: "space-y-4 min-w-0",
|
|
7956
8010
|
userTurn: "",
|
|
7957
8011
|
assistantTurn: ""
|
|
7958
8012
|
};
|
|
@@ -8785,9 +8839,9 @@ function MessageListSkeleton() {
|
|
|
8785
8839
|
] });
|
|
8786
8840
|
}
|
|
8787
8841
|
function StreamingBubble({ content, normalizedContent }) {
|
|
8788
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
8842
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 gap-3", children: [
|
|
8789
8843
|
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 w-8 h-8 rounded-full bg-primary-600 flex items-center justify-center text-white font-medium text-xs", children: "AI" }),
|
|
8790
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-2xl rounded-bl-sm px-4 py-3 text-gray-900 dark:text-gray-100", style: { maxWidth: "var(--bichat-bubble-assistant-max-width, 85%)" }, children: [
|
|
8844
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-2xl rounded-bl-sm px-4 py-3 text-gray-900 dark:text-gray-100", style: { maxWidth: "var(--bichat-bubble-assistant-max-width, 85%)" }, children: [
|
|
8791
8845
|
/* @__PURE__ */ jsx(
|
|
8792
8846
|
Suspense,
|
|
8793
8847
|
{
|
|
@@ -8818,8 +8872,8 @@ function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readO
|
|
|
8818
8872
|
);
|
|
8819
8873
|
const showAuthorNames = Boolean(session?.isGroup);
|
|
8820
8874
|
const showEphemeral = showActivityTrace || showTypingIndicator;
|
|
8821
|
-
return /* @__PURE__ */ jsxs("div", { className: "relative flex-1 min-h-0", children: [
|
|
8822
|
-
/* @__PURE__ */ jsx("div", { ref: containerRef, className: "h-full overflow-y-auto overflow-x-hidden px-4 py-6", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto space-y-6", children: [
|
|
8875
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative flex-1 min-w-0 min-h-0", children: [
|
|
8876
|
+
/* @__PURE__ */ jsx("div", { ref: containerRef, className: "h-full overflow-y-auto overflow-x-hidden px-4 py-6", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full min-w-0 space-y-6", children: [
|
|
8823
8877
|
fetching && turns.length === 0 && /* @__PURE__ */ jsx(MessageListSkeleton, {}),
|
|
8824
8878
|
turns.map((turn, index) => {
|
|
8825
8879
|
const turnDate = new Date(turn.createdAt);
|
|
@@ -9478,6 +9532,16 @@ var MessageInput = forwardRef(
|
|
|
9478
9532
|
const canSubmit = !disabled && (message.trim() || attachments.length > 0);
|
|
9479
9533
|
const visibleError = error || commandError;
|
|
9480
9534
|
const visibleErrorText = visibleError ? t(visibleError) : "";
|
|
9535
|
+
const resolvedReasoningEffort = reasoningEffortOptions && reasoningEffortOptions.length > 0 ? reasoningEffortOptions.includes(reasoningEffort ?? "") ? reasoningEffort : reasoningEffortOptions[1] || reasoningEffortOptions[0] : void 0;
|
|
9536
|
+
useEffect(() => {
|
|
9537
|
+
if (!onReasoningEffortChange || !reasoningEffortOptions?.length) {
|
|
9538
|
+
return;
|
|
9539
|
+
}
|
|
9540
|
+
if (!resolvedReasoningEffort || resolvedReasoningEffort === reasoningEffort) {
|
|
9541
|
+
return;
|
|
9542
|
+
}
|
|
9543
|
+
onReasoningEffortChange(resolvedReasoningEffort);
|
|
9544
|
+
}, [reasoningEffort, onReasoningEffortChange, reasoningEffortOptions, resolvedReasoningEffort]);
|
|
9481
9545
|
const defaultContainerClassName = "shrink-0 px-4 pt-4 pb-6";
|
|
9482
9546
|
return /* @__PURE__ */ jsx(
|
|
9483
9547
|
"div",
|
|
@@ -9604,7 +9668,7 @@ var MessageInput = forwardRef(
|
|
|
9604
9668
|
ReasoningEffortSelector,
|
|
9605
9669
|
{
|
|
9606
9670
|
options: reasoningEffortOptions,
|
|
9607
|
-
value:
|
|
9671
|
+
value: resolvedReasoningEffort,
|
|
9608
9672
|
onChange: onReasoningEffortChange,
|
|
9609
9673
|
disabled: disabled || loading
|
|
9610
9674
|
}
|
|
@@ -10221,6 +10285,14 @@ function readString(value) {
|
|
|
10221
10285
|
return trimmed.length > 0 ? trimmed : null;
|
|
10222
10286
|
}
|
|
10223
10287
|
function readPositiveInteger(value) {
|
|
10288
|
+
if (typeof value === "string") {
|
|
10289
|
+
const trimmed = value.trim();
|
|
10290
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
10291
|
+
return null;
|
|
10292
|
+
}
|
|
10293
|
+
const parsed = Number(trimmed);
|
|
10294
|
+
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
|
|
10295
|
+
}
|
|
10224
10296
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
10225
10297
|
return null;
|
|
10226
10298
|
}
|
|
@@ -10271,7 +10343,7 @@ function parseRenderTableDataFromObject(parsed, fallbackId) {
|
|
|
10271
10343
|
const headers = headersRaw.length === columns.length ? headersRaw : columns;
|
|
10272
10344
|
const columnTypesRaw = Array.isArray(parsed.column_types) ? parsed.column_types : Array.isArray(parsed.columnTypes) ? parsed.columnTypes : [];
|
|
10273
10345
|
const columnTypes = columnTypesRaw.length === columns.length ? columnTypesRaw.map((t) => readString(t) || "string") : void 0;
|
|
10274
|
-
const totalRows = readPositiveInteger(parsed.total_rows) || readPositiveInteger(parsed.totalRows) || rows.length;
|
|
10346
|
+
const totalRows = readPositiveInteger(parsed.total_rows) || readPositiveInteger(parsed.totalRows) || readPositiveInteger(parsed.row_count) || readPositiveInteger(parsed.rowCount) || rows.length;
|
|
10275
10347
|
const pageSize = readPositiveInteger(parsed.page_size) || readPositiveInteger(parsed.pageSize) || 25;
|
|
10276
10348
|
const query = readString(parsed.query) || readString(parsed.sql);
|
|
10277
10349
|
if (!query) {
|
|
@@ -11810,7 +11882,8 @@ function ChatSessionCore({
|
|
|
11810
11882
|
setError,
|
|
11811
11883
|
retryFetchSession,
|
|
11812
11884
|
reasoningEffort,
|
|
11813
|
-
setReasoningEffort
|
|
11885
|
+
setReasoningEffort,
|
|
11886
|
+
reasoningEffortOptions
|
|
11814
11887
|
} = useChatSession();
|
|
11815
11888
|
const {
|
|
11816
11889
|
turns,
|
|
@@ -11838,7 +11911,6 @@ function ChatSessionCore({
|
|
|
11838
11911
|
const accessReadOnly = session?.access ? !session.access.canWrite : false;
|
|
11839
11912
|
const effectiveReadOnly = Boolean(readOnly ?? isReadOnly) || isArchived || accessReadOnly;
|
|
11840
11913
|
const [restoring, setRestoring] = useState(false);
|
|
11841
|
-
const [reasoningEffortOptions] = useState(() => readReasoningEffortOptionsFromGlobalContext());
|
|
11842
11914
|
const handleRestore = useCallback(async () => {
|
|
11843
11915
|
if (!session?.id) {
|
|
11844
11916
|
return;
|
|
@@ -12045,7 +12117,7 @@ function ChatSessionCore({
|
|
|
12045
12117
|
return /* @__PURE__ */ jsxs(
|
|
12046
12118
|
"main",
|
|
12047
12119
|
{
|
|
12048
|
-
className: `flex min-h-0 flex-1 flex-col overflow-hidden bg-gray-50 dark:bg-gray-900 ${className}`,
|
|
12120
|
+
className: `flex min-w-0 min-h-0 flex-1 flex-col overflow-hidden bg-gray-50 dark:bg-gray-900 ${className}`,
|
|
12049
12121
|
children: [
|
|
12050
12122
|
headerSlot || /* @__PURE__ */ jsx(
|
|
12051
12123
|
ChatHeader,
|
|
@@ -14552,10 +14624,14 @@ function Sidebar2({
|
|
|
14552
14624
|
sessions: Array.isArray(group.sessions) ? group.sessions : []
|
|
14553
14625
|
})) : [];
|
|
14554
14626
|
}, [unpinnedSessions, t]);
|
|
14627
|
+
const orderedUnpinnedSessions = useMemo(
|
|
14628
|
+
() => sessionGroups.flatMap((group) => group.sessions),
|
|
14629
|
+
[sessionGroups]
|
|
14630
|
+
);
|
|
14555
14631
|
const collapsedIndicators = useMemo(() => {
|
|
14556
14632
|
const seen = /* @__PURE__ */ new Set();
|
|
14557
14633
|
const result = [];
|
|
14558
|
-
for (const s of [...pinnedSessions, ...
|
|
14634
|
+
for (const s of [...pinnedSessions, ...orderedUnpinnedSessions]) {
|
|
14559
14635
|
if (seen.has(s.id)) {
|
|
14560
14636
|
continue;
|
|
14561
14637
|
}
|
|
@@ -14566,7 +14642,7 @@ function Sidebar2({
|
|
|
14566
14642
|
}
|
|
14567
14643
|
}
|
|
14568
14644
|
return result;
|
|
14569
|
-
}, [pinnedSessions,
|
|
14645
|
+
}, [pinnedSessions, orderedUnpinnedSessions]);
|
|
14570
14646
|
const totalSessionCount = filteredSessions.length;
|
|
14571
14647
|
const overflowCount = Math.max(0, totalSessionCount - collapsedIndicators.length);
|
|
14572
14648
|
const handleSessionListKeyDown = useCallback(
|
|
@@ -15387,7 +15463,7 @@ function BiChatLayout({
|
|
|
15387
15463
|
const content = routeKey ? /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ jsx(
|
|
15388
15464
|
motion.div,
|
|
15389
15465
|
{
|
|
15390
|
-
className: "flex flex-1 min-h-0",
|
|
15466
|
+
className: "flex flex-1 min-w-0 min-h-0",
|
|
15391
15467
|
initial: { opacity: 0, y: 4 },
|
|
15392
15468
|
animate: { opacity: 1, y: 0 },
|
|
15393
15469
|
exit: { opacity: 0, y: -4 },
|
|
@@ -15395,7 +15471,7 @@ function BiChatLayout({
|
|
|
15395
15471
|
children
|
|
15396
15472
|
},
|
|
15397
15473
|
routeKey
|
|
15398
|
-
) }) : /* @__PURE__ */ jsx("div", { className: "flex flex-1 min-h-0", children });
|
|
15474
|
+
) }) : /* @__PURE__ */ jsx("div", { className: "flex flex-1 min-w-0 min-h-0", children });
|
|
15399
15475
|
return /* @__PURE__ */ jsxs("div", { className: `relative flex flex-1 w-full h-full min-h-0 overflow-hidden ${className}`, children: [
|
|
15400
15476
|
/* @__PURE__ */ jsx(SkipLink, {}),
|
|
15401
15477
|
/* @__PURE__ */ jsx("div", { className: "hidden md:block", children: renderSidebar({}) }),
|
|
@@ -15431,7 +15507,7 @@ function BiChatLayout({
|
|
|
15431
15507
|
"sidebar-drawer"
|
|
15432
15508
|
)
|
|
15433
15509
|
] }) }),
|
|
15434
|
-
/* @__PURE__ */ jsxs("main", { id: "main-content", className: "relative flex-1 flex flex-col min-h-0 overflow-hidden", children: [
|
|
15510
|
+
/* @__PURE__ */ jsxs("main", { id: "main-content", className: "relative flex-1 min-w-0 flex flex-col min-h-0 overflow-hidden", children: [
|
|
15435
15511
|
isMobile && !isMobileOpen && /* @__PURE__ */ jsx(
|
|
15436
15512
|
"button",
|
|
15437
15513
|
{
|
|
@@ -17843,13 +17919,17 @@ function parseRowCount(metadata) {
|
|
|
17843
17919
|
if (!metadata) {
|
|
17844
17920
|
return void 0;
|
|
17845
17921
|
}
|
|
17846
|
-
const raw = metadata.row_count ?? metadata.rowCount;
|
|
17847
|
-
if (typeof raw === "number" && Number.
|
|
17922
|
+
const raw = metadata.row_count ?? metadata.rowCount ?? metadata.total_rows ?? metadata.totalRows;
|
|
17923
|
+
if (typeof raw === "number" && Number.isSafeInteger(raw) && raw >= 0) {
|
|
17848
17924
|
return raw;
|
|
17849
17925
|
}
|
|
17850
17926
|
if (typeof raw === "string") {
|
|
17851
|
-
const
|
|
17852
|
-
if (
|
|
17927
|
+
const trimmed = raw.trim();
|
|
17928
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
17929
|
+
return void 0;
|
|
17930
|
+
}
|
|
17931
|
+
const parsed = Number(trimmed);
|
|
17932
|
+
if (Number.isSafeInteger(parsed)) {
|
|
17853
17933
|
return parsed;
|
|
17854
17934
|
}
|
|
17855
17935
|
}
|