@adminforth/agent 2.4.1 → 2.5.1

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.
@@ -20,7 +20,7 @@
20
20
  rows="1"
21
21
  @input="autoResize"
22
22
  :class="[
23
- 'h-8 px-4 py-3 border-b rounded-xl rounded-b-none w-full resize-none overflow-hidden text-lightInputText dark:text-darkInputText rounded-md bg-transparent text-sm bg-gray-50 dark:bg-gray-700 dark:border-gray-600 focus:outline-none',
23
+ 'h-8 px-4 py-3 rounded-xl rounded-b-none w-full resize-none overflow-hidden text-lightInputText dark:text-darkInputText rounded-md bg-transparent text-sm bg-gray-50 dark:bg-gray-700 dark:border-gray-600 focus:outline-none',
24
24
  { '!text-base': coreStore.isIos }
25
25
  ]"
26
26
  :placeholder="placeholderText"
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <div
3
3
  class="relative flex flex-col w-full group/msg"
4
+ @mouseenter="showEditButtonOnHover"
5
+ @mouseleave="hideEditButtonOnHover"
4
6
  >
5
- <div
6
- v-if="canEdit"
7
+ <div
8
+ v-if="showActionsBar"
7
9
  class="absolute w-full h-[calc(100%+1.5rem)] pb-8"
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="canEdit && showEditButton"
21
- class="absolute flex -bottom-6 right-0 self-end p-1 mr-4 mt-0.5 z-20"
22
- @mouseenter="showEditButtonOnHover"
23
- @mouseleave="hideEditButtonOnHover"
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(message)"
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(message: IMessage) {
143
- navigator.clipboard.writeText(message.parts[0].text ?? '')
158
+ function copyMessageToClipboard() {
159
+ navigator.clipboard.writeText(copyableText.value)
144
160
  .then(() => {
145
161
  alert({ message: 'Message copied to clipboard', variant: 'success' });
146
162
  })
@@ -16,7 +16,7 @@
16
16
  >
17
17
  {{ inProgress ? $t('Thinking') : $t('Thoughts') }}
18
18
  </p>
19
-
19
+ <ThreeDotsAnimation v-if="inProgress" />
20
20
  <span v-if="thinkingDuration > 0">({{ (thinkingDuration/1000).toFixed(2) }} s)</span>
21
21
  <IconAngleDownOutline
22
22
  v-if="ToolOrReasoningParts.length > 0"
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="flex items-center justify-center rounded-xl border px-6 border-gray-200 dark:border-gray-700 min-w-0 transition-shadow duration-150"
3
+ class="flex items-center justify-center rounded-xl border px-6 border-gray-200 dark:border-gray-700 min-w-0 transition-shadow duration-150 z-20"
4
4
  @click="handleMarkdownLinkClick"
5
5
  :class="[
6
6
  hasVegaLite ? 'w-full my-2' : 'm-2',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/agent",
3
- "version": "2.4.1",
3
+ "version": "2.5.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",