diff --git a/schedule/byteMonitor.ts b/schedule/byteMonitor.ts index b05ae98..7a87573 100644 --- a/schedule/byteMonitor.ts +++ b/schedule/byteMonitor.ts @@ -6,6 +6,7 @@ import pbClient from "../db/pbClient" import { Context } from "../types" import { genContextManually } from "../utils/genContext" import llm from "../utils/llm" +import { cleanLLMRes } from "../utils/llm/base" await initAppConfig() @@ -26,8 +27,11 @@ const translateTextList = async (textList: string[], requestId: string) => { 1, true ) + console.log("🚀 ~ translateTextList ~ translatedTexts:", translatedTexts) - const translatedList = JSON.parse(translatedTexts as string) as string[] + const translatedList = JSON.parse( + cleanLLMRes(translatedTexts as string) + ) as string[] const translatedMap: Record = {} textList.forEach((text, index) => { @@ -227,6 +231,7 @@ const byteMonitor = async () => { "byteMonitor 更新" ) } catch (error) { + console.error(error) const errorMessage = `byteMonitor error: ${error}` logger.error(errorMessage) } finally { diff --git a/test/schedule/byteMonitor.ts b/test/schedule/byteMonitor.ts new file mode 100644 index 0000000..4a965d7 --- /dev/null +++ b/test/schedule/byteMonitor.ts @@ -0,0 +1,6 @@ +import initAppConfig from "../../constant/config" +import byteMonitor from "../../schedule/byteMonitor" + +await initAppConfig() + +await byteMonitor()