@adminforth/agent 2.4.1 → 2.5.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.
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
<div
|
|
3
3
|
class="relative flex flex-col w-full group/msg"
|
|
4
4
|
>
|
|
5
|
-
<div
|
|
6
|
-
v-if="
|
|
5
|
+
<div
|
|
6
|
+
v-if="showActionsBar"
|
|
7
7
|
class="absolute w-full h-[calc(100%+1.5rem)] pb-8"
|
|
8
|
-
@mouseenter="showEditButtonOnHover"
|
|
9
|
-
@mouseleave="hideEditButtonOnHover"
|
|
8
|
+
@mouseenter="showEditButtonOnHover"
|
|
9
|
+
@mouseleave="hideEditButtonOnHover"
|
|
10
10
|
/>
|
|
11
11
|
<Transition
|
|
12
12
|
enter-active-class="transition ease-out duration-200"
|
|
@@ -17,20 +17,23 @@
|
|
|
17
17
|
leave-to-class="opacity-0 scale-95"
|
|
18
18
|
>
|
|
19
19
|
<div
|
|
20
|
-
v-if="
|
|
21
|
-
class="absolute flex -bottom-6
|
|
22
|
-
|
|
23
|
-
@
|
|
20
|
+
v-if="showActionsBar && showEditButton"
|
|
21
|
+
class="absolute flex -bottom-6 p-1 mt-0.5 z-20"
|
|
22
|
+
:class="isUserMessage ? 'right-0 self-end mr-4' : 'left-0 self-start ml-4'"
|
|
23
|
+
@mouseenter="showEditButtonOnHover"
|
|
24
|
+
@mouseleave="hideEditButtonOnHover"
|
|
24
25
|
>
|
|
25
26
|
<button
|
|
27
|
+
v-if="canCopy"
|
|
26
28
|
type="button"
|
|
27
29
|
class="flex items-center justify-center w-8 h-8 rounded-md text-gray-400 hover:text-lightPrimary dark:hover:text-darkPrimary opacity-60 group-hover/msg:opacity-100 transition-opacity duration-150 hover:scale-110"
|
|
28
30
|
:title="$t('Copy message')"
|
|
29
|
-
@click="copyMessageToClipboard
|
|
31
|
+
@click="copyMessageToClipboard"
|
|
30
32
|
>
|
|
31
33
|
<IconFileCopySolid class="w-5 h-5" />
|
|
32
34
|
</button>
|
|
33
35
|
<button
|
|
36
|
+
v-if="canEdit"
|
|
34
37
|
type="button"
|
|
35
38
|
class="flex items-center justify-center w-8 h-8 rounded-md text-gray-400 hover:text-lightPrimary dark:hover:text-darkPrimary opacity-60 group-hover/msg:opacity-100 transition-opacity duration-150 hover:scale-110"
|
|
36
39
|
:title="$t('Edit message')"
|
|
@@ -120,6 +123,19 @@
|
|
|
120
123
|
|
|
121
124
|
const isUserMessage = computed(() => props.message.role === 'user');
|
|
122
125
|
|
|
126
|
+
const copyableText = computed(() =>
|
|
127
|
+
(props.message.parts ?? [])
|
|
128
|
+
.filter((part: any) => part.type === 'text' && !checkIfMessageSystemMessage(part.text ?? ''))
|
|
129
|
+
.map((part: any) => part.text ?? '')
|
|
130
|
+
.join('')
|
|
131
|
+
);
|
|
132
|
+
const canCopy = computed(() =>
|
|
133
|
+
Boolean(copyableText.value.trim()) && !agentStore.isEditingMessage
|
|
134
|
+
);
|
|
135
|
+
const showActionsBar = computed(() =>
|
|
136
|
+
canEdit.value || (!isUserMessage.value && canCopy.value)
|
|
137
|
+
);
|
|
138
|
+
|
|
123
139
|
// While editing, hide only the *other* user messages of the edited turn (its steer
|
|
124
140
|
// sub-messages); the edited message itself and all non-user parts stay visible.
|
|
125
141
|
const shouldBeShownWhileEditing = computed(() =>
|
|
@@ -139,8 +155,8 @@
|
|
|
139
155
|
showEditButton.value = false;
|
|
140
156
|
}
|
|
141
157
|
|
|
142
|
-
function copyMessageToClipboard(
|
|
143
|
-
navigator.clipboard.writeText(
|
|
158
|
+
function copyMessageToClipboard() {
|
|
159
|
+
navigator.clipboard.writeText(copyableText.value)
|
|
144
160
|
.then(() => {
|
|
145
161
|
alert({ message: 'Message copied to clipboard', variant: 'success' });
|
|
146
162
|
})
|