@@ -600,19 +600,48 @@ function registerCommands(context, providers, statusBarItem, setupFileWatcher, d
600600 { label : 'GPT-3.5 Turbo' , value : 'gpt-3.5-turbo' }
601601 ] ;
602602
603+ // Option für manuelle Eingabe hinzufügen
604+ models . push ( {
605+ label : '$(edit) Manuell eingeben...' ,
606+ description : 'Modellname manuell eingeben' ,
607+ value : '__manual__'
608+ } ) ;
609+
603610 const selection = await vscode . window . showQuickPick ( models , {
604- placeHolder : 'Wähle ein OpenAI-Modell' ,
611+ placeHolder : 'Wähle ein OpenAI-Modell oder gebe manuell ein ' ,
605612 title : 'OpenAI-Modell auswählen'
606613 } ) ;
607614
608615 if ( selection ) {
616+ let modelName = selection . value ;
609617 const openaiConfig = { ...settings . get ( 'openai' ) } ;
610618
619+ // Wenn manuelle Eingabe gewählt wurde
620+ if ( modelName === '__manual__' ) {
621+ const manualInput = await vscode . window . showInputBox ( {
622+ prompt : 'OpenAI-Modellname eingeben' ,
623+ placeHolder : 'z.B. gpt-4o, gpt-4o-mini, gpt-4-turbo' ,
624+ value : openaiConfig . model || '' ,
625+ validateInput : ( value ) => {
626+ if ( ! value || value . trim ( ) === '' ) {
627+ return 'Modellname darf nicht leer sein' ;
628+ }
629+ return null ;
630+ }
631+ } ) ;
632+
633+ if ( manualInput ) {
634+ modelName = manualInput . trim ( ) ;
635+ } else {
636+ return ; // Benutzer hat abgebrochen
637+ }
638+ }
639+
611640 // Aktualisiere das Modell in den Einstellungen
612- openaiConfig . model = selection . value ;
641+ openaiConfig . model = modelName ;
613642 await settings . update ( 'openai' , openaiConfig ) ;
614643
615- showNotification ( `OpenAI-Modell wurde auf ${ selection . label } ( ${ selection . value } ) gesetzt.` , 'info' ) ;
644+ showNotification ( `OpenAI-Modell wurde auf ${ modelName } gesetzt.` , 'info' ) ;
616645
617646 // UI aktualisieren
618647 if ( providers ) {
@@ -675,19 +704,48 @@ function registerCommands(context, providers, statusBarItem, setupFileWatcher, d
675704 { label : 'Claude Instant' , value : 'claude-instant-1' }
676705 ] ;
677706
707+ // Option für manuelle Eingabe hinzufügen
708+ models . push ( {
709+ label : '$(edit) Manuell eingeben...' ,
710+ description : 'Modellname manuell eingeben' ,
711+ value : '__manual__'
712+ } ) ;
713+
678714 const selection = await vscode . window . showQuickPick ( models , {
679- placeHolder : 'Wähle ein Anthropic-Modell' ,
715+ placeHolder : 'Wähle ein Anthropic-Modell oder gebe manuell ein ' ,
680716 title : 'Anthropic-Modell auswählen'
681717 } ) ;
682718
683719 if ( selection ) {
720+ let modelName = selection . value ;
684721 const anthropicConfig = { ...settings . get ( 'anthropic' ) } ;
685722
723+ // Wenn manuelle Eingabe gewählt wurde
724+ if ( modelName === '__manual__' ) {
725+ const manualInput = await vscode . window . showInputBox ( {
726+ prompt : 'Anthropic-Modellname eingeben' ,
727+ placeHolder : 'z.B. claude-3-opus-20240229, claude-3-sonnet-20240229' ,
728+ value : anthropicConfig . model || '' ,
729+ validateInput : ( value ) => {
730+ if ( ! value || value . trim ( ) === '' ) {
731+ return 'Modellname darf nicht leer sein' ;
732+ }
733+ return null ;
734+ }
735+ } ) ;
736+
737+ if ( manualInput ) {
738+ modelName = manualInput . trim ( ) ;
739+ } else {
740+ return ; // Benutzer hat abgebrochen
741+ }
742+ }
743+
686744 // Aktualisiere das Modell in den Einstellungen
687- anthropicConfig . model = selection . value ;
745+ anthropicConfig . model = modelName ;
688746 await settings . update ( 'anthropic' , anthropicConfig ) ;
689747
690- showNotification ( `Anthropic-Modell wurde auf ${ selection . label } ( ${ selection . value } ) gesetzt.` , 'info' ) ;
748+ showNotification ( `Anthropic-Modell wurde auf ${ modelName } gesetzt.` , 'info' ) ;
691749
692750 // UI aktualisieren
693751 if ( providers ) {
@@ -729,18 +787,48 @@ function registerCommands(context, providers, statusBarItem, setupFileWatcher, d
729787 value : model . name
730788 } ) ) ;
731789
790+ // Option für manuelle Eingabe hinzufügen
791+ models . push ( {
792+ label : '$(edit) Manuell eingeben...' ,
793+ description : 'Modellname manuell eingeben' ,
794+ value : '__manual__'
795+ } ) ;
796+
732797 // Benutzer ein Modell auswählen lassen
733798 const selection = await vscode . window . showQuickPick ( models , {
734- placeHolder : 'Wähle ein Ollama-Modell' ,
799+ placeHolder : 'Wähle ein Ollama-Modell oder gebe manuell ein ' ,
735800 title : 'Ollama-Modell auswählen'
736801 } ) ;
737802
738803 if ( selection ) {
804+ let modelName = selection . value ;
805+
806+ // Wenn manuelle Eingabe gewählt wurde
807+ if ( modelName === '__manual__' ) {
808+ const manualInput = await vscode . window . showInputBox ( {
809+ prompt : 'Ollama-Modellname eingeben' ,
810+ placeHolder : 'z.B. llama2, codellama, mistral, granite3.3:2b' ,
811+ value : ollamaConfig . model || '' ,
812+ validateInput : ( value ) => {
813+ if ( ! value || value . trim ( ) === '' ) {
814+ return 'Modellname darf nicht leer sein' ;
815+ }
816+ return null ;
817+ }
818+ } ) ;
819+
820+ if ( manualInput ) {
821+ modelName = manualInput . trim ( ) ;
822+ } else {
823+ return ; // Benutzer hat abgebrochen
824+ }
825+ }
826+
739827 // Aktualisiere das Modell in den Einstellungen
740- ollamaConfig . model = selection . value ;
828+ ollamaConfig . model = modelName ;
741829 await settings . update ( 'ollama' , ollamaConfig ) ;
742830
743- showNotification ( `Ollama-Modell wurde auf ${ selection . label } gesetzt.` , 'info' ) ;
831+ showNotification ( `Ollama-Modell wurde auf ${ modelName } gesetzt.` , 'info' ) ;
744832
745833 // UI aktualisieren
746834 if ( providers ) {
@@ -797,6 +885,46 @@ function registerCommands(context, providers, statusBarItem, setupFileWatcher, d
797885 } )
798886 ) ;
799887
888+ // Ollama-Endpoint bearbeiten
889+ context . subscriptions . push (
890+ vscode . commands . registerCommand ( 'comitto.editOllamaEndpoint' , async ( ) => {
891+ try {
892+ const ollamaConfig = { ...settings . get ( 'ollama' ) } ;
893+ const currentEndpoint = ollamaConfig . endpoint || 'http://localhost:11434/api/generate' ;
894+
895+ const input = await vscode . window . showInputBox ( {
896+ prompt : 'Ollama-Endpoint eingeben' ,
897+ placeHolder : 'http://localhost:11434/api/generate' ,
898+ value : currentEndpoint ,
899+ validateInput : ( value ) => {
900+ if ( ! value || value . trim ( ) === '' ) {
901+ return 'Endpoint darf nicht leer sein' ;
902+ }
903+ try {
904+ new URL ( value ) ;
905+ return null ;
906+ } catch ( e ) {
907+ return 'Ungültige URL' ;
908+ }
909+ }
910+ } ) ;
911+
912+ if ( input !== undefined && input !== currentEndpoint ) {
913+ ollamaConfig . endpoint = input . trim ( ) ;
914+ await settings . update ( 'ollama' , ollamaConfig ) ;
915+ showNotification ( `Ollama-Endpoint wurde auf ${ input . trim ( ) } gesetzt.` , 'info' ) ;
916+
917+ // UI aktualisieren
918+ if ( providers ) {
919+ providers . settingsProvider . refresh ( ) ;
920+ }
921+ }
922+ } catch ( error ) {
923+ handleError ( error , "Fehler beim Bearbeiten des Ollama-Endpoints" , true ) ;
924+ }
925+ } )
926+ ) ;
927+
800928 // Und auch einen Befehl für Anthropic, da dieser ebenfalls in der UI referenziert wird
801929 context . subscriptions . push (
802930 vscode . commands . registerCommand ( 'comitto.editAnthropicKey' , async ( ) => {
0 commit comments