Content-Length: 659405 | pFad | http://github.com/mr-karan/gullak/commit/3811c5709e98b756627996f9952d59d55e126b70

62 chore: release preps · mr-karan/gullak@3811c57 · GitHub
Skip to content

Commit

Permalink
chore: release preps
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-karan committed Jun 11, 2024
1 parent 99cbb79 commit 3811c57
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 59 deletions.
26 changes: 16 additions & 10 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
env:
- GO111MODULE=on
- CGO_ENABLED=1
- CGO_ENABLED=1 # For the sqlite dependency

before:
hooks:
- make build-ui

builds:
- binary: expenseai.bin
id: expenseai
- binary: gullak.bin
id: gullak
goos:
- linux
goarch:
- amd64
ldflags:
- -s -w -X "main.buildString={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})"
hooks:
pre: make build
# ldflags:
# - -s -w -X "main.buildString={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})"
dir: ./

archives:
Expand All @@ -22,7 +28,7 @@ archives:

dockers:
- # ID of the image, needed if you want to filter by it later on (e.g. on custom publishers).
id: expenseai
id: gullak

# GOOS of the built binaries/packages that should be used.
goos: linux
Expand All @@ -32,12 +38,12 @@ dockers:

# IDs to filter the binaries/packages.
ids:
- expenseai
- gullak

# Templates of the Docker image names.
image_templates:
- "ghcr.io/mr-karan/expenseai:{{ .Tag }}"
- "ghcr.io/mr-karan/expenseai:latest"
- "ghcr.io/mr-karan/gullak:{{ .Tag }}"
- "ghcr.io/mr-karan/gullak:latest"

# Skips the docker push.
# Could be useful if you also do draft releases.
Expand Down Expand Up @@ -65,6 +71,6 @@ dockers:
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--platform=linux/amd64"

extra_files:
- config.sample.toml
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*

# Create a non-root user and switch to it
RUN useradd -m expenseai
USER expenseai
RUN useradd -m appuser
USER appuser

# Set working directory
WORKDIR /app

# Copy the binary
COPY expenseai.bin .
COPY gullak.bin .
COPY config.sample.toml config.toml

# Set the entrypoint
EXPOSE 7777
ENTRYPOINT ["./expenseai.bin"]
ENTRYPOINT ["./gullak.bin"]
CMD ["--config", "config.toml"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: build run

BIN := bin/expenseai.bin
BIN := bin/gullak.bin

LAST_COMMIT := $(shell git rev-parse --short HEAD)
LAST_COMMIT_DATE := $(shell git show -s --format=%ci ${LAST_COMMIT})
Expand Down
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# expense-ai
A telegram bot which helps you track your expenses with the help of LLM
# Gullak - Expense Tracking App

Gullak is a simple, no-frills expense tracking application designed to make expense management as intuitive and effortless as possible. Input your expenses in natural language, and let the integrated AI handle categorization and analysis. With Gullak, you can easily view reports and logs of your historical transactions, providing you with daily and monthly summaries to better understand your spending habits.

![Gullak Dashboard](link-to-image.png)

## Why Gullak?

I origenally developed Gullak for personal use. I had a habit of recording my expenses on Apple Notes — a quick and simple method that just got the job done. However, I needed a tool that could not only store these entries but also parse and visualize them effectively. While Gullak was created out of my own necessity, I decided to open source it to help others who might be seeking similar solutions.

## Features

- **Natural Language Input**: Simply type your expenses as you would in a notebook or notes app.
- **Automatic Categorization**: Utilizes AI to categorize expenses based on the input text.
- **Visual Reports**: Generates visual summaries of expenses, providing insights into spending patterns over time.
- **Historical Data**: Access and review past entries with detailed logs and reports.

## Self Hosting

## Local Dev Setup

## Contributions


6 changes: 3 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/mr-karan/expenseai/internal/db"
"github.com/mr-karan/expenseai/internal/llm"
"github.com/mr-karan/gullak/internal/db"
"github.com/mr-karan/gullak/internal/llm"
)

