mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-19 03:06:45 +02:00
* Add ability to configure custom OpenAI API endpoint for #186 * Ensure the AiCompletionEndpoint field is always initialized
This commit is contained in:
@@ -217,6 +217,18 @@ func validateColor(color string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var setAiCompletionEndpoint = &cobra.Command{
|
||||
Use: "ai-completion-endpoint",
|
||||
Short: "The AI endpoint to use for AI completions",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
ctx := hctx.MakeContext()
|
||||
config := hctx.GetConf(ctx)
|
||||
config.AiCompletionEndpoint = args[0]
|
||||
lib.CheckFatalError(hctx.SetConfig(config))
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(configSetCmd)
|
||||
configSetCmd.AddCommand(setEnableControlRCmd)
|
||||
@@ -229,6 +241,7 @@ func init() {
|
||||
configSetCmd.AddCommand(setPresavingCmd)
|
||||
configSetCmd.AddCommand(setColorSchemeCmd)
|
||||
configSetCmd.AddCommand(setDefaultFilterCommand)
|
||||
configSetCmd.AddCommand(setAiCompletionEndpoint)
|
||||
setColorSchemeCmd.AddCommand(setColorSchemeSelectedText)
|
||||
setColorSchemeCmd.AddCommand(setColorSchemeSelectedBackground)
|
||||
setColorSchemeCmd.AddCommand(setColorSchemeBorderColor)
|
||||
|
Reference in New Issue
Block a user