mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-07-17 11:26:00 +08:00
23 lines
652 B
JavaScript
23 lines
652 B
JavaScript
import { getUserConfig } from '../../config/index.mjs'
|
|
import { getToken } from '../../utils/jwt-token-generator.mjs'
|
|
import { generateAnswersWithChatgptApiCompat } from './openai-api.mjs'
|
|
|
|
/**
|
|
* @param {Runtime.Port} port
|
|
* @param {string} question
|
|
* @param {Session} session
|
|
* @param {string} modelName
|
|
*/
|
|
export async function generateAnswersWithChatGLMApi(port, question, session, modelName) {
|
|
const baseUrl = 'https://open.bigmodel.cn/api/paas/v4'
|
|
const config = await getUserConfig()
|
|
return generateAnswersWithChatgptApiCompat(
|
|
baseUrl,
|
|
port,
|
|
question,
|
|
session,
|
|
getToken(config.chatglmApiKey),
|
|
modelName,
|
|
)
|
|
}
|