Merge pull request #155 from alibaba/fix/panel-time
fix(panel): remove timestamp (not well defined)
This commit is contained in:
@@ -15,7 +15,7 @@ const enUS = {
|
|||||||
close: 'Close',
|
close: 'Close',
|
||||||
expand: 'Expand history',
|
expand: 'Expand history',
|
||||||
collapse: 'Collapse history',
|
collapse: 'Collapse history',
|
||||||
step: 'Step {{number}} · {{time}}{{duration}}',
|
step: 'Step {{number}}',
|
||||||
},
|
},
|
||||||
tools: {
|
tools: {
|
||||||
clicking: 'Clicking element [{{index}}]...',
|
clicking: 'Clicking element [{{index}}]...',
|
||||||
@@ -63,7 +63,7 @@ const zhCN = {
|
|||||||
close: '关闭',
|
close: '关闭',
|
||||||
expand: '展开历史',
|
expand: '展开历史',
|
||||||
collapse: '收起历史',
|
collapse: '收起历史',
|
||||||
step: '步骤 {{number}} · {{time}}{{duration}}',
|
step: '步骤 {{number}}',
|
||||||
},
|
},
|
||||||
tools: {
|
tools: {
|
||||||
clicking: '正在点击元素 [{{index}}]...',
|
clicking: '正在点击元素 [{{index}}]...',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { I18n, type SupportedLanguage } from '../i18n'
|
import { I18n, type SupportedLanguage } from '../i18n'
|
||||||
import { truncate } from '../utils'
|
import { truncate } from '../utils'
|
||||||
import { createCard, createReflectionLines, formatTime } from './cards'
|
import { createCard, createReflectionLines } from './cards'
|
||||||
import type { AgentActivity, PanelAgentAdapter } from './types'
|
import type { AgentActivity, PanelAgentAdapter } from './types'
|
||||||
|
|
||||||
import styles from './Panel.module.css'
|
import styles from './Panel.module.css'
|
||||||
@@ -187,7 +187,6 @@ export class Panel {
|
|||||||
tempCard.innerHTML = createCard({
|
tempCard.innerHTML = createCard({
|
||||||
icon: '❓',
|
icon: '❓',
|
||||||
content: `Question: ${question}`,
|
content: `Question: ${question}`,
|
||||||
meta: formatTime(this.#config.language ?? 'en-US'),
|
|
||||||
type: 'question',
|
type: 'question',
|
||||||
})
|
})
|
||||||
const cardElement = tempCard.firstElementChild as HTMLElement
|
const cardElement = tempCard.firstElementChild as HTMLElement
|
||||||
@@ -591,15 +590,12 @@ export class Panel {
|
|||||||
/** Create cards for a history event */
|
/** Create cards for a history event */
|
||||||
#createHistoryCards(event: PanelAgentAdapter['history'][number]): string[] {
|
#createHistoryCards(event: PanelAgentAdapter['history'][number]): string[] {
|
||||||
const cards: string[] = []
|
const cards: string[] = []
|
||||||
const time = formatTime(this.#config.language ?? 'en-US')
|
|
||||||
const meta =
|
const meta =
|
||||||
event.type === 'step' && event.stepIndex !== undefined
|
event.type === 'step' && event.stepIndex !== undefined
|
||||||
? this.#i18n.t('ui.panel.step', {
|
? this.#i18n.t('ui.panel.step', {
|
||||||
number: (event.stepIndex + 1).toString(),
|
number: (event.stepIndex + 1).toString(),
|
||||||
time,
|
|
||||||
duration: '',
|
|
||||||
})
|
})
|
||||||
: time
|
: undefined
|
||||||
|
|
||||||
if (event.type === 'step') {
|
if (event.type === 'step') {
|
||||||
// Reflection card
|
// Reflection card
|
||||||
@@ -636,7 +632,7 @@ export class Panel {
|
|||||||
/** Create cards for an action */
|
/** Create cards for an action */
|
||||||
#createActionCards(
|
#createActionCards(
|
||||||
action: { name: string; input: unknown; output: string },
|
action: { name: string; input: unknown; output: string },
|
||||||
meta: string
|
meta?: string
|
||||||
): string[] {
|
): string[] {
|
||||||
const cards: string[] = []
|
const cards: string[] = []
|
||||||
|
|
||||||
|
|||||||
@@ -32,16 +32,6 @@ export function createCard({ icon, content, meta, type }: CardOptions): string {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Format timestamp for cards */
|
|
||||||
export function formatTime(locale: string = 'en-US'): string {
|
|
||||||
return new Date().toLocaleTimeString(locale, {
|
|
||||||
hour12: false,
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
second: '2-digit',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Create reflection lines from reflection object */
|
/** Create reflection lines from reflection object */
|
||||||
export function createReflectionLines(reflection: {
|
export function createReflectionLines(reflection: {
|
||||||
evaluation_previous_goal?: string
|
evaluation_previous_goal?: string
|
||||||
|
|||||||
Reference in New Issue
Block a user