mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2026-07-25 05:24:08 +08:00
Compare commits
2 Commits
3a09be229b
...
cebfc605bd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cebfc605bd | ||
|
|
e4fcbc0b07 |
@@ -17,7 +17,7 @@
|
||||
> 我们提供Web(PC+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次,欢迎体验。
|
||||
|
||||
## 简介
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -67,6 +67,12 @@ export default defineConfig(({ mode }) => {
|
||||
})
|
||||
},
|
||||
},
|
||||
'/runapi': {
|
||||
target: 'https://runapi.co',
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/runapi/, '/v1'),
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
optimizeDeps: {
|
||||
|
||||
Reference in New Issue
Block a user