1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2026-07-25 05:24:08 +08:00

2 Commits

Author SHA1 Message Date
zclzone
cebfc605bd docs: update README 2026-06-24 14:24:17 +08:00
zclzone
e4fcbc0b07 feat: 添加runapi本地代理 2026-06-17 17:43:08 +08:00
3 changed files with 17 additions and 2 deletions

View File

@@ -17,7 +17,7 @@
> 我们提供WebPC+H5+小程序)的技术支持服务及定制开发,不限前后端,详细需求可联系作者,微信: isme-admin邮箱: admin@isme.top
> [!Tip]
> 项目内置 AI 翻译功能,体验模型由 [RunAPI](https://runapi.co/register?aff=Da0v) 提供支持。如需稳定、快速、实惠的中转模型 API 服务,可前往注册使用,RunAPI 为本项目的用户提供了特别福利,通过此链接注册并联系客服可领取 ¥14 免费额度
> 项目内置 AI 翻译功能,模型由 [RunAPI](https://runapi.co/register?aff=Da0v) 提供支持。如需稳定、快速、实惠的中转模型 API 服务,可前往注册使用,通过此链接注册自动获赠$0.1体验额度GPT-5.5模型可对话2-3次欢迎体验
## 简介

View File

@@ -21,6 +21,8 @@ export const DEFAULT_SETTINGS = {
export const EXPERIENCE_KEY_MAX_TEXT_LENGTH = 100
const RUNAPI_PROXY_BASE_URL = '/runapi'
const TRANSLATION_RULES = 'Translate directly. Return only the translation. Preserve formatting, markdown, code, URLs, numbers, placeholders, and line breaks.'
export function isSettingsReady(target) {
@@ -80,10 +82,17 @@ function createFastModelOptions(model) {
}
}
function createRequestBaseUrl(apiBaseUrl) {
const baseUrl = apiBaseUrl.trim().replace(/\/+$/, '')
if (baseUrl === API_BASE_URL_OPTIONS[0])
return RUNAPI_PROXY_BASE_URL
return baseUrl
}
export async function translateText(text, settings) {
validateTranslateText(text, settings)
const baseUrl = settings.apiBaseUrl.trim().replace(/\/+$/, '')
const baseUrl = createRequestBaseUrl(settings.apiBaseUrl)
const model = settings.model.trim() || DEFAULT_SETTINGS.model
const sourceLanguage = detectSourceLanguage(text)

View File

@@ -67,6 +67,12 @@ export default defineConfig(({ mode }) => {
})
},
},
'/runapi': {
target: 'https://runapi.co',
changeOrigin: true,
rewrite: path => path.replace(/^\/runapi/, '/v1'),
secure: false,
},
},
},
optimizeDeps: {