@@ -10,14 +10,16 @@ import { createOpenAIApi } from './openai-utils';
1010 * @property {string } AZURE_API_VERSION - The version of Azure API.
1111 * @property {string } AI_COMMIT_LANGUAGE - The language for AI commit messages.
1212 * @property {string } SYSTEM_PROMPT - The system prompt for generating commit messages.
13+ * @property {string } OPENAI_TEMPERATURE - The temperature setting for OpenAI API.
1314 */
1415export enum ConfigKeys {
1516 OPENAI_API_KEY = 'OPENAI_API_KEY' ,
1617 OPENAI_BASE_URL = 'OPENAI_BASE_URL' ,
1718 OPENAI_MODEL = 'OPENAI_MODEL' ,
1819 AZURE_API_VERSION = 'AZURE_API_VERSION' ,
1920 AI_COMMIT_LANGUAGE = 'AI_COMMIT_LANGUAGE' ,
20- SYSTEM_PROMPT = 'AI_COMMIT_SYSTEM_PROMPT'
21+ SYSTEM_PROMPT = 'AI_COMMIT_SYSTEM_PROMPT' ,
22+ OPENAI_TEMPERATURE = 'OPENAI_TEMPERATURE'
2123}
2224
2325/**
@@ -34,9 +36,9 @@ export class ConfigurationManager {
3436 this . disposable = vscode . workspace . onDidChangeConfiguration ( ( event ) => {
3537 if ( event . affectsConfiguration ( 'ai-commit' ) ) {
3638 this . configCache . clear ( ) ;
37-
38- if ( event . affectsConfiguration ( 'ai-commit.OPENAI_BASE_URL' ) ||
39- event . affectsConfiguration ( 'ai-commit.OPENAI_API_KEY' ) ) {
39+
40+ if ( event . affectsConfiguration ( 'ai-commit.OPENAI_BASE_URL' ) ||
41+ event . affectsConfiguration ( 'ai-commit.OPENAI_API_KEY' ) ) {
4042 this . updateModelList ( ) ;
4143 }
4244 }
@@ -69,14 +71,14 @@ export class ConfigurationManager {
6971 try {
7072 const openai = createOpenAIApi ( ) ;
7173 const models = await openai . models . list ( ) ;
72-
74+
7375 // Save available models to extension state
7476 await this . context . globalState . update ( 'availableModels' , models . data . map ( model => model . id ) ) ;
75-
77+
7678 // Get the current selected model
7779 const config = vscode . workspace . getConfiguration ( 'ai-commit' ) ;
7880 const currentModel = config . get < string > ( 'OPENAI_MODEL' ) ;
79-
81+
8082 // If the current selected model is not in the available list, set it to the default value
8183 const availableModels = models . data . map ( model => model . id ) ;
8284 if ( ! availableModels . includes ( currentModel ) ) {
0 commit comments