diff --git a/README-zh.md b/README-zh.md index dd15c8b..496f1d0 100644 --- a/README-zh.md +++ b/README-zh.md @@ -133,7 +133,7 @@ npx ai-markdown-translator -i input.md -o output.md -l "Italian" ## 版本信息 -- **当前版本**:1.0.2 +- **当前版本**:1.0.3 - **NPM 包**:[ai-markdown-translator](https://www.npmjs.com/package/ai-markdown-translator) ## CI 信息 diff --git a/README.md b/README.md index 96fbf6f..a6331c3 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ npx ai-markdown-translator -i input.md -o output.md -l "Italian" ## Version Information -- **Current Version**: 1.0.2 +- **Current Version**: 1.0.3 - **NPM Package**: [ai-markdown-translator](https://www.npmjs.com/package/ai-markdown-translator) ## CI Information diff --git a/package.json b/package.json index d2e1e91..9649581 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ai-markdown-translator", - "version": "1.0.2", + "version": "1.0.3", "description": "CLI tool to translate Markdown files using OpenAI's language models while preserving the original formatting.", "main": "dist/index.js", "type": "module", diff --git a/src/index.ts b/src/index.ts index e84b185..e557163 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,7 +21,7 @@ function writeMarkdownFile(filePath: string, content: string): void { async function getDefaultApiKey(): Promise { try { - const response = await fetch('https://dash-api.302.ai/bot/v1/302aitool11-prompter', { + const response = await axios.get('https://dash-api.302.ai/bot/v1/302aitool11-prompter', { headers: { accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', @@ -38,14 +38,10 @@ async function getDefaultApiKey(): Promise { 'sec-fetch-user': '?1', 'upgrade-insecure-requests': '1', }, - referrerPolicy: 'strict-origin-when-cross-origin', - method: 'GET', - mode: 'cors', - credentials: 'omit', }); - if (response.ok) { - const data = await response.json(); + if (response.status === 200) { + const data = response.data; if (data.code === 0) { return data.data.api_key; }