Skip to content

Commit

Permalink
✨ Feature(custom): remove support of palm
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuingsmile committed Nov 19, 2024
1 parent f369ab7 commit 84dc623
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 137 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Word GPT Plus is a word add-in which integrates the chatGPT model into Microsoft
- OpenAI API
- Azure OpenAI API
- Ollama2
- Google PALM2 API
- Google Gemini Pro API
- Groq
- Support for multiple languages
Expand All @@ -48,9 +47,7 @@ Official API need an OpenAI api key, you can get it from [https://platform.opena

You need to apply for qualification first, please go to [Azure OpenAI API application website](https://go.microsoft.com/fwlink/?linkid=2222006&clcid=0x409&culture=en-us&country=us) to apply for qualification.

You need to go to [Google AI](https://developers.generativeai.google/) to apply for qualification for Google PALM2 API.

Google Gemini Pro API's api key is the same as Google PALM2 API's api key, and the free version is currently limited to 60 requests per minute.
You need to go to [Google AI](https://developers.generativeai.google/) to apply for qualification for Google Google Gemini Pro API, and the free version is currently limited to 60 requests per minute.

Groq's api key can be applied for at [https://console.groq.com/keys](https://console.groq.com/keys).

Expand Down
5 changes: 1 addition & 4 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Word GPT Plus 是一个集成了 chatGPT 模型的 Word 插件。它允许你基
- OpenAI API
- Azure OpenAI API
- Ollama2
- Google PALM2 API
- Google Gemini Pro API
- Groq
- 支持多种语言
Expand All @@ -48,9 +47,7 @@ Word GPT Plus 是一个集成了 chatGPT 模型的 Word 插件。它允许你基

Azure OpenAI需要首先申请资格,请前往[Azure OpenAI API申请网址](https://go.microsoft.com/fwlink/?linkid=2222006&clcid=0x409&culture=en-us&country=us)申请资格。

Google PALM2 API需要前往[Google AI](https://developers.generativeai.google/)申请,申请后目前公测阶段使用是免费的。

Google Gemini Pro API的api key与Google PALM2 API的api key相同,目前免费版限制次数一分钟60个请求。
Google Gemini Pro API需要前往[Google AI](https://developers.generativeai.google/)申请,目前免费版限制次数一分钟60个请求。

Groq的api key可以在[https://console.groq.com/keys](https://console.groq.com/keys)申请。

Expand Down
2 changes: 0 additions & 2 deletions src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import official from './official'
import azure from './azure'
import palm from './palm'
import common from './common'
import gemini from './gemini'
import groq from './groq'
Expand All @@ -9,7 +8,6 @@ import ollama from './ollama'
export default {
official,
azure,
palm,
gemini,
groq,
common,
Expand Down
55 changes: 0 additions & 55 deletions src/api/palm.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ const messages = {
azureDeploymentNamePlaceholder: 'Deploy name',
azureTemperatureLabel: 'Temperature',
azureMaxTokensLabel: 'Max tokens',
palmAPIKeyLabel: 'API Key',
palmAPIKeyPlaceholder: 'API key',
palmAPIEndpointLabel: 'endpoint',
palmAPIEndpointPlaceholder: 'endpoint',
palmCustomModelLabel: 'Custom Model',
palmCustomModelPlaceholder: 'Please input model',
palmModelSelectLabel: 'Model',
palmModelSelectPlaceholder: 'Please select model',
palmTemperatureLabel: 'Temperature',
palmMaxTokensLabel: 'Max tokens',
geminiAPIKeyLabel: 'API Key',
geminiAPIKeyPlaceholder: 'API key',
geminiCustomModelLabel: 'Custom Model',
Expand Down Expand Up @@ -128,16 +118,6 @@ const messages = {
azureDeploymentNamePlaceholder: '部署名',
azureTemperatureLabel: 'temperature',
azureMaxTokensLabel: 'max tokens',
palmAPIKeyLabel: 'API 密钥',
palmAPIKeyPlaceholder: 'API 密钥',
palmAPIEndpointLabel: 'endpoint',
palmAPIEndpointPlaceholder: 'endpoint',
palmCustomModelLabel: '自定义模型',
palmCustomModelPlaceholder: '请输入模型',
palmModelSelectLabel: '选择模型',
palmModelSelectPlaceholder: '请选择模型',
palmTemperatureLabel: 'temperature',
palmMaxTokensLabel: 'max tokens',
geminiAPIKeyLabel: 'API 密钥',
geminiAPIKeyPlaceholder: 'API 密钥',
geminiCustomModelLabel: '自定义模型',
Expand Down
14 changes: 0 additions & 14 deletions src/pages/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -489,19 +489,6 @@ async function template(taskType: keyof typeof buildInPrompt | 'custom') {
maxTokens: settingForm.value.azureMaxTokens,
temperature: settingForm.value.azureTemperature
})
} else if (settingForm.value.api === 'palm' && settingForm.value.palmAPIKey) {
await API.palm.createChatCompletionStream({
palmAPIKey: settingForm.value.palmAPIKey,
palmAPIEndpoint: settingForm.value.palmAPIEndpoint,
palmModel:
settingForm.value.palmCustomModel || settingForm.value.palmModelSelect,
prompt: `${systemMessage}\n${userMessage}`,
result,
errorIssue,
loading,
maxTokens: settingForm.value.palmMaxTokens,
temperature: settingForm.value.palmTemperature
})
} else if (
settingForm.value.api === 'gemini' &&
settingForm.value.geminiAPIKey
Expand Down Expand Up @@ -578,7 +565,6 @@ function checkApiKey() {
type: settingForm.value.api,
apiKey: settingForm.value.officialAPIKey,
azureAPIKey: settingForm.value.azureAPIKey,
palmAPIKey: settingForm.value.palmAPIKey,
geminiAPIKey: settingForm.value.geminiAPIKey,
groqAPIKey: settingForm.value.groqAPIKey
}
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ interface IStringKeyMap {
[propName: string]: any
}

type supportedPlatforms = 'official' | 'azure' | 'palm' | 'gemini' | 'ollama' | 'groq'
type supportedPlatforms = 'official' | 'azure' | 'gemini' | 'ollama' | 'groq'

type insertTypes = 'replace' | 'append' | 'newLine' | 'NoAction'
3 changes: 0 additions & 3 deletions src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
availableModelsForGemini,
availableModelsForGroq,
availableModelsForOllama,
availableModelsForPalm,
languageMap
} from './constant'

Expand All @@ -18,7 +17,6 @@ export function checkAuth(auth: Auth): boolean {
auth &&
((auth.type === 'official' && !!auth.apiKey) ||
(auth.type === 'azure' && !!auth.azureAPIKey) ||
(auth.type === 'palm' && !!auth.palmAPIKey) ||
(auth.type === 'gemini' && !!auth.geminiAPIKey) ||
(auth.type === 'groq' && !!auth.groqAPIKey) ||
auth.type === 'ollama')
Expand Down Expand Up @@ -61,7 +59,6 @@ export const optionLists = {
apiList: getOptionList(availableAPIs),
replyLanguageList: getOptionList(languageMap, 'value'),
officialModelList: getOptionList(availableModels),
palmModelList: getOptionList(availableModelsForPalm),
geminiModelList: getOptionList(availableModelsForGemini),
ollamaModelList: getOptionList(availableModelsForOllama),
groqModelList: getOptionList(availableModelsForGroq)
Expand Down
6 changes: 0 additions & 6 deletions src/utils/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const languageMap: IStringKeyMap = {
export const availableAPIs: IStringKeyMap = {
official: 'official',
azure: 'azure',
palm: 'palm',
gemini: 'gemini',
ollama: 'ollama',
groq: 'groq'
Expand All @@ -66,11 +65,6 @@ export const availableModels: IStringKeyMap = {
'gpt4-0613': 'gpt-4-0613'
}

// palm api 可用的模型
export const availableModelsForPalm: IStringKeyMap = {
'text-bison-001': 'text-bison-001'
}

// Gemini API 可用的模型
export const availableModelsForGemini: IStringKeyMap = {
'gemini-1.5-flash': 'gemini-1.5-flash',
Expand Down
7 changes: 0 additions & 7 deletions src/utils/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ export enum localStorageKey {
azureDeploymentName = 'azureDeploymentName',
azureMaxTokens = 'azureMaxTokens',
azureTemperature = 'azureTemperature',
// palm api
palmAPIKey = 'palmAPIKey',
palmAPIEndpoint = 'palmAPIEndpoint',
palmMaxTokens = 'palmMaxTokens',
palmTemperature = 'palmTemperature',
palmModel = 'palmModel',
palmCustomModel = 'palmCustomModel',
// gemini api
geminiAPIKey = 'geminiAPIKey',
geminiMaxTokens = 'geminiMaxTokens',
Expand Down
4 changes: 4 additions & 0 deletions src/utils/settingForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ function useSettingForm() {
settingForm.value[key as keyof typeof settingForm.value] =
localStorage.getItem(settingPreset[key].saveKey || key) ||
settingForm.value[key as keyof typeof settingForm.value]
if (settingForm.value.api === 'palm') {
settingForm.value.api = 'gemini'
localStorage.setItem('api', 'gemini')
}
})
return { settingForm, settingFormKeys }
}
Expand Down
22 changes: 1 addition & 21 deletions src/utils/settingPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import {
availableModels,
availableModelsForGemini,
availableModelsForGroq,
availableModelsForOllama,
availableModelsForPalm
availableModelsForOllama
} from './constant'
import { localStorageKey } from './enum'

Expand Down Expand Up @@ -36,12 +35,6 @@ export type SettingNames =
| 'azureDeploymentName'
| 'azureTemperature'
| 'azureMaxTokens'
| 'palmAPIKey'
| 'palmAPIEndpoint'
| 'palmCustomModel'
| 'palmModelSelect'
| 'palmTemperature'
| 'palmMaxTokens'
| 'geminiAPIKey'
| 'geminiCustomModel'
| 'geminiModelSelect'
Expand Down Expand Up @@ -157,19 +150,6 @@ export const settingPreset: Record<SettingNames, ISettingOption> = {
azureDeploymentName: defaultInputSetting,
azureTemperature: inputNumSetting(0.7, 'azureTemperature', 'temperature'),
azureMaxTokens: inputNumSetting(800, 'azureMaxTokens', 'maxTokens'),
palmAPIKey: defaultInputSetting,
palmAPIEndpoint: inputSetting(
'https://generativelanguage.googleapis.com/v1beta2'
),
palmCustomModel: defaultInputSetting,
palmModelSelect: selectSetting(
availableModelsForPalm['text-bison-001'],
'palmModel',
optionLists.palmModelList,
availableModelsForPalm
),
palmTemperature: inputNumSetting(0.7, 'palmTemperature', 'temperature'),
palmMaxTokens: inputNumSetting(800, 'palmMaxTokens', 'maxTokens'),
geminiAPIKey: defaultInputSetting,
geminiCustomModel: defaultInputSetting,
geminiModelSelect: selectSetting(
Expand Down

0 comments on commit 84dc623

Please sign in to comment.