@smartspace/chat-ui 1.13.1-pr.249.63aeeb3 → 1.13.1-pr.252.acadb9f
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.d.ts +1 -5
- package/dist/index.js +9 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1147,11 +1147,7 @@ declare const messagesListOptions: (service: ChatService, threadId: string, opts
|
|
|
1147
1147
|
[dataTagErrorSymbol]: Error;
|
|
1148
1148
|
};
|
|
1149
1149
|
};
|
|
1150
|
-
declare function useMessages(threadId: string,
|
|
1151
|
-
take?: number;
|
|
1152
|
-
skip?: number;
|
|
1153
|
-
skipWhenNewThread?: boolean;
|
|
1154
|
-
}): _tanstack_react_query.UseQueryResult<Message[], Error>;
|
|
1150
|
+
declare function useMessages(threadId: string): _tanstack_react_query.UseQueryResult<Message[], Error>;
|
|
1155
1151
|
|
|
1156
1152
|
declare const useFileMutations: (scope: FileScope) => {
|
|
1157
1153
|
uploadFilesMutation: _tanstack_react_query.UseMutationResult<FileInfo$1[], Error, File[], unknown>;
|
package/dist/index.js
CHANGED
|
@@ -3459,10 +3459,10 @@ function useSendMessage() {
|
|
|
3459
3459
|
if (!threadId) throw new Error("Thread ID is required");
|
|
3460
3460
|
if (!workspaceId) throw new Error("Workspace ID is required");
|
|
3461
3461
|
const optimistic = {
|
|
3462
|
-
id: `temp-${
|
|
3462
|
+
id: `temp-${Date.now()}`,
|
|
3463
3463
|
values: [
|
|
3464
3464
|
{
|
|
3465
|
-
id: `temp-${
|
|
3465
|
+
id: `temp-${Date.now()}-prompt`,
|
|
3466
3466
|
type: "Input" /* INPUT */,
|
|
3467
3467
|
name: "prompt",
|
|
3468
3468
|
value: contentList,
|
|
@@ -3473,7 +3473,7 @@ function useSendMessage() {
|
|
|
3473
3473
|
},
|
|
3474
3474
|
...files?.length ? [
|
|
3475
3475
|
{
|
|
3476
|
-
id: `temp-${
|
|
3476
|
+
id: `temp-${Date.now()}-files`,
|
|
3477
3477
|
type: "Input" /* INPUT */,
|
|
3478
3478
|
name: "files",
|
|
3479
3479
|
value: files,
|
|
@@ -3485,7 +3485,7 @@ function useSendMessage() {
|
|
|
3485
3485
|
] : [],
|
|
3486
3486
|
...variables && Object.keys(variables).length ? [
|
|
3487
3487
|
{
|
|
3488
|
-
id: `temp-${
|
|
3488
|
+
id: `temp-${Date.now()}-vars`,
|
|
3489
3489
|
type: "Input" /* INPUT */,
|
|
3490
3490
|
name: "variables",
|
|
3491
3491
|
value: variables,
|
|
@@ -3627,10 +3627,7 @@ var workspaceDetailOptions = ({
|
|
|
3627
3627
|
});
|
|
3628
3628
|
function useWorkspace(workspaceId) {
|
|
3629
3629
|
const service = useChatService();
|
|
3630
|
-
return useQuery({
|
|
3631
|
-
...workspaceDetailOptions({ service, workspaceId }),
|
|
3632
|
-
enabled: !!workspaceId
|
|
3633
|
-
});
|
|
3630
|
+
return useQuery(workspaceDetailOptions({ service, workspaceId }));
|
|
3634
3631
|
}
|
|
3635
3632
|
var taggableUsersOptions = ({
|
|
3636
3633
|
service,
|
|
@@ -4245,15 +4242,13 @@ var messagesListOptions = (service, threadId, opts) => queryOptions({
|
|
|
4245
4242
|
// Avoid re-fetching the entire thread on every small navigation.
|
|
4246
4243
|
staleTime: 3e4
|
|
4247
4244
|
});
|
|
4248
|
-
function useMessages(threadId
|
|
4245
|
+
function useMessages(threadId) {
|
|
4249
4246
|
const service = useChatService();
|
|
4250
4247
|
const isDraft = isDraftThreadId(threadId);
|
|
4251
|
-
const skipFetch = opts?.skipWhenNewThread || !threadId || isDraft;
|
|
4252
|
-
const listOpts = opts?.take != null || opts?.skip != null ? { take: opts.take, skip: opts.skip } : void 0;
|
|
4253
4248
|
return useQuery({
|
|
4254
|
-
...messagesListOptions(service, threadId
|
|
4255
|
-
enabled:
|
|
4256
|
-
initialData:
|
|
4249
|
+
...messagesListOptions(service, threadId),
|
|
4250
|
+
enabled: !!threadId && !isDraft,
|
|
4251
|
+
initialData: !threadId || isDraft ? [] : void 0
|
|
4257
4252
|
});
|
|
4258
4253
|
}
|
|
4259
4254
|
|