@adminforth/agent 2.3.2 → 2.4.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.
|
@@ -80,24 +80,11 @@
|
|
|
80
80
|
/>
|
|
81
81
|
<template v-if="!agentStore.isAudioChatMode">
|
|
82
82
|
<template v-if="agentStore.isEditingMessage">
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
@click="cancelEdit"
|
|
89
|
-
>
|
|
90
|
-
<IconCloseOutline class="w-5 h-5" />
|
|
91
|
-
</Button>
|
|
92
|
-
<Button
|
|
93
|
-
class="!p-0 h-7 w-7"
|
|
94
|
-
title="Send edited message"
|
|
95
|
-
@click="sendMessage"
|
|
96
|
-
:disabled="!agentStore.trimmedUserMessage"
|
|
97
|
-
>
|
|
98
|
-
<IconCheckOutline class="w-6 h-6 text-white" />
|
|
99
|
-
</Button>
|
|
100
|
-
</div>
|
|
83
|
+
<EditActionButtons
|
|
84
|
+
:confirm-disabled="!agentStore.trimmedUserMessage"
|
|
85
|
+
@cancel="cancelEdit"
|
|
86
|
+
@confirm="sendMessage"
|
|
87
|
+
/>
|
|
101
88
|
</template>
|
|
102
89
|
<template v-else>
|
|
103
90
|
<Button
|
|
@@ -128,7 +115,7 @@
|
|
|
128
115
|
</template>
|
|
129
116
|
|
|
130
117
|
<script setup lang="ts">
|
|
131
|
-
import { IconArrowUpOutline, IconAngleDownOutline
|
|
118
|
+
import { IconArrowUpOutline, IconAngleDownOutline } from '@iconify-prerendered/vue-flowbite';
|
|
132
119
|
import { useTemplateRef, onMounted, ref, onUnmounted, watch, computed } from 'vue';
|
|
133
120
|
import { onClickOutside } from '@vueuse/core'
|
|
134
121
|
import { useAgentStore } from './composables/useAgentStore';
|
|
@@ -139,6 +126,7 @@ import { remToPx } from './utils';
|
|
|
139
126
|
import MicrophoneButton from './speech_recognition_frontend/MicrophoneButon.vue';
|
|
140
127
|
import SteerQueue from './SteerQueue.vue';
|
|
141
128
|
import SteerDebugPanel from './SteerDebugPanel.vue';
|
|
129
|
+
import EditActionButtons from './EditActionButtons.vue';
|
|
142
130
|
|
|
143
131
|
const props = defineProps<{
|
|
144
132
|
meta: {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex items-center gap-3">
|
|
3
|
+
<Button
|
|
4
|
+
variant="secondary"
|
|
5
|
+
class="!p-0 h-7 w-7 mr-1 bg-red-600 text-white hover:bg-red-700 dark:bg-red-700 dark:hover:bg-red-800"
|
|
6
|
+
title="Cancel edit"
|
|
7
|
+
@click="emit('cancel')"
|
|
8
|
+
>
|
|
9
|
+
<IconCloseOutline class="w-5 h-5" />
|
|
10
|
+
</Button>
|
|
11
|
+
<Button
|
|
12
|
+
class="!p-0 h-7 w-7"
|
|
13
|
+
title="Send edited message"
|
|
14
|
+
:disabled="confirmDisabled"
|
|
15
|
+
@click="emit('confirm')"
|
|
16
|
+
>
|
|
17
|
+
<IconCheckOutline class="w-6 h-6 text-white" />
|
|
18
|
+
</Button>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { IconCloseOutline, IconCheckOutline } from '@iconify-prerendered/vue-flowbite';
|
|
24
|
+
import { Button } from '@/afcl';
|
|
25
|
+
|
|
26
|
+
defineProps<{
|
|
27
|
+
confirmDisabled?: boolean;
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
const emit = defineEmits<{
|
|
31
|
+
(e: 'cancel'): void;
|
|
32
|
+
(e: 'confirm'): void;
|
|
33
|
+
}>();
|
|
34
|
+
</script>
|
|
@@ -313,6 +313,16 @@ export function createAgentChatManager({
|
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
315
|
await stopActiveTurnAndWaitForIdle();
|
|
316
|
+
// The edited text already folds in the turn's steer sub-messages, so drop those extra
|
|
317
|
+
// user messages first — otherwise they linger after the edit as duplicate bubbles.
|
|
318
|
+
const withoutTurnSteers = chat.messages.filter((message: any) =>
|
|
319
|
+
message.id === messageId
|
|
320
|
+
|| message.role !== 'user'
|
|
321
|
+
|| message.metadata?.turnId !== turnId
|
|
322
|
+
);
|
|
323
|
+
if (withoutTurnSteers.length !== chat.messages.length) {
|
|
324
|
+
chat.messages = withoutTurnSteers;
|
|
325
|
+
}
|
|
316
326
|
editingTurnId.value = turnId;
|
|
317
327
|
lastMessage.value = text;
|
|
318
328
|
try {
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
@click="handleMarkdownLinkClick"
|
|
5
5
|
:class="[
|
|
6
6
|
hasVegaLite ? 'w-full my-2' : 'm-2',
|
|
7
|
-
props.role === 'user' ? 'bg-lightListTableHeading dark:bg-darkListTableHeading self-end max-w-[80%] mr-4'
|
|
7
|
+
props.role === 'user' ? 'bg-lightListTableHeading dark:bg-darkListTableHeading self-end max-w-[80%] mr-4'
|
|
8
8
|
: 'border-none self-start max-w-full',
|
|
9
|
-
props.editMode ? 'ring-2 ring-lightPrimary dark:ring-darkPrimary w-full max-w-[calc(100%-2rem)]' : ''
|
|
9
|
+
props.editMode ? 'ring-2 ring-lightPrimary dark:ring-darkPrimary w-full max-w-[calc(100%-2rem)] flex-col items-stretch py-3' : ''
|
|
10
10
|
]"
|
|
11
11
|
>
|
|
12
12
|
<IncremarkContent
|
|
13
13
|
class="text-wrap break-words w-full max-w-full"
|
|
14
|
-
v-if="content"
|
|
14
|
+
v-if="content && !props.editMode"
|
|
15
15
|
:key="renderNonce"
|
|
16
16
|
:content="content"
|
|
17
17
|
:is-finished="isFinished"
|
|
@@ -21,6 +21,18 @@
|
|
|
21
21
|
<!-- <p v-else class="text-red-500 py-2">
|
|
22
22
|
{{ $t('No content to render') }}
|
|
23
23
|
</p> -->
|
|
24
|
+
<template v-if="props.editMode">
|
|
25
|
+
<textarea
|
|
26
|
+
v-model="agentStore.userMessageInput"
|
|
27
|
+
class="w-full min-h-24 resize-y bg-transparent text-sm text-gray-900 dark:text-gray-100 border-none focus:outline-none focus:ring-0 p-0"
|
|
28
|
+
/>
|
|
29
|
+
<EditActionButtons
|
|
30
|
+
class="mt-2 self-end"
|
|
31
|
+
:confirm-disabled="!agentStore.trimmedUserMessage"
|
|
32
|
+
@cancel="agentStore.cancelEditMessage"
|
|
33
|
+
@confirm="agentStore.submitEditMessage"
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
24
36
|
</div>
|
|
25
37
|
</template>
|
|
26
38
|
|
|
@@ -31,6 +43,7 @@
|
|
|
31
43
|
import { useAgentStore } from '../composables/useAgentStore';
|
|
32
44
|
import { useCoreStore } from '@/stores/core';
|
|
33
45
|
import type { IMessage } from '../types';
|
|
46
|
+
import EditActionButtons from '../EditActionButtons.vue';
|
|
34
47
|
|
|
35
48
|
const props = defineProps<{
|
|
36
49
|
message: string | undefined,
|