@@ -65,11 +65,14 @@ export const poeWebModelKeys = [
6565 'poeAiWeb_Llama_2_13b' ,
6666 'poeAiWeb_Llama_2_70b' ,
6767]
68+ export const moonshotApiModelKeys = [ 'moonshot_v1_8k' , 'moonshot_v1_32k' , 'moonshot_v1_128k' ]
69+ const moonshotApiKeyGenerateUrl = 'https://platform.moonshot.cn/console/api-keys'
6870
6971/**
7072 * @typedef {object } Model
7173 * @property {string } value
7274 * @property {string } desc
75+ * @property {string } [keyGenerateUrl]
7376 */
7477/**
7578 * @type {Object.<string,Model> }
@@ -136,6 +139,22 @@ export const Models = {
136139 poeAiWebChatGpt : { value : 'chatgpt' , desc : 'Poe AI (Web, ChatGPT)' } ,
137140 poeAiWebChatGpt_16k : { value : 'chatgpt-16k' , desc : 'Poe AI (Web, ChatGPT-16k)' } ,
138141 poeAiWebCustom : { value : '' , desc : 'Poe AI (Web, Custom)' } ,
142+
143+ moonshot_v1_8k : {
144+ value : 'moonshot-v1-8k' ,
145+ desc : 'Moonshot (8k)' ,
146+ keyGenerateUrl : moonshotApiKeyGenerateUrl ,
147+ } ,
148+ moonshot_v1_32k : {
149+ value : 'moonshot-v1-32k' ,
150+ desc : 'Moonshot (32k)' ,
151+ keyGenerateUrl : moonshotApiKeyGenerateUrl ,
152+ } ,
153+ moonshot_v1_128k : {
154+ value : 'moonshot-v1-128k' ,
155+ desc : 'Moonshot (128k)' ,
156+ keyGenerateUrl : moonshotApiKeyGenerateUrl ,
157+ } ,
139158}
140159
141160for ( const modelName in Models ) {
@@ -293,7 +312,8 @@ export function getNavigatorLanguage() {
293312export function isUsingApiKey ( configOrSession ) {
294313 return (
295314 gptApiModelKeys . includes ( configOrSession . modelName ) ||
296- chatgptApiModelKeys . includes ( configOrSession . modelName )
315+ chatgptApiModelKeys . includes ( configOrSession . modelName ) ||
316+ moonshotApiModelKeys . includes ( configOrSession . modelName )
297317 )
298318}
299319
@@ -324,6 +344,14 @@ export function isUsingGithubThirdPartyApi(configOrSession) {
324344 return githubThirdPartyApiModelKeys . includes ( configOrSession . modelName )
325345}
326346
347+ export function isSupportBalance ( configOrSession ) {
348+ return (
349+ isUsingAzureOpenAi ( configOrSession ) ||
350+ gptApiModelKeys . includes ( configOrSession . modelName ) ||
351+ chatgptApiModelKeys . includes ( configOrSession . modelName )
352+ )
353+ }
354+
327355export async function getPreferredLanguageKey ( ) {
328356 const config = await getUserConfig ( )
329357 if ( config . preferredLanguage === 'auto' ) return config . userLanguage
0 commit comments