Skip to content

Commit

Permalink
chore: 🤷
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Nov 7, 2024
1 parent 1443dce commit 0b6fa2e
Show file tree
Hide file tree
Showing 10 changed files with 463 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/vhs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
go-version: "stable"
- name: Build
run: |
sudo go build -o /usr/local/bin/TEMPLATE main.go
sudo go build -o /usr/local/bin/what-dis main.go
- uses: charmbracelet/vhs-action@v2
with:
path: 'vhs.tape'
Expand Down
4 changes: 2 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ before:

builds:
- id: default
binary: TEMPLATE
binary: what-dis
env:
- CGO_ENABLED=0
goos:
Expand Down Expand Up @@ -80,7 +80,7 @@ changelog:
release:
footer: |
### Summary
**Full Changelog**: https://github.com/blacktop/TEMPLATE/compare/{{ .PreviousTag }}...{{ .Tag }}
**Full Changelog**: https://github.com/blacktop/what-dis/compare/{{ .PreviousTag }}...{{ .Tag }}
## What to do next?
- Follow us on [Twitter](https://twitter.com/blacktop__)
- Follow us on [Mastodon](https://mastodon.social/@blacktop)
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "0.2.0",
"configurations": [
{
"name": "Attach to TEMPLATE",
"name": "Attach to what-dis",
"type": "go",
"debugAdapter": "dlv-dap",
"request": "attach",
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ bump:
.PHONY: build
build:
@echo "🚀 Building Version $(shell svu current)"
go build -o TEMPLATE main.go
go build -o what-dis main.go

.PHONY: release
release:
@echo "🚀 Releasing Version $(shell svu current)"
goreleaser build --id default --clean --snapshot --single-target --output dist/TEMPLATE
goreleaser build --id default --clean --snapshot --single-target --output dist/what-dis
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<p align="center">
<a href="https://github.com/blacktop/TEMPLATE"><img alt="TEMPLATE Logo" src="https://raw.githubusercontent.com/blacktop/go-template/main/docs/logo.webp" /></a>
<h1 align="center">go-template</h1>
<h4><p align="center">Go Project Template</p></h4>
<a href="https://github.com/blacktop/what-dis"><img alt="what-dis Logo" src="https://raw.githubusercontent.com/blacktop/what-dis/main/docs/logo.webp" /></a>
<h1 align="center">what-dis</h1>
<h4><p align="center">Dumb image-to-text experiment</p></h4>
<p align="center">
<a href="https://github.com/blacktop/TEMPLATE/actions" alt="Actions">
<img src="https://github.com/blacktop/TEMPLATE/actions/workflows/go.yml/badge.svg" /></a>
<a href="https://github.com/blacktop/TEMPLATE/releases/latest" alt="Downloads">
<img src="https://img.shields.io/github/downloads/blacktop/TEMPLATE/total.svg" /></a>
<a href="https://github.com/blacktop/TEMPLATE/releases" alt="GitHub Release">
<img src="https://img.shields.io/github/release/blacktop/TEMPLATE.svg" /></a>
<a href="https://github.com/blacktop/what-dis/actions" alt="Actions">
<img src="https://github.com/blacktop/what-dis/actions/workflows/go.yml/badge.svg" /></a>
<a href="https://github.com/blacktop/what-dis/releases/latest" alt="Downloads">
<img src="https://img.shields.io/github/downloads/blacktop/what-dis/total.svg" /></a>
<a href="https://github.com/blacktop/what-dis/releases" alt="GitHub Release">
<img src="https://img.shields.io/github/release/blacktop/what-dis.svg" /></a>
<a href="http://doge.mit-license.org" alt="LICENSE">
<img src="https://img.shields.io/:license-mit-blue.svg" /></a>
</p>
<br>

## Why? 🤔

<!-- Fill this out -->
🤷

## Getting Started

### Install

```bash
go install github.com/blacktop/go-template@latest
go install github.com/blacktop/what-dis@latest
```

<!-- Fill this out -->
Expand All @@ -32,4 +32,4 @@ go install github.com/blacktop/go-template@latest

## License

MIT Copyright (c) <YEAR> **blacktop**
MIT Copyright (c) 2024 **blacktop**
71 changes: 49 additions & 22 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,63 @@ THE SOFTWARE.
package cmd

import (
"context"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"strings"

"github.com/ollama/ollama/api"
"github.com/spf13/cobra"
)



// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "go-template",
Short: "A brief description of your application",
Long: `A longer description that spans multiple lines and likely contains
examples and usage of using your application. For example:
Use: "what-dis <IMAGE>",
Short: "Describe an image",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
data, err := os.ReadFile(filepath.Clean(args[0]))
if err != nil {
log.Fatal(err)
}

cli, err := api.ClientFromEnvironment()
if err != nil {
log.Fatal(err)
}

messages := []api.Message{
{
Role: "system",
Content: "Provide very brief, concise responses",
},
{
Role: "user",
Content: "What is in this image?",
},
{
Images: []api.ImageData{data},
},
}

Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
if err := cli.Chat(context.Background(), &api.ChatRequest{
Model: "llama3.2-vision",
Messages: messages,
Stream: new(bool),
}, func(cr api.ChatResponse) error {
cmd := exec.Command("/usr/bin/say", "--rate=200")
cmd.Stdin = strings.NewReader(cr.Message.Content)
if err := cmd.Run(); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
}
return nil
}); err != nil {
log.Fatal(err)
}
},
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand All @@ -54,15 +91,5 @@ func Execute() {
}

func init() {
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.

// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.go-template.yaml)")

// Cobra also supports local flags, which will only run
// when this action is called directly.
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}


60 changes: 58 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,66 @@
module github.com/blacktop/go-template
module github.com/blacktop/what-dis

go 1.22.6
go 1.23

require github.com/spf13/cobra v1.8.1

require (
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
github.com/bytedance/sonic v1.11.6 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/chewxy/hm v1.0.0 // indirect
github.com/chewxy/math32 v1.10.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/d4l3k/go-bfloat16 v0.0.0-20211005043715-690c3bdd05f1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/cors v1.7.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/gin-gonic/gin v1.10.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.20.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nlpodyssey/gopickle v0.3.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/ollama/ollama v0.4.0 // indirect
github.com/pdevine/tensor v0.0.0-20240510204454-f88f4562727c // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xtgo/set v1.0.0 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/image v0.14.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gonum.org/v1/gonum v0.15.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorgonia.org/vecf32 v0.9.0 // indirect
gorgonia.org/vecf64 v0.9.0 // indirect
)
Loading

0 comments on commit 0b6fa2e

Please sign in to comment.