@meistrari/chat-nuxt 3.15.1-rc.0 → 3.16.0-rc.0
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/module.json +1 -1
- package/dist/runtime/conversations/composables/conversations.d.ts +2 -0
- package/dist/runtime/conversations/composables/conversations.js +9 -4
- package/dist/runtime/embed/components/chat-embed-inner.vue +48 -2
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.d.vue.ts +4 -0
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue +2 -0
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue.d.ts +4 -0
- package/dist/runtime/messages/components/chat-message-input.d.vue.ts +4 -0
- package/dist/runtime/messages/components/chat-message-input.vue +6 -0
- package/dist/runtime/messages/components/chat-message-input.vue.d.ts +4 -0
- package/dist/runtime/messages/components/chat-reasoning-effort-selector.d.vue.ts +15 -0
- package/dist/runtime/messages/components/chat-reasoning-effort-selector.vue +164 -0
- package/dist/runtime/messages/components/chat-reasoning-effort-selector.vue.d.ts +15 -0
- package/dist/runtime/messages/composables/chat.d.ts +4 -1
- package/dist/runtime/messages/composables/chat.js +21 -5
- package/dist/runtime/types/schemas/chat/conversations.d.ts +28 -0
- package/dist/runtime/types/schemas/chat/conversations.js +6 -1
- package/dist/runtime/types/schemas/chat/messages.d.ts +0 -4
- package/dist/runtime/types/schemas/chat/messages.js +0 -3
- package/dist/runtime/types/schemas/chat/models.d.ts +10 -0
- package/dist/runtime/types/schemas/chat/models.js +6 -0
- package/dist/runtime/types/schemas/chat/ui.d.ts +27 -1
- package/dist/runtime/types/schemas/chat/ui.js +8 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DeepReadonly } from 'vue';
|
|
2
2
|
import type { Conversation, ConversationWithMessages, CreateConversationRequest } from '../../types/schemas/chat/conversations.js';
|
|
3
|
+
import type { ChatReasoningEffort } from '../../types/schemas/chat/models.js';
|
|
3
4
|
export declare function mergeFetchedConversations(fetchedConversations: Conversation[], localConversations: readonly Conversation[], deletedConversationIds?: readonly string[], locallyMutatedConversationIds?: readonly string[]): Conversation[];
|
|
4
5
|
export declare function useConversations(): {
|
|
5
6
|
conversations: any;
|
|
@@ -12,6 +13,7 @@ export declare function useConversations(): {
|
|
|
12
13
|
deleteConversation: (id: string) => Promise<boolean>;
|
|
13
14
|
renameConversation: (id: string, title: string) => Promise<boolean>;
|
|
14
15
|
updateConversationModel: (id: string, model: string | null) => Promise<boolean>;
|
|
16
|
+
updateConversationReasoningEffort: (id: string, reasoningEffort: ChatReasoningEffort | null) => Promise<boolean>;
|
|
15
17
|
moveConversationToGroup: (id: string, groupId: string | null) => Promise<boolean>;
|
|
16
18
|
duplicateConversation: (id: string) => Promise<ConversationWithMessages | null>;
|
|
17
19
|
conversationCreatorFilter: any;
|
|
@@ -319,6 +319,7 @@ export function useConversations() {
|
|
|
319
319
|
title: "Nova conversa",
|
|
320
320
|
threadSessionId: null,
|
|
321
321
|
model: input?.model ?? null,
|
|
322
|
+
reasoningEffort: input?.reasoningEffort ?? null,
|
|
322
323
|
appliedSettingsAt: null,
|
|
323
324
|
appliedSettingsSnapshot: null,
|
|
324
325
|
telaAgentId: embedConfig?.telaAgentId.value ?? null,
|
|
@@ -332,6 +333,7 @@ export function useConversations() {
|
|
|
332
333
|
try {
|
|
333
334
|
const body = {
|
|
334
335
|
...input?.model !== void 0 ? { model: input.model } : {},
|
|
336
|
+
...input?.reasoningEffort !== void 0 ? { reasoningEffort: input.reasoningEffort } : {},
|
|
335
337
|
...input?.agentInputs !== void 0 ? { agentInputs: input.agentInputs } : {}
|
|
336
338
|
};
|
|
337
339
|
const conversation = await $fetch(
|
|
@@ -464,7 +466,7 @@ export function useConversations() {
|
|
|
464
466
|
return false;
|
|
465
467
|
}
|
|
466
468
|
};
|
|
467
|
-
const
|
|
469
|
+
const patchConversationSetting = (id, patch, fallbackErrorMessage) => {
|
|
468
470
|
const previousUpdate = modelUpdateTails.get(id) ?? Promise.resolve(true);
|
|
469
471
|
const update = previousUpdate.catch(() => false).then(async () => {
|
|
470
472
|
error.value = null;
|
|
@@ -473,20 +475,20 @@ export function useConversations() {
|
|
|
473
475
|
const conversationSnapshot = snapshotConversationBuckets(affectedScopes);
|
|
474
476
|
const conversation = findConversationInLoadedBuckets(id, requestRuntimeScope);
|
|
475
477
|
if (conversation)
|
|
476
|
-
updateConversationInLoadedBuckets({ ...conversation,
|
|
478
|
+
updateConversationInLoadedBuckets({ ...conversation, ...patch, updatedAt: /* @__PURE__ */ new Date() }, requestRuntimeScope);
|
|
477
479
|
try {
|
|
478
480
|
const updated = await $fetch(
|
|
479
481
|
chatApi.path(`/conversations/${id}`),
|
|
480
482
|
chatApi.withChatHeaders({
|
|
481
483
|
method: "PATCH",
|
|
482
|
-
body:
|
|
484
|
+
body: patch
|
|
483
485
|
})
|
|
484
486
|
);
|
|
485
487
|
updateConversationInLoadedBuckets(updated, requestRuntimeScope);
|
|
486
488
|
return true;
|
|
487
489
|
} catch (err) {
|
|
488
490
|
restoreConversationBuckets(conversationSnapshot, id);
|
|
489
|
-
const message = err instanceof Error ? err.message :
|
|
491
|
+
const message = err instanceof Error ? err.message : fallbackErrorMessage;
|
|
490
492
|
error.value = message;
|
|
491
493
|
Sentry.captureException(err);
|
|
492
494
|
return false;
|
|
@@ -500,6 +502,8 @@ export function useConversations() {
|
|
|
500
502
|
void update.then(clearUpdate, clearUpdate);
|
|
501
503
|
return update;
|
|
502
504
|
};
|
|
505
|
+
const updateConversationModel = (id, model) => patchConversationSetting(id, { model }, "Erro ao atualizar modelo da conversa");
|
|
506
|
+
const updateConversationReasoningEffort = (id, reasoningEffort) => patchConversationSetting(id, { reasoningEffort }, "Erro ao atualizar o esfor\xE7o de racioc\xEDnio da conversa");
|
|
503
507
|
const duplicateConversation = async (id) => {
|
|
504
508
|
error.value = null;
|
|
505
509
|
const statusToast = useStatusToast();
|
|
@@ -537,6 +541,7 @@ export function useConversations() {
|
|
|
537
541
|
deleteConversation,
|
|
538
542
|
renameConversation,
|
|
539
543
|
updateConversationModel,
|
|
544
|
+
updateConversationReasoningEffort,
|
|
540
545
|
moveConversationToGroup,
|
|
541
546
|
duplicateConversation,
|
|
542
547
|
conversationCreatorFilter,
|
|
@@ -80,6 +80,7 @@ const {
|
|
|
80
80
|
deleteConversation,
|
|
81
81
|
renameConversation,
|
|
82
82
|
updateConversationModel,
|
|
83
|
+
updateConversationReasoningEffort,
|
|
83
84
|
duplicateConversation,
|
|
84
85
|
moveConversationToGroup,
|
|
85
86
|
updateConversationInList,
|
|
@@ -185,6 +186,8 @@ const {
|
|
|
185
186
|
adoptConversation,
|
|
186
187
|
setConversationModel,
|
|
187
188
|
pendingModelSelection,
|
|
189
|
+
setConversationReasoningEffort,
|
|
190
|
+
pendingReasoningEffortSelection,
|
|
188
191
|
sendMessage,
|
|
189
192
|
flushOutboundQueue,
|
|
190
193
|
failOutboundQueue,
|
|
@@ -200,6 +203,8 @@ const {
|
|
|
200
203
|
});
|
|
201
204
|
const agentWake = useAgentWake();
|
|
202
205
|
const modelUpdateInFlight = ref(null);
|
|
206
|
+
const reasoningEffortUpdateInFlight = ref(null);
|
|
207
|
+
const REASONING_EFFORT_UPDATE_FAILED_MESSAGE = "N\xE3o foi poss\xEDvel atualizar o esfor\xE7o de racioc\xEDnio da conversa";
|
|
203
208
|
watch(chatError, (message) => {
|
|
204
209
|
if (message)
|
|
205
210
|
statusToast.update({ text: message, icon: "i-ph-warning" });
|
|
@@ -234,6 +239,29 @@ async function waitForPendingModelUpdate() {
|
|
|
234
239
|
throw new Error(MODEL_UPDATE_FAILED_MESSAGE);
|
|
235
240
|
}
|
|
236
241
|
}
|
|
242
|
+
function persistConversationReasoningEffort(conversation, value) {
|
|
243
|
+
const previousEffort = conversation.reasoningEffort ?? null;
|
|
244
|
+
setConversationReasoningEffort(value);
|
|
245
|
+
const update = updateConversationReasoningEffort(conversation.id, value).then((updated) => {
|
|
246
|
+
if (!updated && currentConversation.value?.id === conversation.id && (currentConversation.value.reasoningEffort ?? null) === value) {
|
|
247
|
+
setConversationReasoningEffort(previousEffort);
|
|
248
|
+
}
|
|
249
|
+
return updated;
|
|
250
|
+
});
|
|
251
|
+
const trackedUpdate = update.finally(() => {
|
|
252
|
+
if (reasoningEffortUpdateInFlight.value === trackedUpdate)
|
|
253
|
+
reasoningEffortUpdateInFlight.value = null;
|
|
254
|
+
});
|
|
255
|
+
reasoningEffortUpdateInFlight.value = trackedUpdate;
|
|
256
|
+
return trackedUpdate;
|
|
257
|
+
}
|
|
258
|
+
async function waitForPendingReasoningEffortUpdate() {
|
|
259
|
+
while (reasoningEffortUpdateInFlight.value) {
|
|
260
|
+
const update = reasoningEffortUpdateInFlight.value;
|
|
261
|
+
if (!await update)
|
|
262
|
+
throw new Error(REASONING_EFFORT_UPDATE_FAILED_MESSAGE);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
237
265
|
const selectedModel = computed({
|
|
238
266
|
get: () => resolveChatModelSelection(
|
|
239
267
|
currentConversation.value ? currentConversation.value.model : pendingModelSelection.value,
|
|
@@ -247,6 +275,15 @@ const selectedModel = computed({
|
|
|
247
275
|
void persistConversationModel(conversation, resolvedValue, true);
|
|
248
276
|
}
|
|
249
277
|
});
|
|
278
|
+
const selectedReasoningEffort = computed({
|
|
279
|
+
get: () => currentConversation.value ? currentConversation.value.reasoningEffort ?? null : pendingReasoningEffortSelection.value,
|
|
280
|
+
set: (value) => {
|
|
281
|
+
pendingReasoningEffortSelection.value = value;
|
|
282
|
+
const conversation = currentConversation.value;
|
|
283
|
+
if (conversation && (conversation.reasoningEffort ?? null) !== value)
|
|
284
|
+
void persistConversationReasoningEffort(conversation, value);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
250
287
|
const filesCount = computed(() => total.value);
|
|
251
288
|
const hasMessages = computed(() => messages.value.length > 0);
|
|
252
289
|
const mobilePreviewFile = computed(() => {
|
|
@@ -489,6 +526,7 @@ async function handleSend(content, files, agentInputs) {
|
|
|
489
526
|
if (!activeConversationId.value || !currentConversation.value) {
|
|
490
527
|
const conversation2 = await createConversation({
|
|
491
528
|
model: selectedModel.value,
|
|
529
|
+
reasoningEffort: selectedReasoningEffort.value,
|
|
492
530
|
...resolvedAgentInputs !== void 0 ? { agentInputs: resolvedAgentInputs } : {}
|
|
493
531
|
});
|
|
494
532
|
if (!conversation2)
|
|
@@ -500,6 +538,7 @@ async function handleSend(content, files, agentInputs) {
|
|
|
500
538
|
updateConversationId(conversation2.id);
|
|
501
539
|
}
|
|
502
540
|
await waitForPendingModelUpdate();
|
|
541
|
+
await waitForPendingReasoningEffortUpdate();
|
|
503
542
|
const conversation = currentConversation.value;
|
|
504
543
|
if (!conversation)
|
|
505
544
|
throw new Error("Erro ao preparar conversa");
|
|
@@ -561,6 +600,7 @@ async function handleCancel() {
|
|
|
561
600
|
async function handleRetry(messageId) {
|
|
562
601
|
await retryMessage(messageId, async () => {
|
|
563
602
|
await waitForPendingModelUpdate();
|
|
603
|
+
await waitForPendingReasoningEffortUpdate();
|
|
564
604
|
const conversation = currentConversation.value;
|
|
565
605
|
if (!conversation)
|
|
566
606
|
throw new Error("Erro ao preparar conversa");
|
|
@@ -574,9 +614,8 @@ async function handleRetry(messageId) {
|
|
|
574
614
|
if (wake.status !== "ready")
|
|
575
615
|
throw new Error("N\xE3o foi poss\xEDvel acordar o agente. Tente novamente.");
|
|
576
616
|
} else {
|
|
577
|
-
|
|
617
|
+
agentWake.consume();
|
|
578
618
|
}
|
|
579
|
-
return claimableWakeSessionId();
|
|
580
619
|
});
|
|
581
620
|
}
|
|
582
621
|
async function handleNewConversation(groupId) {
|
|
@@ -857,6 +896,7 @@ async function handleDelete() {
|
|
|
857
896
|
v-model:drawer-open="drawerOpen"
|
|
858
897
|
v-model:edit-title="editTitle"
|
|
859
898
|
v-model:selected-model="selectedModel"
|
|
899
|
+
v-model:selected-reasoning-effort="selectedReasoningEffort"
|
|
860
900
|
v-model:workspace-sheet-open="workspaceSheetOpen"
|
|
861
901
|
:current-conversation="currentConversation"
|
|
862
902
|
:display-title="displayTitle"
|
|
@@ -918,6 +958,7 @@ async function handleDelete() {
|
|
|
918
958
|
/>
|
|
919
959
|
<ChatMessageInput
|
|
920
960
|
v-model:selected-model="selectedModel"
|
|
961
|
+
v-model:selected-reasoning-effort="selectedReasoningEffort"
|
|
921
962
|
:disabled="true"
|
|
922
963
|
:agent-input-schema="visibleTelaAgentInputSchema"
|
|
923
964
|
:agent-input-schema-loading="visibleTelaAgentInputSchemaLoading"
|
|
@@ -948,6 +989,7 @@ async function handleDelete() {
|
|
|
948
989
|
<ChatMessageInput
|
|
949
990
|
ref="messageInputRef"
|
|
950
991
|
v-model:selected-model="selectedModel"
|
|
992
|
+
v-model:selected-reasoning-effort="selectedReasoningEffort"
|
|
951
993
|
:loading="composerLocked"
|
|
952
994
|
:creator-name="currentUser?.name ?? void 0"
|
|
953
995
|
:creator-email="
|
|
@@ -981,6 +1023,7 @@ async function handleDelete() {
|
|
|
981
1023
|
<ChatMessageInput
|
|
982
1024
|
ref="messageInputRef"
|
|
983
1025
|
v-model:selected-model="selectedModel"
|
|
1026
|
+
v-model:selected-reasoning-effort="selectedReasoningEffort"
|
|
984
1027
|
:loading="composerLocked"
|
|
985
1028
|
:creator-name="currentUser?.name ?? void 0"
|
|
986
1029
|
:creator-email="
|
|
@@ -1109,6 +1152,7 @@ async function handleDelete() {
|
|
|
1109
1152
|
/>
|
|
1110
1153
|
<ChatMessageInput
|
|
1111
1154
|
v-model:selected-model="selectedModel"
|
|
1155
|
+
v-model:selected-reasoning-effort="selectedReasoningEffort"
|
|
1112
1156
|
:disabled="true"
|
|
1113
1157
|
:agent-input-schema="visibleTelaAgentInputSchema"
|
|
1114
1158
|
:agent-input-schema-loading="visibleTelaAgentInputSchemaLoading"
|
|
@@ -1145,6 +1189,7 @@ async function handleDelete() {
|
|
|
1145
1189
|
<ChatMessageInput
|
|
1146
1190
|
ref="messageInputRef"
|
|
1147
1191
|
v-model:selected-model="selectedModel"
|
|
1192
|
+
v-model:selected-reasoning-effort="selectedReasoningEffort"
|
|
1148
1193
|
:loading="composerLocked"
|
|
1149
1194
|
:creator-name="currentUser?.name ?? void 0"
|
|
1150
1195
|
:creator-email="
|
|
@@ -1181,6 +1226,7 @@ async function handleDelete() {
|
|
|
1181
1226
|
<ChatMessageInput
|
|
1182
1227
|
ref="messageInputRef"
|
|
1183
1228
|
v-model:selected-model="selectedModel"
|
|
1229
|
+
v-model:selected-reasoning-effort="selectedReasoningEffort"
|
|
1184
1230
|
:loading="composerLocked"
|
|
1185
1231
|
:creator-name="currentUser?.name ?? void 0"
|
|
1186
1232
|
:creator-email="
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DeepReadonly } from 'vue';
|
|
2
2
|
import type { Conversation, ConversationWithMessages, Message } from '../../../types/schemas/chat/conversations.js';
|
|
3
3
|
import type { ConversationFile } from '../../../types/schemas/chat/files.js';
|
|
4
|
+
import type { ChatReasoningEffort } from '../../../types/schemas/chat/models.js';
|
|
4
5
|
import type { TopbarTab } from '../../../types/schemas/chat/ui.js';
|
|
5
6
|
import type { WorkspaceSettingsResponse as WorkspaceSettings } from '../../../types/schemas/chat/workspace-settings.js';
|
|
6
7
|
import type { TelaAgentContextFile, TelaAgentInputVariable, TelaAgentSkill } from '../../../types/schemas/integrations/tela-agent-api.js';
|
|
@@ -43,6 +44,7 @@ type __VLS_Props = {
|
|
|
43
44
|
};
|
|
44
45
|
type __VLS_ModelProps = {
|
|
45
46
|
'selectedModel'?: string | null;
|
|
47
|
+
'selectedReasoningEffort'?: ChatReasoningEffort | null;
|
|
46
48
|
};
|
|
47
49
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
48
50
|
declare var __VLS_54: {}, __VLS_99: {}, __VLS_101: {};
|
|
@@ -55,6 +57,7 @@ type __VLS_Slots = {} & {
|
|
|
55
57
|
};
|
|
56
58
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
57
59
|
"update:selectedModel": (value: string | null) => any;
|
|
60
|
+
"update:selectedReasoningEffort": (value: any) => any;
|
|
58
61
|
} & {
|
|
59
62
|
delete: () => any;
|
|
60
63
|
cancel: () => any;
|
|
@@ -87,6 +90,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
87
90
|
onSettings?: (() => any) | undefined;
|
|
88
91
|
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
89
92
|
"onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
|
|
93
|
+
"onUpdate:selectedReasoningEffort"?: ((value: any) => any) | undefined;
|
|
90
94
|
onDebug?: (() => any) | undefined;
|
|
91
95
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
92
96
|
onNewConversation?: ((groupId?: string | null | undefined) => any) | undefined;
|
|
@@ -48,6 +48,7 @@ const props = defineProps({
|
|
|
48
48
|
});
|
|
49
49
|
const emit = defineEmits(["cancel", "cancelEditing", "copyLink", "debug", "delete", "dismissOutdatedBanner", "duplicate", "export", "newConversation", "rename", "saveTitle", "selectConversation", "send", "settings", "signout", "switchWorkspace", "tabChange", "update:drawerOpen", "update:editTitle", "update:workspaceSheetOpen"]);
|
|
50
50
|
const selectedModel = defineModel("selectedModel", { type: [String, null], ...{ default: null } });
|
|
51
|
+
const selectedReasoningEffort = defineModel("selectedReasoningEffort", { type: null, ...{ default: null } });
|
|
51
52
|
const renameInputRef = ref(null);
|
|
52
53
|
const homeInputRef = ref(null);
|
|
53
54
|
const outdatedSettingsSheetOpen = ref(false);
|
|
@@ -225,6 +226,7 @@ function startNewConversationFromOutdatedSettings() {
|
|
|
225
226
|
<ChatMessageInput
|
|
226
227
|
ref="homeInputRef"
|
|
227
228
|
v-model:selected-model="selectedModel"
|
|
229
|
+
v-model:selected-reasoning-effort="selectedReasoningEffort"
|
|
228
230
|
:loading="hasPendingMessage"
|
|
229
231
|
:creator-name="currentUser?.name ?? void 0"
|
|
230
232
|
:creator-email="currentUser?.email ?? void 0"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DeepReadonly } from 'vue';
|
|
2
2
|
import type { Conversation, ConversationWithMessages, Message } from '../../../types/schemas/chat/conversations.js';
|
|
3
3
|
import type { ConversationFile } from '../../../types/schemas/chat/files.js';
|
|
4
|
+
import type { ChatReasoningEffort } from '../../../types/schemas/chat/models.js';
|
|
4
5
|
import type { TopbarTab } from '../../../types/schemas/chat/ui.js';
|
|
5
6
|
import type { WorkspaceSettingsResponse as WorkspaceSettings } from '../../../types/schemas/chat/workspace-settings.js';
|
|
6
7
|
import type { TelaAgentContextFile, TelaAgentInputVariable, TelaAgentSkill } from '../../../types/schemas/integrations/tela-agent-api.js';
|
|
@@ -43,6 +44,7 @@ type __VLS_Props = {
|
|
|
43
44
|
};
|
|
44
45
|
type __VLS_ModelProps = {
|
|
45
46
|
'selectedModel'?: string | null;
|
|
47
|
+
'selectedReasoningEffort'?: ChatReasoningEffort | null;
|
|
46
48
|
};
|
|
47
49
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
48
50
|
declare var __VLS_54: {}, __VLS_99: {}, __VLS_101: {};
|
|
@@ -55,6 +57,7 @@ type __VLS_Slots = {} & {
|
|
|
55
57
|
};
|
|
56
58
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
57
59
|
"update:selectedModel": (value: string | null) => any;
|
|
60
|
+
"update:selectedReasoningEffort": (value: any) => any;
|
|
58
61
|
} & {
|
|
59
62
|
delete: () => any;
|
|
60
63
|
cancel: () => any;
|
|
@@ -87,6 +90,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
87
90
|
onSettings?: (() => any) | undefined;
|
|
88
91
|
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
89
92
|
"onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
|
|
93
|
+
"onUpdate:selectedReasoningEffort"?: ((value: any) => any) | undefined;
|
|
90
94
|
onDebug?: (() => any) | undefined;
|
|
91
95
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
92
96
|
onNewConversation?: ((groupId?: string | null | undefined) => any) | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DeepReadonly } from 'vue';
|
|
2
2
|
import type { Message } from '../../types/schemas/chat/conversations.js';
|
|
3
|
+
import type { ChatReasoningEffort } from '../../types/schemas/chat/models.js';
|
|
3
4
|
import type { ConversationFile, FileUploadInput } from '../../types/schemas/chat/files.js';
|
|
4
5
|
import type { WorkspaceSettingsResponse as WorkspaceSettings } from '../../types/schemas/chat/workspace-settings.js';
|
|
5
6
|
import type { TelaAgentContextFile, TelaAgentExecutionInput, TelaAgentInputVariable, TelaAgentSkill } from '../../types/schemas/integrations/tela-agent-api.js';
|
|
@@ -29,6 +30,7 @@ declare function restoreDraft(draft: {
|
|
|
29
30
|
declare function setDraft(text: string): void;
|
|
30
31
|
type __VLS_ModelProps = {
|
|
31
32
|
'selectedModel'?: string | null;
|
|
33
|
+
'selectedReasoningEffort'?: ChatReasoningEffort | null;
|
|
32
34
|
};
|
|
33
35
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
34
36
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
@@ -37,6 +39,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
37
39
|
setDraft: typeof setDraft;
|
|
38
40
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
39
41
|
"update:selectedModel": (value: string | null) => any;
|
|
42
|
+
"update:selectedReasoningEffort": (value: any) => any;
|
|
40
43
|
} & {
|
|
41
44
|
cancel: () => any;
|
|
42
45
|
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
@@ -44,6 +47,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
44
47
|
onCancel?: (() => any) | undefined;
|
|
45
48
|
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
46
49
|
"onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
|
|
50
|
+
"onUpdate:selectedReasoningEffort"?: ((value: any) => any) | undefined;
|
|
47
51
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
48
52
|
declare const _default: typeof __VLS_export;
|
|
49
53
|
export default _default;
|
|
@@ -26,6 +26,7 @@ const props = defineProps({
|
|
|
26
26
|
});
|
|
27
27
|
const emit = defineEmits(["send", "cancel"]);
|
|
28
28
|
const selectedModel = defineModel("selectedModel", { type: [String, null], ...{ default: null } });
|
|
29
|
+
const selectedReasoningEffort = defineModel("selectedReasoningEffort", { type: null, ...{ default: null } });
|
|
29
30
|
const { uploadFiles, uploading, uploadError } = useFileUpload();
|
|
30
31
|
const isCancelEnabled = computed(() => props.showCancelButton === true);
|
|
31
32
|
const content = ref("");
|
|
@@ -757,6 +758,11 @@ defineExpose({
|
|
|
757
758
|
</TelaChatPromptInputTools>
|
|
758
759
|
|
|
759
760
|
<TelaChatPromptInputActions>
|
|
761
|
+
<ChatReasoningEffortSelector
|
|
762
|
+
v-model="selectedReasoningEffort"
|
|
763
|
+
:disabled="isLocked"
|
|
764
|
+
@click.stop
|
|
765
|
+
/>
|
|
760
766
|
<ChatModelSelector
|
|
761
767
|
v-model="selectedModel"
|
|
762
768
|
:disabled="isLocked"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DeepReadonly } from 'vue';
|
|
2
2
|
import type { Message } from '../../types/schemas/chat/conversations.js';
|
|
3
|
+
import type { ChatReasoningEffort } from '../../types/schemas/chat/models.js';
|
|
3
4
|
import type { ConversationFile, FileUploadInput } from '../../types/schemas/chat/files.js';
|
|
4
5
|
import type { WorkspaceSettingsResponse as WorkspaceSettings } from '../../types/schemas/chat/workspace-settings.js';
|
|
5
6
|
import type { TelaAgentContextFile, TelaAgentExecutionInput, TelaAgentInputVariable, TelaAgentSkill } from '../../types/schemas/integrations/tela-agent-api.js';
|
|
@@ -29,6 +30,7 @@ declare function restoreDraft(draft: {
|
|
|
29
30
|
declare function setDraft(text: string): void;
|
|
30
31
|
type __VLS_ModelProps = {
|
|
31
32
|
'selectedModel'?: string | null;
|
|
33
|
+
'selectedReasoningEffort'?: ChatReasoningEffort | null;
|
|
32
34
|
};
|
|
33
35
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
34
36
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
@@ -37,6 +39,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
37
39
|
setDraft: typeof setDraft;
|
|
38
40
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
39
41
|
"update:selectedModel": (value: string | null) => any;
|
|
42
|
+
"update:selectedReasoningEffort": (value: any) => any;
|
|
40
43
|
} & {
|
|
41
44
|
cancel: () => any;
|
|
42
45
|
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
@@ -44,6 +47,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
44
47
|
onCancel?: (() => any) | undefined;
|
|
45
48
|
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
46
49
|
"onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
|
|
50
|
+
"onUpdate:selectedReasoningEffort"?: ((value: any) => any) | undefined;
|
|
47
51
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
48
52
|
declare const _default: typeof __VLS_export;
|
|
49
53
|
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChatReasoningEffort } from '../../types/schemas/chat/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
};
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
|
+
modelValue?: ChatReasoningEffort | null;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (value: any) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { chatReasoningEffortOptions } from "../../types/schemas/chat/ui.js";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
disabled: { type: Boolean, required: false }
|
|
5
|
+
});
|
|
6
|
+
const effort = defineModel({ type: null, ...{ default: null } });
|
|
7
|
+
const DEFAULT_LABEL = "Racioc\xEDnio";
|
|
8
|
+
const AGENT_DEFAULT_LABEL = "Padr\xE3o do agente";
|
|
9
|
+
const AGENT_DEFAULT_DESCRIPTION = "Usa o esfor\xE7o configurado no agente";
|
|
10
|
+
const options = chatReasoningEffortOptions;
|
|
11
|
+
const lastIndex = options.length - 1;
|
|
12
|
+
const open = ref(false);
|
|
13
|
+
const trackRef = ref(null);
|
|
14
|
+
const dragging = ref(false);
|
|
15
|
+
const selectedIndex = computed(() => effort.value ? options.findIndex((option) => option.value === effort.value) : -1);
|
|
16
|
+
const selectedOption = computed(() => selectedIndex.value >= 0 ? options[selectedIndex.value] : null);
|
|
17
|
+
const triggerLabel = computed(() => selectedOption.value?.label ?? DEFAULT_LABEL);
|
|
18
|
+
const fillPercent = computed(() => selectedIndex.value < 0 ? 0 : stopPercent(selectedIndex.value));
|
|
19
|
+
function stopPercent(index) {
|
|
20
|
+
return index / lastIndex * 100;
|
|
21
|
+
}
|
|
22
|
+
function select(index) {
|
|
23
|
+
if (props.disabled)
|
|
24
|
+
return;
|
|
25
|
+
const clamped = Math.min(Math.max(index, 0), lastIndex);
|
|
26
|
+
effort.value = options[clamped].value;
|
|
27
|
+
}
|
|
28
|
+
function reset() {
|
|
29
|
+
effort.value = null;
|
|
30
|
+
open.value = false;
|
|
31
|
+
}
|
|
32
|
+
function indexFromPointer(event) {
|
|
33
|
+
const rect = trackRef.value?.getBoundingClientRect();
|
|
34
|
+
if (!rect || rect.width === 0)
|
|
35
|
+
return null;
|
|
36
|
+
const ratio = (event.clientX - rect.left) / rect.width;
|
|
37
|
+
return Math.round(Math.min(Math.max(ratio, 0), 1) * lastIndex);
|
|
38
|
+
}
|
|
39
|
+
function onPointerDown(event) {
|
|
40
|
+
if (props.disabled || event.button !== 0)
|
|
41
|
+
return;
|
|
42
|
+
const index = indexFromPointer(event);
|
|
43
|
+
if (index === null)
|
|
44
|
+
return;
|
|
45
|
+
dragging.value = true;
|
|
46
|
+
trackRef.value?.setPointerCapture(event.pointerId);
|
|
47
|
+
trackRef.value?.focus();
|
|
48
|
+
select(index);
|
|
49
|
+
}
|
|
50
|
+
function onPointerMove(event) {
|
|
51
|
+
if (!dragging.value)
|
|
52
|
+
return;
|
|
53
|
+
const index = indexFromPointer(event);
|
|
54
|
+
if (index !== null && index !== selectedIndex.value)
|
|
55
|
+
select(index);
|
|
56
|
+
}
|
|
57
|
+
function onPointerUp(event) {
|
|
58
|
+
if (!dragging.value)
|
|
59
|
+
return;
|
|
60
|
+
dragging.value = false;
|
|
61
|
+
if (trackRef.value?.hasPointerCapture(event.pointerId))
|
|
62
|
+
trackRef.value.releasePointerCapture(event.pointerId);
|
|
63
|
+
}
|
|
64
|
+
function onKeydown(event) {
|
|
65
|
+
const current = selectedIndex.value < 0 ? Math.floor(lastIndex / 2) : selectedIndex.value;
|
|
66
|
+
const steps = {
|
|
67
|
+
ArrowRight: selectedIndex.value < 0 ? current : current + 1,
|
|
68
|
+
ArrowUp: selectedIndex.value < 0 ? current : current + 1,
|
|
69
|
+
ArrowLeft: selectedIndex.value < 0 ? current : current - 1,
|
|
70
|
+
ArrowDown: selectedIndex.value < 0 ? current : current - 1,
|
|
71
|
+
Home: 0,
|
|
72
|
+
End: lastIndex
|
|
73
|
+
};
|
|
74
|
+
const next = steps[event.key];
|
|
75
|
+
if (next === void 0)
|
|
76
|
+
return;
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
select(next);
|
|
79
|
+
}
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<template>
|
|
83
|
+
<TelaPopover v-model:open="open">
|
|
84
|
+
<TelaPopoverTrigger as-child>
|
|
85
|
+
<button
|
|
86
|
+
type="button"
|
|
87
|
+
class="effort-trigger hover:bg-muted! data-[state=open]:bg-muted!"
|
|
88
|
+
:class="effort ? 'text-primary' : 'text-secondary'"
|
|
89
|
+
:disabled="disabled"
|
|
90
|
+
:aria-label="`Esfor\xE7o de racioc\xEDnio: ${selectedOption?.label ?? AGENT_DEFAULT_LABEL}`"
|
|
91
|
+
>
|
|
92
|
+
<span body-14-medium whitespace-nowrap>{{ triggerLabel }}</span>
|
|
93
|
+
<span i-ph-caret-down class="effort-trigger-caret" icon-secondary aria-hidden="true" />
|
|
94
|
+
</button>
|
|
95
|
+
</TelaPopoverTrigger>
|
|
96
|
+
<TelaPopoverContent
|
|
97
|
+
side="top"
|
|
98
|
+
align="end"
|
|
99
|
+
:side-offset="8"
|
|
100
|
+
class="effort-panel w-260px p-16px rounded-16px bg border-0.5px border [box-shadow:0_4px_16px_0_rgba(85,91,98,0.14)]"
|
|
101
|
+
>
|
|
102
|
+
<div flex="~ col" gap-16px>
|
|
103
|
+
<div flex="~ col" items-center gap-4px text-center>
|
|
104
|
+
<span body-14-medium text-primary>{{ selectedOption?.label ?? AGENT_DEFAULT_LABEL }}</span>
|
|
105
|
+
<span body-12-regular text-secondary>{{ selectedOption?.description ?? AGENT_DEFAULT_DESCRIPTION }}</span>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div
|
|
109
|
+
ref="trackRef"
|
|
110
|
+
class="effort-track"
|
|
111
|
+
:class="{ 'effort-track--disabled': disabled }"
|
|
112
|
+
role="slider"
|
|
113
|
+
:tabindex="disabled ? -1 : 0"
|
|
114
|
+
aria-valuemin="0"
|
|
115
|
+
:aria-valuemax="lastIndex"
|
|
116
|
+
:aria-valuenow="selectedIndex < 0 ? void 0 : selectedIndex"
|
|
117
|
+
:aria-valuetext="selectedOption?.label ?? AGENT_DEFAULT_LABEL"
|
|
118
|
+
:aria-disabled="disabled || void 0"
|
|
119
|
+
@pointerdown="onPointerDown"
|
|
120
|
+
@pointermove="onPointerMove"
|
|
121
|
+
@pointerup="onPointerUp"
|
|
122
|
+
@pointercancel="onPointerUp"
|
|
123
|
+
@keydown="onKeydown"
|
|
124
|
+
>
|
|
125
|
+
<div class="effort-track-rail bg-muted">
|
|
126
|
+
<div class="effort-track-fill bg-neutral-800" :style="{ width: `${fillPercent}%` }" />
|
|
127
|
+
<span
|
|
128
|
+
v-for="(option, index) in options"
|
|
129
|
+
:key="option.value"
|
|
130
|
+
class="effort-stop"
|
|
131
|
+
:class="index <= selectedIndex ? 'bg-white' : 'bg-neutral-300'"
|
|
132
|
+
:style="{ left: `${stopPercent(index)}%` }"
|
|
133
|
+
:title="option.label"
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
<div
|
|
137
|
+
v-if="selectedIndex >= 0"
|
|
138
|
+
class="effort-thumb bg border-0.5px border-strong"
|
|
139
|
+
:class="{ 'effort-thumb--dragging': dragging }"
|
|
140
|
+
:style="{ left: `${fillPercent}%` }"
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div flex items-center justify-between>
|
|
145
|
+
<span body-12-regular text-tertiary>{{ options[0].label }}</span>
|
|
146
|
+
<button
|
|
147
|
+
v-if="effort"
|
|
148
|
+
type="button"
|
|
149
|
+
class="effort-reset text-secondary hover:text-primary"
|
|
150
|
+
body-12-medium
|
|
151
|
+
@click="reset"
|
|
152
|
+
>
|
|
153
|
+
Usar padrão do agente
|
|
154
|
+
</button>
|
|
155
|
+
<span body-12-regular text-tertiary>{{ options[lastIndex].label }}</span>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</TelaPopoverContent>
|
|
159
|
+
</TelaPopover>
|
|
160
|
+
</template>
|
|
161
|
+
|
|
162
|
+
<style scoped>
|
|
163
|
+
.effort-trigger{align-items:center;background:transparent;border:none;border-radius:8px;cursor:pointer;display:inline-flex;gap:6px;height:32px;padding:0 8px 0 10px;transition:background-color 80ms ease}.effort-trigger:disabled{opacity:.5;pointer-events:none}.effort-trigger:focus-visible{outline:2px solid rgba(85,91,98,.35);outline-offset:1px}.effort-trigger-caret{height:12px;width:12px}.effort-track{cursor:pointer;height:28px;margin:0 10px;outline:none;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.effort-track--disabled{cursor:not-allowed;opacity:.5}.effort-track:focus-visible .effort-track-rail{box-shadow:0 0 0 2px rgba(85,91,98,.35)}.effort-track-rail{height:6px;left:0;right:0;top:50%;transform:translateY(-50%);transition:box-shadow .12s ease}.effort-track-fill,.effort-track-rail{border-radius:9999px;position:absolute}.effort-track-fill{inset:0 auto 0 0;transition:width .12s cubic-bezier(.2,.8,.2,1)}.effort-stop{height:4px;transition:background-color .12s ease;width:4px}.effort-stop,.effort-thumb{border-radius:9999px;position:absolute;top:50%;transform:translate(-50%,-50%)}.effort-thumb{box-shadow:0 1px 2px rgba(0,0,0,.12),0 2px 6px rgba(0,0,0,.08);height:20px;pointer-events:none;transition:left .12s cubic-bezier(.2,.8,.2,1),transform .12s ease;width:20px}.effort-thumb--dragging{transform:translate(-50%,-50%) scale(1.08)}.effort-reset{background:transparent;border:none;cursor:pointer;padding:0;transition:color .12s ease}
|
|
164
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChatReasoningEffort } from '../../types/schemas/chat/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
};
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
|
+
modelValue?: ChatReasoningEffort | null;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (value: any) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type DeepReadonly, type MaybeRefOrGetter } from 'vue';
|
|
2
2
|
import type { Conversation, ConversationWithMessages, Message } from '../../types/schemas/chat/conversations.js';
|
|
3
|
+
import { type ChatReasoningEffort } from '../../types/schemas/chat/models.js';
|
|
3
4
|
import type { FileUploadInput } from '../../types/schemas/chat/files.js';
|
|
4
5
|
import type { SendMessageBody } from '../../types/schemas/chat/messages.js';
|
|
5
6
|
import type { TelaAgentExecutionInput } from '../../types/schemas/integrations/tela-agent-api.js';
|
|
@@ -34,13 +35,15 @@ export declare function useChat(options?: {
|
|
|
34
35
|
adoptConversation: (conv: Conversation) => void;
|
|
35
36
|
setConversationModel: (model: string | null) => void;
|
|
36
37
|
pendingModelSelection: any;
|
|
38
|
+
setConversationReasoningEffort: (reasoningEffort: ChatReasoningEffort | null) => void;
|
|
39
|
+
pendingReasoningEffortSelection: any;
|
|
37
40
|
sendMessage: (content: string, files?: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[], prepare?: (signal: AbortSignal) => Promise<{
|
|
38
41
|
wakeSessionId?: string;
|
|
39
42
|
defer?: boolean;
|
|
40
43
|
}>, queuedSend?: QueuedSend) => Promise<Message | null>;
|
|
41
44
|
flushOutboundQueue: (wakeSessionId?: string) => Promise<Message | null>;
|
|
42
45
|
failOutboundQueue: (message: string) => boolean;
|
|
43
|
-
retryMessage: (messageId: string, prepare?: () => Promise<
|
|
46
|
+
retryMessage: (messageId: string, prepare?: () => Promise<void>) => Promise<boolean>;
|
|
44
47
|
cancelConversation: () => Promise<boolean>;
|
|
45
48
|
startPolling: () => void;
|
|
46
49
|
stopPolling: () => void;
|
|
@@ -353,6 +353,22 @@ export function useChat(options = {}) {
|
|
|
353
353
|
return;
|
|
354
354
|
currentConversation.value = { ...conversation, model };
|
|
355
355
|
};
|
|
356
|
+
const pendingReasoningEffortBuckets = useState("chat-pending-reasoning-effort-selection", () => ({}));
|
|
357
|
+
const pendingReasoningEffortSelection = computed({
|
|
358
|
+
get: () => pendingReasoningEffortBuckets.value[chatScope.value] ?? null,
|
|
359
|
+
set: (value) => {
|
|
360
|
+
pendingReasoningEffortBuckets.value = {
|
|
361
|
+
...pendingReasoningEffortBuckets.value,
|
|
362
|
+
[chatScope.value]: value
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
const setConversationReasoningEffort = (reasoningEffort) => {
|
|
367
|
+
const conversation = currentConversation.value;
|
|
368
|
+
if (!conversation || (conversation.reasoningEffort ?? null) === reasoningEffort)
|
|
369
|
+
return;
|
|
370
|
+
currentConversation.value = { ...conversation, reasoningEffort };
|
|
371
|
+
};
|
|
356
372
|
const adoptConversation = (conv) => {
|
|
357
373
|
currentConversation.value = { ...conv, messages: messages.value };
|
|
358
374
|
};
|
|
@@ -733,7 +749,8 @@ export function useChat(options = {}) {
|
|
|
733
749
|
error.value = null;
|
|
734
750
|
let retry = null;
|
|
735
751
|
try {
|
|
736
|
-
|
|
752
|
+
if (prepare)
|
|
753
|
+
await prepare();
|
|
737
754
|
if (currentConversation.value?.id !== conversationId)
|
|
738
755
|
return false;
|
|
739
756
|
retry = beginAssistantMessageRetry(messages.value, messageId);
|
|
@@ -744,10 +761,7 @@ export function useChat(options = {}) {
|
|
|
744
761
|
directStream.beginMessage();
|
|
745
762
|
await $fetch(
|
|
746
763
|
chatApi.path(`/conversations/${conversationId}/messages/${messageId}/retry`),
|
|
747
|
-
chatApi.withChatHeaders({
|
|
748
|
-
method: "POST",
|
|
749
|
-
body: wakeSessionId ? { wakeSessionId } : {}
|
|
750
|
-
})
|
|
764
|
+
chatApi.withChatHeaders({ method: "POST" })
|
|
751
765
|
);
|
|
752
766
|
startPolling();
|
|
753
767
|
return true;
|
|
@@ -868,6 +882,8 @@ export function useChat(options = {}) {
|
|
|
868
882
|
adoptConversation,
|
|
869
883
|
setConversationModel,
|
|
870
884
|
pendingModelSelection,
|
|
885
|
+
setConversationReasoningEffort,
|
|
886
|
+
pendingReasoningEffortSelection,
|
|
871
887
|
sendMessage,
|
|
872
888
|
flushOutboundQueue,
|
|
873
889
|
failOutboundQueue,
|
|
@@ -9,6 +9,13 @@ export declare const conversationSchema: z.ZodObject<{
|
|
|
9
9
|
telaAgentId: z.ZodNullable<z.ZodString>;
|
|
10
10
|
conversationScope: z.ZodNullable<z.ZodString>;
|
|
11
11
|
model: z.ZodNullable<z.ZodString>;
|
|
12
|
+
reasoningEffort: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
13
|
+
low: "low";
|
|
14
|
+
medium: "medium";
|
|
15
|
+
high: "high";
|
|
16
|
+
xhigh: "xhigh";
|
|
17
|
+
max: "max";
|
|
18
|
+
}>>>;
|
|
12
19
|
appliedSettingsAt: z.ZodNullable<z.ZodDate>;
|
|
13
20
|
appliedSettingsSnapshot: z.ZodNullable<z.ZodObject<{
|
|
14
21
|
systemMessage: z.ZodNullable<z.ZodString>;
|
|
@@ -127,6 +134,13 @@ export declare const conversationWithMessagesSchema: z.ZodObject<{
|
|
|
127
134
|
telaAgentId: z.ZodNullable<z.ZodString>;
|
|
128
135
|
conversationScope: z.ZodNullable<z.ZodString>;
|
|
129
136
|
model: z.ZodNullable<z.ZodString>;
|
|
137
|
+
reasoningEffort: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
138
|
+
low: "low";
|
|
139
|
+
medium: "medium";
|
|
140
|
+
high: "high";
|
|
141
|
+
xhigh: "xhigh";
|
|
142
|
+
max: "max";
|
|
143
|
+
}>>>;
|
|
130
144
|
appliedSettingsAt: z.ZodNullable<z.ZodDate>;
|
|
131
145
|
appliedSettingsSnapshot: z.ZodNullable<z.ZodObject<{
|
|
132
146
|
systemMessage: z.ZodNullable<z.ZodString>;
|
|
@@ -219,6 +233,13 @@ export declare const createConversationRequestSchema: z.ZodObject<{
|
|
|
219
233
|
"claude-sonnet-4-6": "claude-sonnet-4-6";
|
|
220
234
|
"claude-haiku-4-5": "claude-haiku-4-5";
|
|
221
235
|
}>>>;
|
|
236
|
+
reasoningEffort: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
237
|
+
low: "low";
|
|
238
|
+
medium: "medium";
|
|
239
|
+
high: "high";
|
|
240
|
+
xhigh: "xhigh";
|
|
241
|
+
max: "max";
|
|
242
|
+
}>>>;
|
|
222
243
|
agentInputs: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
223
244
|
type: z.ZodLiteral<"file">;
|
|
224
245
|
name: z.ZodString;
|
|
@@ -257,6 +278,13 @@ export declare const updateConversationRequestSchema: z.ZodObject<{
|
|
|
257
278
|
"claude-sonnet-4-6": "claude-sonnet-4-6";
|
|
258
279
|
"claude-haiku-4-5": "claude-haiku-4-5";
|
|
259
280
|
}>>>;
|
|
281
|
+
reasoningEffort: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
282
|
+
low: "low";
|
|
283
|
+
medium: "medium";
|
|
284
|
+
high: "high";
|
|
285
|
+
xhigh: "xhigh";
|
|
286
|
+
max: "max";
|
|
287
|
+
}>>>;
|
|
260
288
|
}, z.core.$strict>;
|
|
261
289
|
export type UpdateConversationRequest = z.infer<typeof updateConversationRequestSchema>;
|
|
262
290
|
export declare const moveConversationRequestSchema: z.ZodObject<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { telaAgentExecutionInputSchema } from '../integrations/tela-agent-api';
|
|
3
3
|
import { messageFileSchema } from './files';
|
|
4
|
-
import { chatModelSchema } from './models';
|
|
4
|
+
import { chatModelSchema, chatReasoningEffortSchema } from './models';
|
|
5
5
|
import { conversationCreatorFilterSchema, messageRoleSchema, messageStatusSchema, } from './primitives';
|
|
6
6
|
import { resolvedWorkspaceSettingsSchema } from './workspace-settings';
|
|
7
7
|
export const conversationSchema = z.object({
|
|
@@ -14,6 +14,9 @@ export const conversationSchema = z.object({
|
|
|
14
14
|
telaAgentId: z.string().nullable(),
|
|
15
15
|
conversationScope: z.string().nullable(),
|
|
16
16
|
model: z.string().nullable(),
|
|
17
|
+
// Null keeps the agent's configured effort. Optional so a newer chat-nuxt
|
|
18
|
+
// keeps working against a chat-api that predates the column.
|
|
19
|
+
reasoningEffort: chatReasoningEffortSchema.nullable().optional(),
|
|
17
20
|
appliedSettingsAt: z.date().nullable(),
|
|
18
21
|
appliedSettingsSnapshot: resolvedWorkspaceSettingsSchema.nullable(),
|
|
19
22
|
createdBy: z.string().nullable(),
|
|
@@ -56,6 +59,7 @@ export const conversationWithMessagesSchema = conversationSchema.extend({
|
|
|
56
59
|
});
|
|
57
60
|
export const createConversationRequestSchema = z.strictObject({
|
|
58
61
|
model: chatModelSchema.nullable().optional(),
|
|
62
|
+
reasoningEffort: chatReasoningEffortSchema.nullable().optional(),
|
|
59
63
|
agentInputs: z.array(telaAgentExecutionInputSchema).optional(),
|
|
60
64
|
});
|
|
61
65
|
export const conversationAgentInputsResponseSchema = z.object({
|
|
@@ -66,6 +70,7 @@ export const conversationAgentInputsResponseSchema = z.object({
|
|
|
66
70
|
export const updateConversationRequestSchema = z.strictObject({
|
|
67
71
|
title: z.string().optional(),
|
|
68
72
|
model: chatModelSchema.nullable().optional(),
|
|
73
|
+
reasoningEffort: chatReasoningEffortSchema.nullable().optional(),
|
|
69
74
|
});
|
|
70
75
|
export const moveConversationRequestSchema = z.object({
|
|
71
76
|
groupId: z.string().nullable(),
|
|
@@ -214,10 +214,6 @@ export declare const messagePollResponseSchema: z.ZodObject<{
|
|
|
214
214
|
}, z.core.$strip>>;
|
|
215
215
|
}, z.core.$strip>;
|
|
216
216
|
export type MessagePollResponse = z.infer<typeof messagePollResponseSchema>;
|
|
217
|
-
export declare const retryMessageBodySchema: z.ZodObject<{
|
|
218
|
-
wakeSessionId: z.ZodOptional<z.ZodString>;
|
|
219
|
-
}, z.core.$strict>;
|
|
220
|
-
export type RetryMessageBody = z.infer<typeof retryMessageBodySchema>;
|
|
221
217
|
export declare const cancelConversationResponseSchema: z.ZodObject<{
|
|
222
218
|
success: z.ZodLiteral<true>;
|
|
223
219
|
cancelled: z.ZodBoolean;
|
|
@@ -65,9 +65,6 @@ export const messagePollResponseSchema = z.object({
|
|
|
65
65
|
rewakeable: z.boolean().optional(),
|
|
66
66
|
}).optional(),
|
|
67
67
|
});
|
|
68
|
-
export const retryMessageBodySchema = z.strictObject({
|
|
69
|
-
wakeSessionId: z.string().uuid().optional(),
|
|
70
|
-
});
|
|
71
68
|
export const cancelConversationResponseSchema = z.object({
|
|
72
69
|
success: z.literal(true),
|
|
73
70
|
cancelled: z.boolean(),
|
|
@@ -10,3 +10,13 @@ export declare const chatModelSchema: z.ZodEnum<{
|
|
|
10
10
|
export type ChatModel = z.infer<typeof chatModelSchema>;
|
|
11
11
|
export declare const defaultChatModel = "claude-opus-5";
|
|
12
12
|
export declare function isValidChatModel(value: unknown): value is ChatModel;
|
|
13
|
+
export declare const chatReasoningEffortValues: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
14
|
+
export declare const chatReasoningEffortSchema: z.ZodEnum<{
|
|
15
|
+
low: "low";
|
|
16
|
+
medium: "medium";
|
|
17
|
+
high: "high";
|
|
18
|
+
xhigh: "xhigh";
|
|
19
|
+
max: "max";
|
|
20
|
+
}>;
|
|
21
|
+
export type ChatReasoningEffort = z.infer<typeof chatReasoningEffortSchema>;
|
|
22
|
+
export declare function isValidChatReasoningEffort(value: unknown): value is ChatReasoningEffort;
|
|
@@ -11,3 +11,9 @@ export const defaultChatModel = 'claude-opus-5';
|
|
|
11
11
|
export function isValidChatModel(value) {
|
|
12
12
|
return typeof value === 'string' && chatModelIds.includes(value);
|
|
13
13
|
}
|
|
14
|
+
// Mirrors the effort levels the Agent API accepts (claudeEffortValues), ascending.
|
|
15
|
+
export const chatReasoningEffortValues = ['low', 'medium', 'high', 'xhigh', 'max'];
|
|
16
|
+
export const chatReasoningEffortSchema = z.enum(chatReasoningEffortValues);
|
|
17
|
+
export function isValidChatReasoningEffort(value) {
|
|
18
|
+
return typeof value === 'string' && chatReasoningEffortValues.includes(value);
|
|
19
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { ChatModel } from './models';
|
|
2
|
+
import type { ChatModel, ChatReasoningEffort } from './models';
|
|
3
3
|
export declare const conversationCreatorFilterOptions: readonly [{
|
|
4
4
|
readonly label: "Todas";
|
|
5
5
|
readonly value: "all";
|
|
@@ -70,6 +70,32 @@ export declare const chatModelOptions: readonly [{
|
|
|
70
70
|
readonly isMultiModal: true;
|
|
71
71
|
readonly tabs: readonly ["all", "cheap", "multimodal"];
|
|
72
72
|
}];
|
|
73
|
+
export type ChatReasoningEffortOption = {
|
|
74
|
+
value: ChatReasoningEffort;
|
|
75
|
+
label: string;
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
export declare const chatReasoningEffortOptions: readonly [{
|
|
79
|
+
readonly value: "low";
|
|
80
|
+
readonly label: "Baixo";
|
|
81
|
+
readonly description: "Respostas rápidas, com pouco raciocínio";
|
|
82
|
+
}, {
|
|
83
|
+
readonly value: "medium";
|
|
84
|
+
readonly label: "Médio";
|
|
85
|
+
readonly description: "Equilíbrio entre velocidade e profundidade";
|
|
86
|
+
}, {
|
|
87
|
+
readonly value: "high";
|
|
88
|
+
readonly label: "Alto";
|
|
89
|
+
readonly description: "Raciocínio mais profundo para tarefas complexas";
|
|
90
|
+
}, {
|
|
91
|
+
readonly value: "xhigh";
|
|
92
|
+
readonly label: "Muito alto";
|
|
93
|
+
readonly description: "Raciocínio extenso, respostas mais lentas";
|
|
94
|
+
}, {
|
|
95
|
+
readonly value: "max";
|
|
96
|
+
readonly label: "Máximo";
|
|
97
|
+
readonly description: "Raciocínio máximo, custo e latência mais altos";
|
|
98
|
+
}];
|
|
73
99
|
export declare const topbarTabs: readonly ["chat", "files", "usage"];
|
|
74
100
|
export declare const topbarTabSchema: z.ZodEnum<{
|
|
75
101
|
usage: "usage";
|
|
@@ -12,6 +12,14 @@ export const chatModelOptions = [
|
|
|
12
12
|
{ value: 'claude-sonnet-4-6', label: 'Claude 4.6 Sonnet', description: 'Agente rápido para tarefas avançadas', provider: 'Anthropic', cost: 4, maxInputTokens: 1_000_000, maxOutputTokens: 64_000, isMultiModal: true, tabs: ['all', 'advanced', 'multimodal'] },
|
|
13
13
|
{ value: 'claude-haiku-4-5', label: 'Claude 4.5 Haiku', description: 'Agente rápido para tarefas simples', provider: 'Anthropic', cost: 3, maxInputTokens: 200_000, maxOutputTokens: 64_000, isMultiModal: true, tabs: ['all', 'cheap', 'multimodal'] },
|
|
14
14
|
];
|
|
15
|
+
// Ordered from least to most effort so the composer can lay them out as slider stops.
|
|
16
|
+
export const chatReasoningEffortOptions = [
|
|
17
|
+
{ value: 'low', label: 'Baixo', description: 'Respostas rápidas, com pouco raciocínio' },
|
|
18
|
+
{ value: 'medium', label: 'Médio', description: 'Equilíbrio entre velocidade e profundidade' },
|
|
19
|
+
{ value: 'high', label: 'Alto', description: 'Raciocínio mais profundo para tarefas complexas' },
|
|
20
|
+
{ value: 'xhigh', label: 'Muito alto', description: 'Raciocínio extenso, respostas mais lentas' },
|
|
21
|
+
{ value: 'max', label: 'Máximo', description: 'Raciocínio máximo, custo e latência mais altos' },
|
|
22
|
+
];
|
|
15
23
|
export const topbarTabs = ['chat', 'files', 'usage'];
|
|
16
24
|
export const topbarTabSchema = z.enum(topbarTabs);
|
|
17
25
|
export const mentionItemCategories = ['file', 'skill', 'canvas'];
|