refactor: schemas

This commit is contained in:
Han Xiao 2025-02-25 16:09:08 +08:00
parent cf403302a9
commit 142e22a3fe
2 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import {z, ZodObject} from 'zod';
import {ZodObject} from 'zod';
import {CoreAssistantMessage, CoreUserMessage} from 'ai';
import {SEARCH_PROVIDER, STEP_SLEEP} from "./config";
import {readUrl, removeAllLineBreaks} from "./tools/read";

View File

@ -1,4 +1,5 @@
import {AnswerAction} from "../types";
import i18nJSON from './i18n.json';
export function buildMdFromAnswer(answer: AnswerAction) {
// Standard footnote regex
@ -129,8 +130,7 @@ export function removeHTMLtags(text: string) {
export function getI18nText(key: string, lang = 'en', params: Record<string, string> = {}) {
// 获取i18n数据
const i18nData = require('./i18n.json');
const i18nData = i18nJSON as Record<string, any>;
// 确保语言代码存在,如果不存在则使用英语作为后备
if (!i18nData[lang]) {
console.error(`Language '${lang}' not found, falling back to English.`);