mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2026-03-22 07:29:35 +08:00
refactor: schemas
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import {z, ZodObject} from 'zod';
|
import {ZodObject} from 'zod';
|
||||||
import {CoreAssistantMessage, CoreUserMessage} from 'ai';
|
import {CoreAssistantMessage, CoreUserMessage} from 'ai';
|
||||||
import {SEARCH_PROVIDER, STEP_SLEEP} from "./config";
|
import {SEARCH_PROVIDER, STEP_SLEEP} from "./config";
|
||||||
import {readUrl, removeAllLineBreaks} from "./tools/read";
|
import {readUrl, removeAllLineBreaks} from "./tools/read";
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {AnswerAction} from "../types";
|
import {AnswerAction} from "../types";
|
||||||
|
import i18nJSON from './i18n.json';
|
||||||
|
|
||||||
export function buildMdFromAnswer(answer: AnswerAction) {
|
export function buildMdFromAnswer(answer: AnswerAction) {
|
||||||
// Standard footnote regex
|
// Standard footnote regex
|
||||||
@@ -129,8 +130,7 @@ export function removeHTMLtags(text: string) {
|
|||||||
|
|
||||||
export function getI18nText(key: string, lang = 'en', params: Record<string, string> = {}) {
|
export function getI18nText(key: string, lang = 'en', params: Record<string, string> = {}) {
|
||||||
// 获取i18n数据
|
// 获取i18n数据
|
||||||
const i18nData = require('./i18n.json');
|
const i18nData = i18nJSON as Record<string, any>;
|
||||||
|
|
||||||
// 确保语言代码存在,如果不存在则使用英语作为后备
|
// 确保语言代码存在,如果不存在则使用英语作为后备
|
||||||
if (!i18nData[lang]) {
|
if (!i18nData[lang]) {
|
||||||
console.error(`Language '${lang}' not found, falling back to English.`);
|
console.error(`Language '${lang}' not found, falling back to English.`);
|
||||||
|
|||||||
Reference in New Issue
Block a user