adjust ui text; add more intro; add 3rd list about apply a secret

This commit is contained in:
geekgeekrun
2025-04-13 13:47:01 +08:00
parent b7f149032a
commit 438bc973a2
4 changed files with 109 additions and 34 deletions

View File

@@ -40,12 +40,6 @@ import {
} from '../../READ_NO_REPLY_AUTO_REMINDER/boss-operation'
export default function initIpc() {
ipcMain.on('open-external-link', (_, link) => {
shell.openExternal(link, {
activate: true
})
})
ipcMain.handle('fetch-config-file-content', async () => {
const configFileContentList = configFileNameList.map((fileName) => {
return readConfigFile(fileName)

View File

@@ -1,4 +1,4 @@
import { BrowserWindow, ipcMain } from 'electron'
import { BrowserWindow, ipcMain, shell } from 'electron'
export default function initPublicIpc() {
ipcMain.on(
@@ -18,4 +18,9 @@ export default function initPublicIpc() {
win.setSize(size.width, size.height, size.animate)
}
)
ipcMain.on('open-external-link', (_, link) => {
shell.openExternal(link, {
activate: true
})
})
}

View File

@@ -3,8 +3,52 @@
<div class="main-wrapper">
<main>
<div class="mt1em mb1em">
<span>大语言模型设置</span>
<div class="flex flex-items-center flex-justify-between">
<div>大语言模型设置</div>
<el-dropdown @command="(item) => openExternalLink(item.url)">
<el-button size="small"
>申请 API Secret <el-icon class="el-icon--right"><arrow-down /></el-icon
></el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-for="item in providerList" :key="item.name" :command="item">{{
item.name
}}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
<el-alert type="info" :closable="false" mb20px line-height-1.25em>
<ul pl16px>
<li>
请确保当前服务商提供的模型支持<a
:style="{
color: 'var(--el-color-primary)'
}"
href="javascript:void(0)"
@click.prevent="
openExternalLink('https://api-docs.deepseek.com/zh-cn/api/create-chat-completion')
"
>对话补全</a
>且兼容
<a
:style="{
color: 'var(--el-color-primary)'
}"
href="javascript:void(0)"
@click.prevent="openExternalLink('https://www.npmjs.com/package/openai')"
>OpenAI SDK</a
>
</li>
<li><b class="color-red">暂不支持推理模型</b>例如 DeepSeek-R1</li>
<li>
请自行确保您所接入的服务商能够保护您的隐私<b class="color-red"
>此处所列举服务商-模型由第三方提供仅供配置参考不能保证它们能够合法使用您的数据不表示本程序认可相关模型</b
>
</li>
</ul>
</el-alert>
<el-form
ref="formRef"
:model="formContent"
@@ -83,7 +127,7 @@
font-size-12px
></el-input>
</el-form-item>
<el-form-item prop="model" label="要使用的模型">
<el-form-item prop="model" label="要使用的模型model参数">
<el-input
v-model="conf.model"
:autosize="{
@@ -153,7 +197,9 @@
<footer pt10px pb10px flex flex-justify-center>
<div w480px flex flex-justify-between>
<div>
<el-button type="text" @click="addConfig">添加其它服务</el-button>
<el-button font-size-12px type="text" @click="addConfig"
>添加其它模型<span v-if="formContent.length <= 1">以生成更随机的内容</span></el-button
>
</div>
<div>
<el-button @click="handleCancel">取消</el-button>
@@ -236,6 +282,26 @@ const llmPresetList: {
enabled: true
}
},
{
name: '由 火山引擎 提供的 DeepSeek-V3 模型',
config: {
model: 'deepseek-v3-250324',
providerApiSecret: '',
providerCompleteApiUrl: 'https://ark.cn-beijing.volces.com/api/v3',
serveWeight: 100,
enabled: true
}
},
{
name: '由 阿里云百炼 提供的 DeepSeek-V3 模型',
config: {
model: 'deepseek-v3',
providerApiSecret: '',
providerCompleteApiUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
serveWeight: 100,
enabled: true
}
},
// TODO:
// {
// name: '通过 Ollama 部署的 DeepSeek-R114B模型',
@@ -269,6 +335,29 @@ const llmPresetList: {
}
]
const providerList: Array<{ name: string; url: string }> = [
{
name: 'DeepSeek',
url: 'https://platform.deepseek.com/'
},
{
name: '火山引擎 - 火山方舟',
url: 'https://console.volcengine.com/ark'
},
{
name: '阿里云百炼',
url: 'https://bailian.console.aliyun.com/?tab=model#/api-key'
},
{
name: 'OpenAI (国内可能不可用)',
url: 'https://platform.openai.com/api-keys'
},
{
name: 'FREE-CHATGPT-API (免费)',
url: 'https://github.com/popjane/free_chatgpt_api'
}
]
function handlePresetClick(selected: (typeof llmPresetList)[number], index) {
for (const k of Object.keys(formContent.value[index])) {
formContent.value[index][k] = selected.config[k]
@@ -306,7 +395,7 @@ watch(
if (nVal <= 1) {
electron.ipcRenderer.send('update-window-size', {
width: window.innerWidth,
height: 360
height: 500
})
} else {
electron.ipcRenderer.send('update-window-size', {
@@ -319,6 +408,9 @@ watch(
immediate: true
}
)
const openExternalLink = (url) => {
electron.ipcRenderer.send('open-external-link', url)
}
// function handleTestAvailability() {}
</script>

View File

@@ -53,16 +53,7 @@
style="background-color: #462ac4"
>Qwen2.5</span
>
模型,通过<a
class="font-size-12px pt0 pb0"
:style="{
color: 'var(--el-color-primary)',
}"
type="text"
href="javascript:void(0)"
@click.prevent="openIntroOfCompletion"
>对话补全</a
>接口实现消息生成;支持多个“服务商-模型”组合按权重搭配使用
模型;支持多个“服务商-模型”组合按权重搭配使用
</div>
</div>
</el-form-item>
@@ -80,14 +71,14 @@
<div>
<div>
<el-button size="small" type="primary" @click="handleClickEditPrompt">
使用外部编辑器编辑 Prompt 模板
使用外部编辑器编辑提示词模板
</el-button>
<el-button size="small" type="primary" @click="restoreDefaultTemplate">
还原默认 Prompt 模板
还原默认提示词模板
</el-button>
</div>
<div class="font-size-12px color-#666">
对生成效果不够满意?可在此查看、编辑 Prompt 模板。请在模板中需要插入简历的位置插入
对生成效果不够满意?可在此查看、编辑提示词模板。请在模板中需要插入简历的位置插入
__REPLACE_REAL_RESUME_HERE__
</div>
</div>
@@ -228,9 +219,9 @@ const handleSubmit = async () => {
await electron.ipcRenderer.invoke('check-if-auto-remind-prompt-valid')
} catch (err) {
if (err?.message?.includes(`RESUME_PLACEHOLDER_NOT_EXIST`)) {
console.log(`Prompt 模板无效`, err)
console.log(`提示词模板无效`, err)
ElMessageBox.confirm(
'Prompt 模板缺少简历内容占位符:<br /><b>__REPLACE_REAL_RESUME_HERE__</b><br /><br />您是否希望还原默认的 Prompt 模板?',
'提示词模板缺少简历内容占位符:<br /><b>__REPLACE_REAL_RESUME_HERE__</b><br /><br />您是否希望还原默认的提示词模板?',
'',
{
confirmButtonText: '是',
@@ -247,7 +238,7 @@ const handleSubmit = async () => {
} else {
ElMessage({
type: 'error',
message: '用于生成自动提醒消息的 Prompt 检查未通过,请重试'
message: '用于生成自动提醒消息的提示词检查未通过,请重试'
})
}
return
@@ -314,13 +305,6 @@ const handleClickEditResume = async () => {
const handleClickEditPrompt = async () => {
await electron.ipcRenderer.send('no-reply-reminder-prompt-edit')
}
const openIntroOfCompletion = () => {
electron.ipcRenderer.send(
'open-external-link',
'https://api-docs.deepseek.com/zh-cn/api/create-chat-completion'
)
}
</script>
<style scoped lang="scss">