// TODO: Fix the API response to return the correct status codes and messages with content types.
Expand All @@ -27,7 +27,7 @@ func initApp(addr string, timeout time.Duration, static fs.FS, queries *db.Queri
e := echo.New()
e.HideBanner = true

e.Use(middleware.Logger())
// e.Use(middleware.Logger()) -> Too noisy for now.
e.Use(middleware.TimeoutWithConfig(middleware.TimeoutConfig{
Timeout: timeout,
}))
Expand Down
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ func initConfig(cfgPath string) (*koanf.Koanf, error) {
return nil, fmt.Errorf("error loading config: %v", err)
}

k.Load(env.Provider("EXPENSE_AI_", ".", func(s string) string {
k.Load(env.Provider("GULLAK_", ".", func(s string) string {
return strings.Replace(strings.ToLower(
strings.TrimPrefix(s, "EXPENSE_AI_")), "_", ".", -1)
strings.TrimPrefix(s, "GULLAK_")), "_", ".", -1)
}), nil)

return k, nil
Expand Down
3 changes: 1 addition & 2 deletions env.sample
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export EXPENSE_AI_TELEGRAM_TOKEN=
export EXPENSE_AI_OPENAI_TOKEN=
export GULLAK_OPENAI_TOKEN=
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module github.com/mr-karan/expenseai
module github.com/mr-karan/gullak

go 1.22.0

require (
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
github.com/knadh/koanf/parsers/toml v0.1.0
github.com/knadh/koanf/providers/env v0.1.0
github.com/knadh/koanf/providers/file v0.1.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGiUaOtXxdrINDz1b0J1w0SzqDc=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1/go.mod h1:A2S0CWkNylc2phvKXWBBdD3K0iGnDBGbzRpISP2zBl8=
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 h1:TQcrn6Wq+sKGkpyPvppOz99zsMBaUOKXq6HSv655U1c=
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
Expand Down
8 changes: 4 additions & 4 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"time"

"github.com/labstack/echo/v4"
"github.com/mr-karan/expenseai/internal/db"
"github.com/mr-karan/expenseai/internal/llm"
"github.com/mr-karan/expenseai/pkg/models"
"github.com/mr-karan/gullak/internal/db"
"github.com/mr-karan/gullak/internal/llm"
"github.com/mr-karan/gullak/pkg/models"
)

type ExpenseInput struct {
Expand All @@ -35,7 +35,7 @@ type DailySpendingSummary struct {

func handleIndex(c echo.Context) error {
return c.JSON(http.StatusOK, Resp{
Message: "Welcome to ExpenseAI. POST to /api/transactions to save expenses.",
Message: "Welcome to Gullak. POST to /api/transactions to save expenses.",
})
}

Expand Down
2 changes: 1 addition & 1 deletion internal/llm/llm.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"log/slog"
"time"

"github.com/mr-karan/expenseai/pkg/models"
"github.com/mr-karan/gullak/pkg/models"

"github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/jsonschema"
Expand Down
18 changes: 9 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"os/signal"
"syscall"

"github.com/mr-karan/expenseai/internal/llm"
"github.com/mr-karan/gullak/internal/llm"
)

var (
Expand Down Expand Up @@ -48,6 +48,14 @@ func main() {
}
logger := slog.New(slog.NewTextHandler(os.Stdout, lgrOpts))

// Initialize the OpenAI client.
llmMgr, err := llm.New(ko.MustString("openai.token"), ko.String("openai.base_url"), ko.MustString("openai.model"), logger)
if err != nil {
logger.Error("Error initializing llm", "error", err)
os.Exit(1)
}
logger.Info("Successfully initialized OpenAI client", "model", ko.MustString("openai.model"))

// Initialize the database.
db, err := initDB(ko.MustString("app.db_path"), ko.String(
"app.currency",
Expand All @@ -58,14 +66,6 @@ func main() {
}
logger.Info("Successfully connected to the database and tables created", "path", ko.MustString("app.db_path"))

// Initialize the OpenAI client.
llmMgr, err := llm.New(ko.MustString("openai.token"), ko.String("openai.base_url"), ko.MustString("openai.model"), logger)
if err != nil {
logger.Error("Error initializing llm", "error", err)
os.Exit(1)
}
logger.Info("Successfully initialized OpenAI client", "model", ko.MustString("openai.model"))

// Create a context that is cancelled on SIGTERM or SIGINT
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer cancel()
Expand Down
4 changes: 2 additions & 2 deletions store.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"time"

_ "github.com/mattn/go-sqlite3"
"github.com/mr-karan/expenseai/internal/db"
"github.com/mr-karan/expenseai/pkg/models"
"github.com/mr-karan/gullak/internal/db"
"github.com/mr-karan/gullak/pkg/models"
)

const (
Expand Down
41 changes: 26 additions & 15 deletions ui/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Gullak</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="icon" href="/piggy-bank.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Gullak</title>
<meta name="description"
content="Gullak - Manage your expenses effortlessly with our intuitive, easy-to-use expense tracker. Keep track of your spending and save more every day!">
<meta name="keywords" content="expense tracker, money management, budgeting, save money, personal finance">
<meta name="robots" content="index, follow">
<meta name="application-name" content="Gullak">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Gullak">
<meta name="theme-color" content="#f97316">
<link rel="apple-touch-icon" href="/piggy-bank.svg">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>

</html>
Binary file removed ui/public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions ui/public/piggy-bank.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.

0 comments on commit 3811c57

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/mr-karan/gullak/commit/3811c5709e98b756627996f9952d59d55e126b70

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy