mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 12:07:51 +08:00
fix(i18n): restore ASSISTANT_PLACEHOLDERS export and translate formatDate fallback
- Re-export ASSISTANT_PLACEHOLDERS as translated strings computed from keys
so getAssistantPlaceholder() returns from the array (restores test contract)
- formatDate() now returns i18n.t("memory.never") instead of "" for the
empty-date fallback
This commit is contained in:
@ -14,12 +14,14 @@ const ASSISTANT_PLACEHOLDER_KEYS = [
|
||||
"assistant.placeholder.4",
|
||||
];
|
||||
|
||||
export const ASSISTANT_PLACEHOLDERS: string[] = ASSISTANT_PLACEHOLDER_KEYS.map(
|
||||
(key) => i18n.t(key),
|
||||
);
|
||||
|
||||
export function getAssistantPlaceholder(): string {
|
||||
const key =
|
||||
ASSISTANT_PLACEHOLDER_KEYS[
|
||||
Math.floor(Math.random() * ASSISTANT_PLACEHOLDER_KEYS.length)
|
||||
];
|
||||
return i18n.t(key);
|
||||
return ASSISTANT_PLACEHOLDERS[
|
||||
Math.floor(Math.random() * ASSISTANT_PLACEHOLDERS.length)
|
||||
];
|
||||
}
|
||||
|
||||
export const ASSISTANT_SESSIONS_STORAGE_KEY = "langflow-assistant-sessions";
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import i18n from "@/i18n";
|
||||
|
||||
export const formatDate = (dateStr?: string) => {
|
||||
if (!dateStr) return "";
|
||||
if (!dateStr) return i18n.t("memory.never");
|
||||
const d = new Date(dateStr);
|
||||
if (Number.isNaN(d.getTime())) return dateStr;
|
||||
return d.toLocaleString(undefined, {
|
||||
|
||||
Reference in New Issue
Block a user