@athenaintel/react 0.9.6 → 0.9.8
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 +31 -7
- package/dist/index.cjs +70 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +64 -21
- package/dist/index.js +71 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -72,13 +72,13 @@ export declare interface AthenaChatProps {
|
|
|
72
72
|
toolUIs?: Record<string, ToolCallMessagePartComponent>;
|
|
73
73
|
/** Mention tools available in the composer. */
|
|
74
74
|
mentionTools?: MentionTool[];
|
|
75
|
-
/** Suggestion cards shown on the welcome screen. Pass `[]` to hide.
|
|
75
|
+
/** Suggestion cards shown on the welcome screen. Pass `[]` to hide.
|
|
76
|
+
* For workflow launchers outside AthenaChat, use `useSendMessage()`.
|
|
77
|
+
*/
|
|
76
78
|
welcomeSuggestions?: WelcomeSuggestion[];
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
export declare interface AthenaConfig {
|
|
80
|
-
apiKey?: string;
|
|
81
|
-
token?: string | null;
|
|
81
|
+
export declare interface AthenaConfig extends Pick<AthenaProviderConfig, 'apiKey' | 'token'> {
|
|
82
82
|
backendUrl: string;
|
|
83
83
|
appUrl: string;
|
|
84
84
|
}
|
|
@@ -99,15 +99,32 @@ export declare interface AthenaLayoutProps {
|
|
|
99
99
|
minPercent?: number;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
export declare function AthenaProvider({ children, apiKey, token: tokenProp, agent, model, tools, frontendTools, apiUrl, backendUrl, appUrl, environment, workbench, knowledgeBase, systemPrompt, threadId: threadIdProp, enableThreadList, theme, }: AthenaProviderProps): JSX.Element | null;
|
|
102
|
+
export declare function AthenaProvider({ children, config, apiKey, token: tokenProp, agent, model, tools, frontendTools, apiUrl, backendUrl, appUrl, environment, workbench, knowledgeBase, systemPrompt, threadId: threadIdProp, enableThreadList, theme, }: AthenaProviderProps): JSX.Element | null;
|
|
103
|
+
|
|
104
|
+
export declare interface AthenaProviderConfig {
|
|
105
|
+
/** API key for standalone authentication when no token is provided. */
|
|
106
|
+
apiKey?: string;
|
|
107
|
+
/** PropelAuth token. Takes priority over apiKey when provided. */
|
|
108
|
+
token?: string | null;
|
|
109
|
+
/** URL for the chat streaming endpoint. Defaults to the matching Athena environment. */
|
|
110
|
+
apiUrl?: string;
|
|
111
|
+
/** URL for the Athena backend API. Defaults to the matching Athena environment. */
|
|
112
|
+
backendUrl?: string;
|
|
113
|
+
/** URL for the Athena frontend app origin. Defaults to the matching Athena environment. */
|
|
114
|
+
appUrl?: string;
|
|
115
|
+
/** Athena environment preset used when URLs are not explicitly provided. */
|
|
116
|
+
environment?: AthenaEnvironment;
|
|
117
|
+
}
|
|
103
118
|
|
|
104
119
|
export declare interface AthenaProviderProps {
|
|
105
120
|
children: ReactNode;
|
|
106
|
-
/**
|
|
121
|
+
/** Preferred structured config for auth and Athena endpoint settings. */
|
|
122
|
+
config?: AthenaProviderConfig;
|
|
123
|
+
/** @deprecated Prefer `config.apiKey`. API key for authentication in standalone mode. */
|
|
107
124
|
apiKey?: string;
|
|
108
|
-
/** PropelAuth token. If provided, takes priority over apiKey. If omitted, the SDK
|
|
125
|
+
/** @deprecated Prefer `config.token`. PropelAuth token. If provided, takes priority over apiKey. If omitted, the SDK
|
|
109
126
|
* will automatically listen for a token from the parent window via PostMessage. */
|
|
110
|
-
token?: string;
|
|
127
|
+
token?: string | null;
|
|
111
128
|
/** Agent name to use. Defaults to 'athena_assist_agent'. */
|
|
112
129
|
agent?: string;
|
|
113
130
|
/** LLM model identifier. Defaults to 'claude-opus-4-6-thinking-max-fast'. */
|
|
@@ -116,13 +133,13 @@ export declare interface AthenaProviderProps {
|
|
|
116
133
|
tools?: string[];
|
|
117
134
|
/** Frontend tools that execute in the browser. The agent can invoke these. */
|
|
118
135
|
frontendTools?: Toolkit;
|
|
119
|
-
/** URL for the chat streaming endpoint.
|
|
136
|
+
/** @deprecated Prefer `config.apiUrl`. URL for the chat streaming endpoint. */
|
|
120
137
|
apiUrl?: string;
|
|
121
|
-
/** URL for the
|
|
138
|
+
/** @deprecated Prefer `config.backendUrl`. URL for the Athena backend API. */
|
|
122
139
|
backendUrl?: string;
|
|
123
|
-
/** URL for the Athena frontend app origin.
|
|
140
|
+
/** @deprecated Prefer `config.appUrl`. URL for the Athena frontend app origin. */
|
|
124
141
|
appUrl?: string;
|
|
125
|
-
/** Athena environment preset used when URLs are not explicitly provided. */
|
|
142
|
+
/** @deprecated Prefer `config.environment`. Athena environment preset used when URLs are not explicitly provided. */
|
|
126
143
|
environment?: AthenaEnvironment;
|
|
127
144
|
/** Asset IDs to include in the workbench. */
|
|
128
145
|
workbench?: string[];
|
|
@@ -155,7 +172,7 @@ export declare interface AthenaRuntimeConfig {
|
|
|
155
172
|
apiUrl?: string;
|
|
156
173
|
/** URL for the sync server resume endpoint. Derived from apiUrl if not provided. */
|
|
157
174
|
resumeApiUrl?: string;
|
|
158
|
-
/** URL for the
|
|
175
|
+
/** URL for the Athena backend API. Defaults to Athena production API. */
|
|
159
176
|
backendUrl?: string;
|
|
160
177
|
/** API key for authentication. Used when no auth token is provided. */
|
|
161
178
|
apiKey?: string;
|
|
@@ -197,7 +214,7 @@ export declare interface AthenaRuntimeConfig {
|
|
|
197
214
|
export declare interface AthenaTheme {
|
|
198
215
|
/** Brand / accent color. Send button, active states, focus ring, spinner. */
|
|
199
216
|
primary?: string;
|
|
200
|
-
/** Text color on primary background. */
|
|
217
|
+
/** Text color on primary background. Set this with `primary` when you change contrast significantly. */
|
|
201
218
|
primaryForeground?: string;
|
|
202
219
|
/** Page / panel background. */
|
|
203
220
|
background?: string;
|
|
@@ -243,11 +260,11 @@ export declare interface AthenaTheme {
|
|
|
243
260
|
sidebarWidth?: string;
|
|
244
261
|
/** User message bubble background. Falls back to muted. */
|
|
245
262
|
userBubble?: string;
|
|
246
|
-
/** User message bubble text color. Falls back to foreground. */
|
|
263
|
+
/** User message bubble text color. Falls back to foreground. Set this when `userBubble` is dark or saturated. */
|
|
247
264
|
userBubbleForeground?: string;
|
|
248
265
|
/** User message bubble border radius. e.g. '1rem', '0.5rem'. */
|
|
249
266
|
userBubbleRadius?: string;
|
|
250
|
-
/** Assistant message text color. Falls back to foreground. */
|
|
267
|
+
/** Assistant message text color. Falls back to foreground. Set this when `assistantBubble` reduces contrast. */
|
|
251
268
|
assistantForeground?: string;
|
|
252
269
|
/** Assistant message bubble background. Transparent by default. */
|
|
253
270
|
assistantBubble?: string;
|
|
@@ -413,7 +430,7 @@ export declare interface ParentBridgeState {
|
|
|
413
430
|
token: string | null;
|
|
414
431
|
/** Sync server chat URL provided by the Marathon wrapper. */
|
|
415
432
|
apiUrl: string | null;
|
|
416
|
-
/**
|
|
433
|
+
/** Athena backend URL provided by the Marathon wrapper. */
|
|
417
434
|
backendUrl: string | null;
|
|
418
435
|
/** Athena frontend origin provided by the parent wrapper. */
|
|
419
436
|
appUrl: string | null;
|
|
@@ -455,6 +472,14 @@ declare interface ScopeRegistryEntry {
|
|
|
455
472
|
fetchStates: Map<string, FetchState>;
|
|
456
473
|
}
|
|
457
474
|
|
|
475
|
+
export declare interface SendMessageOptions {
|
|
476
|
+
/**
|
|
477
|
+
* Replace the current composer text before sending.
|
|
478
|
+
* Defaults to `true`.
|
|
479
|
+
*/
|
|
480
|
+
replace?: boolean;
|
|
481
|
+
}
|
|
482
|
+
|
|
458
483
|
declare interface SourceContext {
|
|
459
484
|
scope: MenuScope;
|
|
460
485
|
query: string;
|
|
@@ -616,7 +641,7 @@ export declare interface ThreadListProps {
|
|
|
616
641
|
}
|
|
617
642
|
|
|
618
643
|
/**
|
|
619
|
-
*
|
|
644
|
+
* Athena thread API client.
|
|
620
645
|
* Calls existing REST endpoints for thread CRUD.
|
|
621
646
|
*/
|
|
622
647
|
export declare interface ThreadSummary {
|
|
@@ -816,7 +841,10 @@ export declare interface UploadProgress {
|
|
|
816
841
|
}
|
|
817
842
|
|
|
818
843
|
/**
|
|
819
|
-
* Hook to programmatically append text to the composer.
|
|
844
|
+
* Hook to programmatically append text to the composer without sending it.
|
|
845
|
+
*
|
|
846
|
+
* Use `useSendMessage()` for workflow shortcuts or other UI that should
|
|
847
|
+
* immediately submit a prompt.
|
|
820
848
|
*
|
|
821
849
|
* Usage:
|
|
822
850
|
* const append = useAppendToComposer();
|
|
@@ -829,7 +857,7 @@ export declare function useAppendToComposer(): (text: string, opts?: {
|
|
|
829
857
|
|
|
830
858
|
/**
|
|
831
859
|
* Hook to generate an embed URL for rendering an asset in an iframe.
|
|
832
|
-
* Calls the
|
|
860
|
+
* Calls the Athena embed token endpoint.
|
|
833
861
|
*/
|
|
834
862
|
export declare function useAssetEmbed(assetId: string | null, options?: UseAssetEmbedOptions & {
|
|
835
863
|
backendUrl: string;
|
|
@@ -870,7 +898,7 @@ export declare function useComposerAttachment(): {
|
|
|
870
898
|
};
|
|
871
899
|
|
|
872
900
|
/**
|
|
873
|
-
* Hook for uploading files to the Athena platform via
|
|
901
|
+
* Hook for uploading files to the Athena platform via the Athena upload endpoint.
|
|
874
902
|
* Files become Athena assets (documents, spreadsheets, PDFs, images, etc.).
|
|
875
903
|
*
|
|
876
904
|
* Usage:
|
|
@@ -923,6 +951,21 @@ export declare function useQuote(): QuoteContextValue;
|
|
|
923
951
|
/** Trigger a re-fetch of the thread list. No-op outside of thread list mode. */
|
|
924
952
|
export declare function useRefreshThreadList(): (() => void) | null;
|
|
925
953
|
|
|
954
|
+
/**
|
|
955
|
+
* Hook to programmatically send a user message from anywhere inside AthenaProvider.
|
|
956
|
+
*
|
|
957
|
+
* This is intended for custom workflow buttons, sidebar shortcuts, or other UI
|
|
958
|
+
* that lives outside the AthenaChat thread tree. Unlike `aui.thread().append()`,
|
|
959
|
+
* this uses the provider-scoped composer runtime and does not depend on
|
|
960
|
+
* ThreadPrimitive context.
|
|
961
|
+
*
|
|
962
|
+
* Usage:
|
|
963
|
+
* const sendMessage = useSendMessage();
|
|
964
|
+
* await sendMessage("Run the quarterly workflow");
|
|
965
|
+
* await sendMessage("Add this follow-up", { replace: false });
|
|
966
|
+
*/
|
|
967
|
+
export declare function useSendMessage(): (text: string, options?: SendMessageOptions) => Promise<void>;
|
|
968
|
+
|
|
926
969
|
export declare type ViewMode = 'tabs' | 'tiled';
|
|
927
970
|
|
|
928
971
|
export declare const WebSearchToolUI: ToolCallMessagePartComponent;
|
package/dist/index.js
CHANGED
|
@@ -16473,8 +16473,16 @@ const DEFAULT_ATHENA_ENVIRONMENT = "production";
|
|
|
16473
16473
|
const DEFAULT_API_URL = ATHENA_ENVIRONMENT_URLS.production.apiUrl;
|
|
16474
16474
|
const DEFAULT_BACKEND_URL = ATHENA_ENVIRONMENT_URLS.production.backendUrl;
|
|
16475
16475
|
const DEFAULT_APP_URL = ATHENA_ENVIRONMENT_URLS.production.appUrl;
|
|
16476
|
-
const
|
|
16476
|
+
const MARATHON_APP_PORT = "8082";
|
|
16477
|
+
const SPACES_PATHNAME = "dashboard/spaces/";
|
|
16477
16478
|
const normalizeBaseUrl = (url) => url.replace(/\/+$/, "");
|
|
16479
|
+
const createUrlWithFallback = (url, fallbackUrl) => {
|
|
16480
|
+
try {
|
|
16481
|
+
return new URL(`${normalizeBaseUrl(url)}/`);
|
|
16482
|
+
} catch {
|
|
16483
|
+
return new URL(`${normalizeBaseUrl(fallbackUrl)}/`);
|
|
16484
|
+
}
|
|
16485
|
+
};
|
|
16478
16486
|
const getHostname = (value) => {
|
|
16479
16487
|
if (!value) return null;
|
|
16480
16488
|
try {
|
|
@@ -16496,7 +16504,7 @@ const deriveWorkspaceAppUrl = ({
|
|
|
16496
16504
|
if (!((_a2 = match2 == null ? void 0 : match2.groups) == null ? void 0 : _a2.prefix) || !match2.groups.domain) {
|
|
16497
16505
|
return null;
|
|
16498
16506
|
}
|
|
16499
|
-
return `${parsedUrl.protocol}//${match2.groups.prefix}
|
|
16507
|
+
return `${parsedUrl.protocol}//${match2.groups.prefix}--${MARATHON_APP_PORT}.${match2.groups.domain}`;
|
|
16500
16508
|
} catch {
|
|
16501
16509
|
return null;
|
|
16502
16510
|
}
|
|
@@ -16545,7 +16553,7 @@ function createAthenaSpacesUrl({
|
|
|
16545
16553
|
assetIds,
|
|
16546
16554
|
sessionId
|
|
16547
16555
|
}) {
|
|
16548
|
-
const url = new URL(SPACES_PATHNAME,
|
|
16556
|
+
const url = new URL(SPACES_PATHNAME, createUrlWithFallback(appUrl, DEFAULT_APP_URL));
|
|
16549
16557
|
if (assetIds) {
|
|
16550
16558
|
const normalizedAssetIds = (Array.isArray(assetIds) ? assetIds : [assetIds]).map((assetId) => assetId.trim()).filter((assetId) => assetId.length > 0);
|
|
16551
16559
|
if (normalizedAssetIds.length > 0) {
|
|
@@ -20607,7 +20615,9 @@ const toolMessageSchema = objectType({
|
|
|
20607
20615
|
type: literalType("tool"),
|
|
20608
20616
|
content: toolMessageContentSchema,
|
|
20609
20617
|
tool_call_id: stringType(),
|
|
20610
|
-
name
|
|
20618
|
+
// Some backend/tool result flows omit the tool name entirely.
|
|
20619
|
+
// The converter already treats toolName as optional, so accept that shape.
|
|
20620
|
+
name: nullableToOptionalString,
|
|
20611
20621
|
artifact: anyType().optional(),
|
|
20612
20622
|
status: enumType(["success", "error"]),
|
|
20613
20623
|
additional_kwargs: recordType(stringType(), unknownType()).optional()
|
|
@@ -20759,7 +20769,7 @@ function getAuthHeaders(auth) {
|
|
|
20759
20769
|
}
|
|
20760
20770
|
return {};
|
|
20761
20771
|
}
|
|
20762
|
-
function
|
|
20772
|
+
function getAthenaApiBaseUrl(backendUrl) {
|
|
20763
20773
|
const stripped = backendUrl.replace(/\/api\/assistant-ui\/?$/, "");
|
|
20764
20774
|
if (stripped === backendUrl) {
|
|
20765
20775
|
return backendUrl.replace(/\/$/, "");
|
|
@@ -20767,14 +20777,16 @@ function getAgoraBaseUrl(backendUrl) {
|
|
|
20767
20777
|
return stripped;
|
|
20768
20778
|
}
|
|
20769
20779
|
async function listThreads(backendUrl, auth, opts = {}) {
|
|
20770
|
-
const base2 =
|
|
20780
|
+
const base2 = getAthenaApiBaseUrl(backendUrl);
|
|
20771
20781
|
const res = await fetch(`${base2}/api/conversations/threads/list`, {
|
|
20772
20782
|
method: "POST",
|
|
20773
20783
|
headers: { "Content-Type": "application/json", ...getAuthHeaders(auth) },
|
|
20774
20784
|
body: JSON.stringify({
|
|
20775
20785
|
limit: opts.limit ?? 50,
|
|
20776
20786
|
offset: opts.offset ?? 0,
|
|
20777
|
-
|
|
20787
|
+
// Default to the full recent-conversations set unless a caller
|
|
20788
|
+
// explicitly asks to hide triggered/background sessions.
|
|
20789
|
+
exclude_triggered: opts.exclude_triggered ?? false
|
|
20778
20790
|
})
|
|
20779
20791
|
});
|
|
20780
20792
|
if (!res.ok) {
|
|
@@ -20796,7 +20808,7 @@ function deserializeMessage(msg) {
|
|
|
20796
20808
|
return msg;
|
|
20797
20809
|
}
|
|
20798
20810
|
async function getThreadState(backendUrl, auth, threadId) {
|
|
20799
|
-
const base2 =
|
|
20811
|
+
const base2 = getAthenaApiBaseUrl(backendUrl);
|
|
20800
20812
|
const res = await fetch(`${base2}/api/unstable/threads/${threadId}`, {
|
|
20801
20813
|
method: "GET",
|
|
20802
20814
|
headers: { ...getAuthHeaders(auth) }
|
|
@@ -20811,7 +20823,7 @@ async function getThreadState(backendUrl, auth, threadId) {
|
|
|
20811
20823
|
return data;
|
|
20812
20824
|
}
|
|
20813
20825
|
async function archiveThread(backendUrl, auth, threadId) {
|
|
20814
|
-
const base2 =
|
|
20826
|
+
const base2 = getAthenaApiBaseUrl(backendUrl);
|
|
20815
20827
|
const res = await fetch(`${base2}/api/conversations/threads/archive`, {
|
|
20816
20828
|
method: "POST",
|
|
20817
20829
|
headers: { "Content-Type": "application/json", ...getAuthHeaders(auth) },
|
|
@@ -24625,6 +24637,15 @@ const themes = {
|
|
|
24625
24637
|
radius: "0.625rem"
|
|
24626
24638
|
}
|
|
24627
24639
|
};
|
|
24640
|
+
const resolveTokenOverride = ({
|
|
24641
|
+
config: config2,
|
|
24642
|
+
token
|
|
24643
|
+
}) => {
|
|
24644
|
+
if ((config2 == null ? void 0 : config2.token) !== void 0) {
|
|
24645
|
+
return config2.token;
|
|
24646
|
+
}
|
|
24647
|
+
return token;
|
|
24648
|
+
};
|
|
24628
24649
|
function AthenaStandalone({
|
|
24629
24650
|
children,
|
|
24630
24651
|
apiUrl,
|
|
@@ -24764,6 +24785,7 @@ function AthenaWithThreadList({
|
|
|
24764
24785
|
}
|
|
24765
24786
|
function AthenaProvider({
|
|
24766
24787
|
children,
|
|
24788
|
+
config: config2,
|
|
24767
24789
|
apiKey,
|
|
24768
24790
|
token: tokenProp,
|
|
24769
24791
|
agent: agent2,
|
|
@@ -24783,15 +24805,21 @@ function AthenaProvider({
|
|
|
24783
24805
|
}) {
|
|
24784
24806
|
const frontendToolNames = useMemo(() => Object.keys(frontendTools), [frontendTools]);
|
|
24785
24807
|
const themeStyleVars = useMemo(() => theme ? themeToStyleVars(theme) : void 0, [theme]);
|
|
24808
|
+
const configuredEnvironment = (config2 == null ? void 0 : config2.environment) ?? environment;
|
|
24786
24809
|
const environmentUrls = useMemo(
|
|
24787
|
-
() => getAthenaEnvironmentUrls({ environment }),
|
|
24788
|
-
[
|
|
24810
|
+
() => getAthenaEnvironmentUrls({ environment: configuredEnvironment }),
|
|
24811
|
+
[configuredEnvironment]
|
|
24789
24812
|
);
|
|
24813
|
+
const configuredApiKey = (config2 == null ? void 0 : config2.apiKey) ?? apiKey;
|
|
24814
|
+
const configuredToken = resolveTokenOverride({ config: config2, token: tokenProp });
|
|
24815
|
+
const configuredApiUrl = (config2 == null ? void 0 : config2.apiUrl) ?? apiUrl;
|
|
24816
|
+
const configuredBackendUrl = (config2 == null ? void 0 : config2.backendUrl) ?? backendUrl;
|
|
24817
|
+
const configuredAppUrl = (config2 == null ? void 0 : config2.appUrl) ?? appUrl;
|
|
24790
24818
|
const bridge = useParentBridge();
|
|
24791
|
-
const effectiveToken =
|
|
24792
|
-
const effectiveApiUrl =
|
|
24793
|
-
const effectiveBackendUrl =
|
|
24794
|
-
const effectiveAppUrl =
|
|
24819
|
+
const effectiveToken = configuredToken !== void 0 ? configuredToken : bridge.token;
|
|
24820
|
+
const effectiveApiUrl = configuredApiUrl ?? bridge.apiUrl ?? environmentUrls.apiUrl;
|
|
24821
|
+
const effectiveBackendUrl = configuredBackendUrl ?? bridge.backendUrl ?? environmentUrls.backendUrl;
|
|
24822
|
+
const effectiveAppUrl = configuredAppUrl ?? bridge.appUrl ?? deriveAthenaAppUrl({ apiUrl: effectiveApiUrl, backendUrl: effectiveBackendUrl }) ?? environmentUrls.appUrl;
|
|
24795
24823
|
if (!bridge.ready) {
|
|
24796
24824
|
return null;
|
|
24797
24825
|
}
|
|
@@ -24803,7 +24831,7 @@ function AthenaProvider({
|
|
|
24803
24831
|
apiUrl: effectiveApiUrl,
|
|
24804
24832
|
backendUrl: effectiveBackendUrl,
|
|
24805
24833
|
appUrl: effectiveAppUrl,
|
|
24806
|
-
apiKey,
|
|
24834
|
+
apiKey: configuredApiKey,
|
|
24807
24835
|
token: effectiveToken,
|
|
24808
24836
|
model,
|
|
24809
24837
|
agent: agent2,
|
|
@@ -24823,7 +24851,7 @@ function AthenaProvider({
|
|
|
24823
24851
|
apiUrl: effectiveApiUrl,
|
|
24824
24852
|
backendUrl: effectiveBackendUrl,
|
|
24825
24853
|
appUrl: effectiveAppUrl,
|
|
24826
|
-
apiKey,
|
|
24854
|
+
apiKey: configuredApiKey,
|
|
24827
24855
|
token: effectiveToken,
|
|
24828
24856
|
model,
|
|
24829
24857
|
agent: agent2,
|
|
@@ -60752,7 +60780,7 @@ const TiptapComposer = ({ tools = [] }) => {
|
|
|
60752
60780
|
composerRuntime.send();
|
|
60753
60781
|
}
|
|
60754
60782
|
editor2.commands.clearContent();
|
|
60755
|
-
}, [aui, composerRuntime, clearAttachments, clearQuote]);
|
|
60783
|
+
}, [aui, composerRuntime, clearAttachments, clearQuote, appUrl]);
|
|
60756
60784
|
const handleSubmitRef = useRef(handleSubmit);
|
|
60757
60785
|
handleSubmitRef.current = handleSubmit;
|
|
60758
60786
|
const editor = useEditor({
|
|
@@ -63662,9 +63690,6 @@ function useFileUpload() {
|
|
|
63662
63690
|
formData.append("files", file, file.name);
|
|
63663
63691
|
}
|
|
63664
63692
|
const baseUrl = backendUrl.replace(/\/api\/assistant-ui\/?$/, "");
|
|
63665
|
-
if (baseUrl === backendUrl) {
|
|
63666
|
-
console.warn("[AthenaSDK] useFileUpload: backendUrl does not end with /api/assistant-ui — upload URL may be incorrect:", `${baseUrl}/api/upload/`);
|
|
63667
|
-
}
|
|
63668
63693
|
const uploadUrl = `${baseUrl}/api/upload/`;
|
|
63669
63694
|
const headers = {};
|
|
63670
63695
|
if (token) {
|
|
@@ -63927,6 +63952,23 @@ const ComposerDropZone = ({
|
|
|
63927
63952
|
}
|
|
63928
63953
|
);
|
|
63929
63954
|
};
|
|
63955
|
+
function useSendMessage() {
|
|
63956
|
+
const aui = useAui();
|
|
63957
|
+
return useCallback(
|
|
63958
|
+
async (text2, options) => {
|
|
63959
|
+
if (!text2.trim()) return;
|
|
63960
|
+
const composer = aui.composer();
|
|
63961
|
+
const currentText = composer.getState().text;
|
|
63962
|
+
const shouldReplace = (options == null ? void 0 : options.replace) ?? true;
|
|
63963
|
+
composer.setText(
|
|
63964
|
+
shouldReplace || !currentText ? text2 : `${currentText}
|
|
63965
|
+
${text2}`
|
|
63966
|
+
);
|
|
63967
|
+
await composer.send();
|
|
63968
|
+
},
|
|
63969
|
+
[aui]
|
|
63970
|
+
);
|
|
63971
|
+
}
|
|
63930
63972
|
const EMPTY_MENTION_TOOLS = [];
|
|
63931
63973
|
function QuotePostMessageBridge() {
|
|
63932
63974
|
useQuoteFromPostMessage();
|
|
@@ -63958,14 +64000,11 @@ const SuggestionCard = ({
|
|
|
63958
64000
|
suggestion,
|
|
63959
64001
|
index: index2
|
|
63960
64002
|
}) => {
|
|
63961
|
-
const aui = useAui();
|
|
63962
64003
|
const Icon2 = suggestion.icon;
|
|
64004
|
+
const sendMessage = useSendMessage();
|
|
63963
64005
|
const handleClick2 = useCallback(() => {
|
|
63964
|
-
|
|
63965
|
-
|
|
63966
|
-
content: [{ type: "text", text: suggestion.prompt }]
|
|
63967
|
-
});
|
|
63968
|
-
}, [aui, suggestion.prompt]);
|
|
64006
|
+
void sendMessage(suggestion.prompt);
|
|
64007
|
+
}, [sendMessage, suggestion.prompt]);
|
|
63969
64008
|
return /* @__PURE__ */ jsxs(
|
|
63970
64009
|
"button",
|
|
63971
64010
|
{
|
|
@@ -64112,7 +64151,7 @@ const ComposerSendWithQuote = () => {
|
|
|
64112
64151
|
editor == null ? void 0 : editor.clear();
|
|
64113
64152
|
clearQuote();
|
|
64114
64153
|
clearAttachments();
|
|
64115
|
-
}, [aui, quote, attachments, isUploading, clearQuote, clearAttachments, editorRef]);
|
|
64154
|
+
}, [aui, quote, attachments, isUploading, clearQuote, clearAttachments, editorRef, appUrl]);
|
|
64116
64155
|
if (hasExtras) {
|
|
64117
64156
|
return /* @__PURE__ */ jsx(
|
|
64118
64157
|
TooltipIconButton,
|
|
@@ -64265,8 +64304,8 @@ function useAssetEmbed(assetId, options = {
|
|
|
64265
64304
|
setError(null);
|
|
64266
64305
|
return;
|
|
64267
64306
|
}
|
|
64268
|
-
const
|
|
64269
|
-
const endpoint = `${
|
|
64307
|
+
const apiBaseUrl = backendUrl.replace(/\/api\/assistant-ui\/?$/, "");
|
|
64308
|
+
const endpoint = `${apiBaseUrl}/api/embed/generate-token`;
|
|
64270
64309
|
(_a2 = abortRef.current) == null ? void 0 : _a2.abort();
|
|
64271
64310
|
const controller = new AbortController();
|
|
64272
64311
|
abortRef.current = controller;
|
|
@@ -64754,6 +64793,7 @@ export {
|
|
|
64754
64793
|
useParentAuth,
|
|
64755
64794
|
useParentBridge,
|
|
64756
64795
|
useQuote,
|
|
64757
|
-
useRefreshThreadList
|
|
64796
|
+
useRefreshThreadList,
|
|
64797
|
+
useSendMessage
|
|
64758
64798
|
};
|
|
64759
64799
|
//# sourceMappingURL=index.js.map
|