* feat(deps): update openai
closes#269closes#270
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: err handling
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* feat: support json
Introduce a new flag, `--format-as`.
It defaults to `markdown`, and is only used when `--format` is also
specified.
`--format-as=json` will only set the response type to json in supported models, otherwise it'll only add the format text to the prompt.
Also updated the openai library to support this.
Added to the default configuration both `gpt-4-1106-preview` and
`gpt-3.5-turbo-1106`.
Theses are the only models that support the JSON response format.
`format-text` is now a `map[string]string`. Old configs (which have it
as a string) will set the specified formatting text to the `markdown`
format automatically.
Newly generated configs will have both `markdown` and `json` format
texts.
---
closes#167closes#173
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: lint issues
* feat: reuse constants
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: render final result
* chore: comment
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: do not need custom bubbletea
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* refactor: use cobra for flags
- Use Cobra
- Clean up
- Refactor
* fix: db path
* feat: completions
* chore: cleanup
* chore: cleanup
* fix: tests
* test: db.Completions
* fix: improvements
* fix: config
* test: fix broken test
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: env, gitignore
* fix: no need to wrap in an error
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: mods with no args
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: --list should print list to stdout (#113)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: improve error handling (#114)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: styles & stderr
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: version
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: remove unused examples
* fix: hide completion and help commands
* fix: error handling
- Fix modsError
- Error when continuing without a prompt
* fix: mark flags as mutually exclusive
* fix: create cache directory
* fix: improve completions
* fix: improve completions
* fix: use errors.As
* fix: improve styles
* fix: improve config creation and its error handling
* fix: mkdir cache
* fix: ensure error's reasons ends with .
* perf: indices
* test: fix broken test, add no prompt continue test
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* chore: fmt queries
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* feat: improve --continue and auto-save
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: load from one file, save to another
* fix: last line of output being eaten
* feat: --show
Reimplemented #92 using over this branch as it had too many conflicts.
closes#92
* fix: mods with no args, mods --delete
* fix: continue should not save empty filename
* feat: --list show the beginning of the last prompt
* fix: do not write on show
* feat: use a sqlite db
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: no cgo
* fix: first line of the prompt only
* refactor: open db
* fix: --continue duplicating creating a new id
* refactor: improve cache code
* fix: crypto/rand instead of math's
* fix: close db on exit
* fix: style
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* test: added db_test.go
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* test: add cache_test.go
* test: add messages_test.go
* fix: use goreleaser-mods.yaml
* fix: line breaks
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* refactor: improvements
* fix: wrong import
* chore: missplaced commend
* refactor: improving main.go
* fix: auto-glamour
* fix: extra empty line
* test: cacheops
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* test: windows
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: stream output to stdout if ouput is not a terminal
also lazily cached the isatty and isaterm checks, using sync.OnceValue.
PS: this will disable the loading indicator when the output is not a
term.
* fix: std db name
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* wip: render
* fix: first char and last line
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: rename
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: donestate
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: dep
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: quiet
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: saving without a message
* fix: simplify stdout check
* docs: adding a document specifying how mods should behave in each case
This should help us test it and also clarifies the expectations to the
users.
Very WIP.
* refactor: rename func
* docs: update
* fix: trim spaces
not sure if this looks better or worse tbh)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* test: skip on windows
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: improve db
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* chore: typo
* test: reenable on windows
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>