Commit graph

58 commits

Author SHA1 Message Date
Carlos Alexandro Becker 9ac0968336
feat(deps): update bubbletea, bubbles, lipgloss (#271)
* feat(deps): update bubbletea, bubbles, lipgloss

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: bubbletea update

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-05-24 11:16:06 -03:00
Christian Rocha dd0cb49ec8
chore(deps): bump Bubble Tea to v0.26.0 (#253) 2024-05-02 15:16:50 -03:00
Carlos Alexandro Becker 917260a811
feat: render list inside a viewport (#228) 2024-04-02 20:36:29 -03:00
Carlos Alexandro Becker 297b0ef653
fix: update log dep
refs https://github.com/charmbracelet/log/pull/111

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-03-04 15:46:32 -03:00
Maas Lalani b5ed18714e
chore: bump huh to latest main (#196) 2024-01-18 23:31:04 -03:00
Christian Rocha 4dd35921ae
chore: pin huh to main (#195) 2024-01-18 16:23:35 -03:00
Maas Lalani 2d255a30ac Pin huh to fix keymap-modifier 2024-01-18 10:58:24 -05:00
Carlos Alexandro Becker 4294c4fa48
fix: use hidden group
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-01-17 16:38:11 -03:00
Carlos Alexandro Becker e085c99aef
feat: support json (#188)
* 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 #167
closes #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>
2024-01-11 23:06:26 -03:00
Carlos Alexandro Becker 5993b71794 fix: improve --help
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-01-09 09:05:51 -03:00
Carlos Alexandro Becker fa1969740f feat: --delete-older-than 2024-01-09 09:05:51 -03:00
Carlos Alexandro Becker 57dca355a0
feat(deps): bump github.com/sashabaranov/go-openai from 1.15.3 to 1.16.0
closes #145

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-11-16 16:31:06 -03:00
Carlos Alexandro Becker 06cebfe926
feat: reduce binary size (#158)
* feat: reduce binary size

closes #118

* fix: args
2023-11-16 15:01:55 -03:00
dependabot[bot] 63d7d91404
feat(deps): bump modernc.org/sqlite from 1.25.0 to 1.26.0 (#139) 2023-10-23 12:40:47 +00:00
dependabot[bot] eb083de727
feat(deps): bump golang.org/x/term from 0.12.0 to 0.13.0 (#142) 2023-10-23 12:40:35 +00:00
Carlos Alexandro Becker 2121516e69
refactor: use ordered.First (#143)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-10-16 23:21:08 -03:00
dependabot[bot] 11b577bfd6
feat(deps): bump github.com/charmbracelet/lipgloss from 0.8.0 to 0.9.1 (#146) 2023-10-13 12:32:56 +00:00
Christian Rocha 97e126d90b chore: wordwrap conversation listing output 2023-09-21 11:05:09 -04:00
dependabot[bot] 69eb92d47e
feat(deps): bump github.com/caarlos0/timea.go from 1.1.0 to 1.2.0 (#131) 2023-09-13 13:25:47 +00:00
dependabot[bot] ee2baf0436
feat(deps): bump github.com/sashabaranov/go-openai from 1.15.2 to 1.15.3 (#129) 2023-09-12 12:38:20 +00:00
Carlos Alexandro Becker f13587ef2f
feat(deps): update timea.go
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-12 01:09:03 +00:00
Carlos Alexandro Becker c78c4b8677
feat: list shows time since (#128)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-11 22:02:43 -03:00
dependabot[bot] 5a820cfa5d
feat(deps): bump github.com/sashabaranov/go-openai from 1.15.1 to 1.15.2 (#126)
Bumps [github.com/sashabaranov/go-openai](https://github.com/sashabaranov/go-openai) from 1.15.1 to 1.15.2.
- [Release notes](https://github.com/sashabaranov/go-openai/releases)
- [Commits](https://github.com/sashabaranov/go-openai/compare/v1.15.1...v1.15.2)

---
updated-dependencies:
- dependency-name: github.com/sashabaranov/go-openai
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 21:35:27 -03:00
Carlos Alexandro Becker cb20d2010e
fix: render final result (#124)
* 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>
2023-09-07 10:15:41 -03:00
dependabot[bot] 709cab0de4
feat(deps): bump github.com/sashabaranov/go-openai from 1.14.2 to 1.15.1 (#115) 2023-09-01 12:04:24 +00:00
dependabot[bot] c0b2e6a928
feat(deps): bump github.com/spf13/cobra from 1.6.1 to 1.7.0 (#116) 2023-09-01 11:51:02 +00:00
Ayman Bagabas 17a19d4485
feat: cobra, shell completions, perf and ui improvements (#112)
* 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>
2023-08-31 22:42:49 -03:00
dependabot[bot] 9f5979b135
feat(deps): bump github.com/charmbracelet/lipgloss from 0.7.1 to 0.8.0 (#108) 2023-08-23 12:44:42 +00:00
dependabot[bot] eb2b5fe1bb
feat(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.4 (#102)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.1 to 1.8.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.1...v1.8.4)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-16 10:10:02 -03:00
dependabot[bot] 4f17fb0795
feat(deps): bump github.com/sashabaranov/go-openai from 1.14.1 to 1.14.2 (#103)
Bumps [github.com/sashabaranov/go-openai](https://github.com/sashabaranov/go-openai) from 1.14.1 to 1.14.2.
- [Release notes](https://github.com/sashabaranov/go-openai/releases)
- [Commits](https://github.com/sashabaranov/go-openai/compare/v1.14.1...v1.14.2)

---
updated-dependencies:
- dependency-name: github.com/sashabaranov/go-openai
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-16 10:09:40 -03:00
Carlos Alexandro Becker 4d10417748
feat: improve --continue, --show, auto-save, and added a db (#95)
* 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>
2023-08-11 14:21:11 -03:00
Carlos Alexandro Becker b052425646
feat: auto --glamour if tty (#93)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-08-03 13:38:47 -03:00
Toby Padilla 79e6dbcd16 feat: stream response, -g to render with glamour
Co-authored-by: Christian Rocha <christian@rocha.is>
2023-07-31 14:41:19 -04:00
Christian Rocha 59944a3708 feat(deps): upgrade to Go 1.20 2023-07-31 14:41:19 -04:00
dependabot[bot] a149b14bcd feat(deps): bump github.com/muesli/termenv
Bumps [github.com/muesli/termenv](https://github.com/muesli/termenv) from 0.15.2-0.20230414211128-452975b1f758 to 0.15.2.
- [Release notes](https://github.com/muesli/termenv/releases)
- [Commits](https://github.com/muesli/termenv/commits/v0.15.2)

---
updated-dependencies:
- dependency-name: github.com/muesli/termenv
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-28 09:36:24 -05:00
dependabot[bot] b1b334a593 feat(deps): bump github.com/sashabaranov/go-openai from 1.11.3 to 1.12.0
Bumps [github.com/sashabaranov/go-openai](https://github.com/sashabaranov/go-openai) from 1.11.3 to 1.12.0.
- [Release notes](https://github.com/sashabaranov/go-openai/releases)
- [Commits](https://github.com/sashabaranov/go-openai/compare/v1.11.3...v1.12.0)

---
updated-dependencies:
- dependency-name: github.com/sashabaranov/go-openai
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-26 14:21:35 -05:00
Toby Padilla 1a4290533e chore: bump deps 2023-06-22 17:24:16 -05:00
dependabot[bot] e25b6d5677
feat(deps): bump github.com/sashabaranov/go-openai from 1.10.1 to 1.11.2
Bumps [github.com/sashabaranov/go-openai](https://github.com/sashabaranov/go-openai) from 1.10.1 to 1.11.2.
- [Release notes](https://github.com/sashabaranov/go-openai/releases)
- [Commits](https://github.com/sashabaranov/go-openai/compare/v1.10.1...v1.11.2)

---
updated-dependencies:
- dependency-name: github.com/sashabaranov/go-openai
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 08:07:52 +00:00
Toby Padilla 3fa9422225 chore: bump deps 2023-06-08 11:20:51 -05:00
Toby Padilla cc0789110d chore: deps update 2023-06-05 15:12:23 -05:00
Christian Rocha 89f70313aa feat: use XDG_CONFIG_HOME as config path if set 2023-05-25 07:56:06 -05:00
Toby Padilla 164133a433 chore: update deps 2023-05-25 07:56:06 -05:00
Toby Padilla aa6e574b61 feat: edit settings with -s flag 2023-05-25 07:56:06 -05:00
Toby Padilla 8c93788f5a feat: add config file 2023-05-25 07:56:06 -05:00
Toby Padilla 6ad938f73c chore: bump deps 2023-05-22 09:39:23 -05:00
Christian Rocha e61a33a236 feat: configure via the environment
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-05-09 09:44:44 -05:00
Toby Padilla 32d75ab1cb chore: bump deps 2023-05-02 14:02:32 -05:00
Christian Rocha 7050bc3f2b feat(spinner): animate periods of ellipsis in simple spinner 2023-04-26 10:25:12 -05:00
Christian Rocha 0340162ffe chore: go mod tidy 2023-04-24 13:46:20 -05:00
Ayman Bagabas 8357b6c7b1 feat: cache colors 2023-04-19 15:44:00 -05:00