Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
allow for starting llava queries with filepath (#1549)
Bruce MacDonaldfabf2f346786
diff --git a/cmd/cmd.go b/cmd/cmd.goindex b0ba416b6..d5d28c0a2 100644--- a/cmd/cmd.go+++ b/cmd/cmd.go@@ -928,8 +928,23 @@ func generateInteractive(cmd *cobra.Command, opts generateOptions) error {return nilcase strings.HasPrefix(line, "/"):args := strings.Fields(line)- fmt.Printf("Unknown command '%s'. Type /? for help\n", args[0])- continue+ isFile := false++ if multiModal {+ for _, f := range extractFileNames(line) {+ if strings.HasPrefix(f, args[0]) {+ isFile = true+ break+ }+ }+ }++ if isFile {+ prompt += line+ } else {+ fmt.Printf("Unknown command '%s'. Type /? for help\n", args[0])+ continue+ }default:prompt += line}@@ -937,7 +952,7 @@ func generateInteractive(cmd *cobra.Command, opts generateOptions) error {if len(prompt) > 0 && multiline == MultilineNone {opts.Prompt = promptif multiModal {- newPrompt, images, err := extractFileNames(prompt)+ newPrompt, images, err := extractFileData(prompt)if err != nil {return err}@@ -991,13 +1006,17 @@ func normalizeFilePath(fp string) string {return fp}-func extractFileNames(input string) (string, []ImageData, error) {+func extractFileNames(input string) []string {// Regex to match file paths starting with / or ./ and include escaped spaces (\ or %20)// and followed by more characters and a file extensionregexPattern := `(?:\./|/)[\S\\ ]+?\.(?i:jpg|jpeg|png|svg)\b`re := regexp.MustCompile(regexPattern)- filePaths := re.FindAllString(input, -1)+ return re.FindAllString(input, -1)+}++func extractFileData(input string) (string, []ImageData, error) {+ filePaths := extractFileNames(input)var imgs []ImageDatafor _, fp := range filePaths {