Skip to content

Commit 1510ed2

Browse files
Updated model selection and added prompts for user input
1 parent 51f9933 commit 1510ed2

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

index.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import prompts from "prompts";
88
import { program } from "commander";
99

1010
let openai;
11+
let model = "gpt-3.5-turbo-instruct"; // Default model
1112

1213
export async function getGitSummary() {
1314
try {
@@ -44,7 +45,7 @@ const gptCommit = async () => {
4445
\n\nThe Commit message must wrap with double quote like this "your commit message"
4546
\n\nCommit message: `;
4647
const parameters = {
47-
model: "gpt-3.5-turbo-instruct",
48+
model,
4849
prompt,
4950
temperature: 0,
5051
max_tokens: 50,
@@ -70,6 +71,7 @@ const gptCommit = async () => {
7071
console.log("Commit canceled.");
7172
}
7273
};
74+
7375
const gitExtension = (args) => {
7476
// Extract the command and arguments from the command line
7577
const [command, ...rest] = args;
@@ -81,7 +83,24 @@ const gitExtension = (args) => {
8183
await gptCommit();
8284
});
8385

84-
// Add more commands here
86+
program
87+
.command("model")
88+
.description("Select the model to use")
89+
.action(async () => {
90+
const response = await prompts({
91+
type: "select",
92+
name: "value",
93+
message: "Select a model",
94+
choices: [
95+
{ title: "gpt-3.5-turbo-instruct", value: "gpt-3.5-turbo-instruct" },
96+
{ title: "gpt-4-1106-preview", value: "gpt-4-1106-preview" }
97+
],
98+
initial: 0
99+
});
100+
101+
model = response.value;
102+
console.log(`Model set to ${model}`);
103+
});
85104

86105
// Handle invalid commands
87106
program.on("command:*", () => {

0 commit comments

Comments
 (0)