feat: add cli support for model

pull/511/head^2
Travis Fischer 2023-04-01 14:39:39 -05:00
rodzic 0984504154
commit e1d536e62f
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -29,8 +29,11 @@ async function main() {
.option('-s, --store', 'Enables the local message cache', { .option('-s, --store', 'Enables the local message cache', {
default: true default: true
}) })
.option('-t, --timeout', 'Timeout in milliseconds') .option('-t, --timeout <timeout>', 'Timeout in milliseconds')
.option('-k, --apiKey <apiKey>', 'OpenAI API key') .option('-k, --apiKey <apiKey>', 'OpenAI API key')
.option('-m, --model <model>', 'Model (gpt-3.5-turbo, gpt-4)', {
default: 'gpt-3.5-turbo'
})
.option( .option(
'-n, --conversationName <conversationName>', '-n, --conversationName <conversationName>',
'Unique name for the conversation' 'Unique name for the conversation'
@ -50,6 +53,7 @@ async function main() {
options.continue && options.store options.continue && options.store
? config.get(conversationKey, {}) || {} ? config.get(conversationKey, {}) || {}
: {} : {}
const model = options.model
let conversationId = undefined let conversationId = undefined
let parentMessageId = undefined let parentMessageId = undefined
@ -68,6 +72,9 @@ async function main() {
const api = new ChatGPTAPI({ const api = new ChatGPTAPI({
apiKey, apiKey,
debug: options.debug, debug: options.debug,
completionParams: {
model
},
getMessageById: async (id) => { getMessageById: async (id) => {
if (options.store) { if (options.store) {
return conversation[id] return conversation[id]