Skip to content

Commit

Permalink
fix: international and fix gpt no key tips
Browse files Browse the repository at this point in the history
  • Loading branch information
VisionView committed May 9, 2024
1 parent aa66f17 commit b9e4418
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/lang/enUS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export const enUS = {
title: 'GPTs',
others: 'Other GPTs',
model: 'Model',
modelPlaceholder: 'Please enter the GPT model name',
apiKey: 'API Key',
apiKeyPlaceholder: 'Please enter the API Key',
prompt: 'Prompt',
proxy: 'Network Proxy',
form: {
Expand Down Expand Up @@ -60,6 +62,7 @@ export const enUS = {
edit: 'Edit',
remove: 'Remove',
},
selectIndex: 'No collection/index selected',
validationFailed: 'Form validation failed!',
unAuthorized: 'Authorization failed, ensure your username and password are correct',
},
Expand Down
3 changes: 3 additions & 0 deletions src/lang/zhCN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export const zhCN = {
title: 'GPTs配置',
others: '其他GPTs',
model: '模型',
modelPlaceholder: '请输入GPT模型名称',
apiKey: 'API密钥',
apiKeyPlaceholder: '请输入API密钥',
prompt: '提示词',
proxy: '网络代理',
form: {
Expand Down Expand Up @@ -60,6 +62,7 @@ export const zhCN = {
edit: '编辑',
remove: '删除',
},
selectIndex: '未选择集合/索引',
validationFailed: '表单验证失败!',
unAuthorized: '认证失败,请输入正确的用户名和密码!',
},
Expand Down
1 change: 0 additions & 1 deletion src/layout/components/chatbot-box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const chatBotNotification = ref({
});
// 提交消息
const submitMsg = () => {
console.log(chatMsg.value);
chatBotNotification.value = { enabled: false, level: '', message: '' };
if (!chatMsg.value.trim().length) return;
sendMessage(chatMsg.value)
Expand Down
13 changes: 12 additions & 1 deletion src/layout/components/tool-bar-right.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,25 @@
<script setup lang="ts">
import { markRaw, ref } from 'vue';
import { ChatBot } from '@vicons/carbon';
import { getOpenAiConfig } from './../../store'
import { useLang } from './../../lang'
import TheAsideIcon from './the-aside-icon.vue';
import ChatbotBox from './chatbot-box.vue';
const lang = useLang();
const message = useMessage();
const selectedItemId = ref(-1);
const chatBot = ref({ active: false });
const navClick = (item: any) => {
const navClick = async (item: any) => {
selectedItemId.value = item.id;
if (item.id === 'chat-bot') {
const { apiKey } = await getOpenAiConfig();
if (!apiKey) {
message.error(lang.t('setting.ai.missing'));
return false;
}
chatBot.value.active = !chatBot.value.active;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/store/chatStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const { chatBotApi, storeAPI } = window;

let receiveRegistration = false;

const getOpenAiConfig = async () => {
export const getOpenAiConfig = async () => {
const { openAi } = await storeAPI.getSecret('aigcConfig', { openAi: undefined });
if (!openAi) {
throw new Error(lang.global.t('setting.ai.missing'));
Expand Down
2 changes: 1 addition & 1 deletion src/views/connect/components/collection-selector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="collection-selector-container">
<n-select
:options="options"
placeholder="No collection/index selected"
:placeholder="$t('connection.selectIndex')"
remote
filterable
:loading="loadingRef"
Expand Down
12 changes: 10 additions & 2 deletions src/views/setting/components/aigc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
<n-tab-pane name="OpenAI" tab="OpenAI">
<n-form class="form-tab-pane">
<n-form-item-row :label="$t('setting.ai.model')">
<n-input v-model:value="openAi.model" />
<n-input
v-model:value="openAi.model"
:placeholder="$t('setting.ai.modelPlaceholder')"
/>
</n-form-item-row>
<n-form-item-row :label="$t('setting.ai.apiKey')">
<n-input type="password" show-password-on="click" v-model:value="openAi.apiKey" />
<n-input
type="password"
show-password-on="click"
v-model:value="openAi.apiKey"
:placeholder="$t('setting.ai.apiKeyPlaceholder')"
/>
</n-form-item-row>
<n-form-item-row :label="$t('setting.ai.prompt')">
<n-input
Expand Down

0 comments on commit b9e4418

Please sign in to comment.