优化时间工具
This commit is contained in:
@@ -70,16 +70,29 @@ func buildTimeContext(now time.Time) string {
|
||||
- 本周:%s 至 %s
|
||||
- 本月:%s 至 %s
|
||||
- 今年:%s 至 %s`,
|
||||
now.Format("2006-01-02 15:04:05 MST"),
|
||||
todayStart.Format("2006-01-02"), todayStart.Format("2006-01-02 15:04:05"), todayStart.AddDate(0, 0, 1).Add(-time.Second).Format("2006-01-02 15:04:05"),
|
||||
todayStart.AddDate(0, 0, -1).Format("2006-01-02"),
|
||||
todayStart.AddDate(0, 0, 1).Format("2006-01-02"),
|
||||
weekStart.Format("2006-01-02"), weekStart.AddDate(0, 0, 7).Add(-time.Second).Format("2006-01-02"),
|
||||
monthStart.Format("2006-01-02"), monthStart.AddDate(0, 1, 0).Add(-time.Second).Format("2006-01-02"),
|
||||
yearStart.Format("2006-01-02"), yearStart.AddDate(1, 0, 0).Add(-time.Second).Format("2006-01-02"),
|
||||
formatDateTimeWithWeek(now, "2006-01-02 15:04:05 MST"),
|
||||
formatDateWithWeek(todayStart), formatDateTimeWithWeek(todayStart, "2006-01-02 15:04:05"), formatDateTimeWithWeek(todayStart.AddDate(0, 0, 1).Add(-time.Second), "2006-01-02 15:04:05"),
|
||||
formatDateWithWeek(todayStart.AddDate(0, 0, -1)),
|
||||
formatDateWithWeek(todayStart.AddDate(0, 0, 1)),
|
||||
formatDateWithWeek(weekStart), formatDateWithWeek(weekStart.AddDate(0, 0, 7).Add(-time.Second)),
|
||||
formatDateWithWeek(monthStart), formatDateWithWeek(monthStart.AddDate(0, 1, 0).Add(-time.Second)),
|
||||
formatDateWithWeek(yearStart), formatDateWithWeek(yearStart.AddDate(1, 0, 0).Add(-time.Second)),
|
||||
)
|
||||
}
|
||||
|
||||
func formatDateWithWeek(t time.Time) string {
|
||||
return formatDateTimeWithWeek(t, "2006-01-02")
|
||||
}
|
||||
|
||||
func formatDateTimeWithWeek(t time.Time, layout string) string {
|
||||
return fmt.Sprintf("%s(%s)", t.Format(layout), weekdayName(t.Weekday()))
|
||||
}
|
||||
|
||||
func weekdayName(weekday time.Weekday) string {
|
||||
names := []string{"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}
|
||||
return names[weekday]
|
||||
}
|
||||
|
||||
func dateStart(t time.Time) time.Time {
|
||||
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
|
||||
}
|
||||
|
||||
@@ -52,13 +52,14 @@ const activeClass = "bg-blue-50 text-blue-600 dark:bg-dk-card dark:text-blue-400
|
||||
const normalClass = "rounded-md px-3 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-dk-subtle dark:hover:bg-dk-card dark:hover:text-dk-text";
|
||||
|
||||
const navItems = computed(() => [
|
||||
{ label: t("appname.aichat"), to: "/aichat" },
|
||||
{ label: t("appname.home"), to: "/" },
|
||||
// { label: t("appname.schedule"), to: "/schedule" },
|
||||
{ label: t("appname.calendar"), to: "/calendars" },
|
||||
{ label: t("appname.purchase"), to: "/purchase" },
|
||||
{ label: t("appname.work_order"), to: "/work_order" },
|
||||
{ label: t("appname.warehouse"), to: "/warehouse" },
|
||||
{ label: t("appname.aichat"), to: "/aichat" },
|
||||
|
||||
]);
|
||||
</script>
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
"warehouse_items": "Items Overview",
|
||||
"work_order": "Work Order",
|
||||
"calendar": "Calendar",
|
||||
"aichat": "AI Chat"
|
||||
"aichat": "AI Assistant"
|
||||
},
|
||||
"aichat": {
|
||||
"title": "AI Chat",
|
||||
"subtitle": "Chat with the AI assistant using streaming responses and backend tool traces.",
|
||||
"title": "AI Assistant",
|
||||
"subtitle": "Chat with the AI assistant using streaming responses.",
|
||||
"empty_title": "Start an AI chat",
|
||||
"empty_hint": "Type a question and press Enter to send. Use Shift + Enter for a new line.",
|
||||
"input_placeholder": "Type a message...",
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
"warehouse_items": "物品总览",
|
||||
"work_order": "工单",
|
||||
"calendar": "日历",
|
||||
"aichat": "AI 对话"
|
||||
"aichat": "AI 助手"
|
||||
},
|
||||
"aichat": {
|
||||
"title": "AI 对话",
|
||||
"subtitle": "通过流式响应与 AI 助手对话,可显示后端工具执行过程。",
|
||||
"title": "AI 助手",
|
||||
"subtitle": "通过流式响应与 AI 助手对话。",
|
||||
"empty_title": "开始一次 AI 对话",
|
||||
"empty_hint": "输入问题后按 Enter 发送,Shift + Enter 换行。",
|
||||
"input_placeholder": "输入消息...",
|
||||
|
||||
@@ -24,9 +24,9 @@ const inputText = ref('')
|
||||
const selectedImage = ref(null)
|
||||
const pending = ref(false)
|
||||
const traces = ref([])
|
||||
const tracesCollapsed = ref(false)
|
||||
const tracesCollapsed = ref(true)
|
||||
const reasoning = ref('')
|
||||
const reasoningCollapsed = ref(false)
|
||||
const reasoningCollapsed = ref(true)
|
||||
const stats = ref(null)
|
||||
const profiles = ref([])
|
||||
const activeProfile = ref('')
|
||||
@@ -278,9 +278,9 @@ function bindServerConversation(conversation) {
|
||||
|
||||
function resetStreamDetails() {
|
||||
traces.value = []
|
||||
tracesCollapsed.value = false
|
||||
tracesCollapsed.value = true
|
||||
reasoning.value = ''
|
||||
reasoningCollapsed.value = false
|
||||
reasoningCollapsed.value = true
|
||||
stats.value = null
|
||||
clearSelectedImage()
|
||||
}
|
||||
@@ -473,9 +473,9 @@ async function sendMessage() {
|
||||
inputText.value = ''
|
||||
clearSelectedImage()
|
||||
traces.value = []
|
||||
tracesCollapsed.value = false
|
||||
tracesCollapsed.value = true
|
||||
reasoning.value = ''
|
||||
reasoningCollapsed.value = false
|
||||
reasoningCollapsed.value = true
|
||||
stats.value = null
|
||||
|
||||
const userMessage = { role: 'user', content: text }
|
||||
|
||||
Reference in New Issue
Block a user