@arbidocs/react 0.4.126 → 0.4.128
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/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -114,6 +114,13 @@ interface UseArbiChatOptions {
|
|
|
114
114
|
workspaceId?: string;
|
|
115
115
|
/** Assistant configuration or model id passed to every query. */
|
|
116
116
|
model?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Drafting mode: the saved document the turn is about, read once as each question is sent (not
|
|
119
|
+
* for a comment that does not call the assistant). The request names it
|
|
120
|
+
* (`active_artifact_ext_id`), so the assistant works in that document. Return nothing when no
|
|
121
|
+
* document is open. `@arbidocs/blocks` binds it to the open document.
|
|
122
|
+
*/
|
|
123
|
+
activeArtifact?: () => string | null | undefined;
|
|
117
124
|
/** Longest auto-title in characters (used until the backend has titled the conversation). Default 48. */
|
|
118
125
|
titleLength?: number;
|
|
119
126
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -114,6 +114,13 @@ interface UseArbiChatOptions {
|
|
|
114
114
|
workspaceId?: string;
|
|
115
115
|
/** Assistant configuration or model id passed to every query. */
|
|
116
116
|
model?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Drafting mode: the saved document the turn is about, read once as each question is sent (not
|
|
119
|
+
* for a comment that does not call the assistant). The request names it
|
|
120
|
+
* (`active_artifact_ext_id`), so the assistant works in that document. Return nothing when no
|
|
121
|
+
* document is open. `@arbidocs/blocks` binds it to the open document.
|
|
122
|
+
*/
|
|
123
|
+
activeArtifact?: () => string | null | undefined;
|
|
117
124
|
/** Longest auto-title in characters (used until the backend has titled the conversation). Default 48. */
|
|
118
125
|
titleLength?: number;
|
|
119
126
|
/**
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import React, { memo, useState, createContext, useMemo, useCallback, useEffect,
|
|
|
24
24
|
import { useQueryClient, useMutation, useQuery, onlineManager } from '@tanstack/react-query';
|
|
25
25
|
import { resolveCitations, summarizeCitations, settings, formatFileSize, connectWithReconnect, chats, identityErrorCode } from '@arbidocs/sdk/browser';
|
|
26
26
|
export { Arbi, ArbiError, DEFAULT_AI_USD_PER_GBP, formatGbp, formatGbpPerMillionTokens, usdToGbp } from '@arbidocs/sdk/browser';
|
|
27
|
-
import { Link, Trash2, CheckCheck, Check, Loader2, AlertTriangle, ShieldCheck, Copy, Sparkles, FileText, GitCompareArrows, Download, Search, CornerDownLeft, X, ArrowLeft, Send, Tags, Crown, Info, Activity, Gauge, Gift, PartyPopper, UserCheck, Reply, PenLine, AtSign, MessageCircleMore, FileX2, FileCheck2, Pencil, FolderPlus, SquareArrowOutUpRight, MessagesSquare, Paperclip, ArrowRight, MoreHorizontal, SquarePen, Mic, Pause, Play, Square, RotateCcw, Camera, Circle, Image as Image$1, AppWindow } from 'lucide-react';
|
|
27
|
+
import { Link, Trash2, CheckCheck, Check, Loader2, AlertTriangle, ShieldCheck, Copy, Sparkles, FileText, GitCompareArrows, Download, Search, CornerDownLeft, X, ArrowLeft, Send, Tags, Crown, Info, Activity, HardDrive, Gauge, Gift, PartyPopper, UserCheck, Reply, PenLine, AtSign, MessageCircleMore, FileX2, FileCheck2, Pencil, FolderPlus, SquareArrowOutUpRight, MessagesSquare, Paperclip, ArrowRight, MoreHorizontal, SquarePen, Mic, Pause, Play, Square, RotateCcw, Camera, Circle, Image as Image$1, AppWindow } from 'lucide-react';
|
|
28
28
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
29
29
|
import { isMessageType, passwordChangeErrorMessage } from '@arbidocs/client';
|
|
30
30
|
export { isMessageType } from '@arbidocs/client';
|
|
@@ -472,6 +472,10 @@ var isAbort = (e) => e instanceof DOMException && e.name === "AbortError";
|
|
|
472
472
|
var TITLE_REFRESH_DELAYS_MS = [2500, 6e3, 12e3];
|
|
473
473
|
function useArbiChat(options = {}) {
|
|
474
474
|
const { workspaceId, agentId, model, titleLength = 48, streamRecovery } = options;
|
|
475
|
+
const activeArtifactRef = useRef(options.activeArtifact);
|
|
476
|
+
useEffect(() => {
|
|
477
|
+
activeArtifactRef.current = options.activeArtifact;
|
|
478
|
+
});
|
|
475
479
|
const recoveryIntervalMs = streamRecovery?.intervalMs ?? 3e3;
|
|
476
480
|
const recoveryTimeoutMs = streamRecovery?.timeoutMs ?? 12e4;
|
|
477
481
|
const arbi = useArbi();
|
|
@@ -689,6 +693,7 @@ function useArbiChat(options = {}) {
|
|
|
689
693
|
title: t.title || titleFromQuestion(text, titleLength),
|
|
690
694
|
messages: [...t.messages, userMessage, answer]
|
|
691
695
|
}));
|
|
696
|
+
const activeArtifactExtId = activeArtifactRef.current?.() || void 0;
|
|
692
697
|
const controller = new AbortController();
|
|
693
698
|
abortRef.current = controller;
|
|
694
699
|
runIdRef.current = null;
|
|
@@ -719,6 +724,7 @@ function useArbiChat(options = {}) {
|
|
|
719
724
|
...thread.conversationId ? { conversationId: thread.conversationId } : {},
|
|
720
725
|
...!thread.conversationId && thread.assistantMode === "mentioned" ? { assistantMode: "mentioned" } : {},
|
|
721
726
|
...mentions?.length ? { mentions } : {},
|
|
727
|
+
...activeArtifactExtId ? { activeArtifactExtId } : {},
|
|
722
728
|
model,
|
|
723
729
|
signal: controller.signal,
|
|
724
730
|
onStreamStart: (data) => {
|
|
@@ -4652,6 +4658,8 @@ function getNotificationTypeMeta(type) {
|
|
|
4652
4658
|
return { Icon: Gauge, iconClassName: "text-orange-500", label: "Usage 90%" };
|
|
4653
4659
|
case "quota_threshold_100":
|
|
4654
4660
|
return { Icon: Gauge, iconClassName: "text-red-500", label: "Usage limit" };
|
|
4661
|
+
case "storage_quota_exceeded":
|
|
4662
|
+
return { Icon: HardDrive, iconClassName: "text-red-500", label: "Storage full" };
|
|
4655
4663
|
case "activity":
|
|
4656
4664
|
return { Icon: Activity, iconClassName: "text-muted-foreground", label: "Activity" };
|
|
4657
4665
|
default:
|