Compare commits
2 Commits
211f9dd876
...
c30a9f3f3e
| Author | SHA1 | Date | |
|---|---|---|---|
| c30a9f3f3e | |||
| 85529fab67 |
@@ -1,5 +1,5 @@
|
||||
# --- Stage 1: Build the Go application ---
|
||||
FROM golang:1.23 AS builder
|
||||
FROM golang:1.24 AS builder
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOOS=linux
|
||||
|
||||
6
Makefile
6
Makefile
@@ -14,7 +14,7 @@ migrate-down:
|
||||
goose -dir=./src/migrations/ postgres "postgresql://$(DB_USER):$(DB_PASS)@$(DB_HOST):$(DB_PORT)/$(DB_NAME)" down
|
||||
|
||||
docker-push: docker-build
|
||||
docker push git.kohout-dev.de/crowsnest/crowsnest:latest
|
||||
docker push g.eliaskohout.de/eliaskohout/crowsnest:latest
|
||||
|
||||
docker-run: docker-build
|
||||
docker run \
|
||||
@@ -24,7 +24,7 @@ docker-run: docker-build
|
||||
--env DB_USER=$(DB_USER) \
|
||||
--env DB_PASS=$(DB_PASS) \
|
||||
--env OPENAI_API_KEY=$(OPENAI_API_KEY) \
|
||||
--rm -p 8080:8080 git.kohout-dev.de/crowsnest/crowsnest:latest
|
||||
--rm -p 8080:8080 g.eliaskohout.de/eliaskohout/crowsnest:latest
|
||||
|
||||
docker-build:
|
||||
docker build --platform linux/arm64 -t git.kohout-dev.de/crowsnest/crowsnest:latest .
|
||||
docker build --platform linux/arm64 -t g.eliaskohout.de/eliaskohout/crowsnest:latest .
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/pkoukk/tiktoken-go"
|
||||
)
|
||||
|
||||
type response struct {
|
||||
@@ -24,14 +22,14 @@ type OpenAi struct {
|
||||
}
|
||||
|
||||
func (oai *OpenAi) Summarize(text string) (string, error) {
|
||||
apiURL := "https://api.openai.com/v1/chat/completions"
|
||||
apiURL := "https://openrouter.ai/api/v1/chat/completions"
|
||||
|
||||
// Request payload
|
||||
payload := map[string]interface{}{
|
||||
"model": "gpt-4o-mini",
|
||||
"model": "google/gemini-2.5-flash-lite",
|
||||
"messages": []map[string]string{
|
||||
{
|
||||
"role": "developer",
|
||||
"role": "system",
|
||||
"content": "Fasse den folgenden Zeitungsartikel in maximal 75 Wörtern zusammen. Konzentriere dich auf die wichtigsten Informationen, wie das Hauptthema, die zentralen Aussagen und relevante Hintergründe. Gib **außschließlich** die Zusammenfassung zurück.",
|
||||
},
|
||||
{
|
||||
@@ -88,16 +86,3 @@ func (oai *OpenAi) Summarize(text string) (string, error) {
|
||||
|
||||
return content, nil
|
||||
}
|
||||
|
||||
func (oai *OpenAi) CountTokens(text string) int {
|
||||
tkm, err := tiktoken.GetEncoding("o200k_base")
|
||||
if err != nil {
|
||||
err = fmt.Errorf("getEncoding: %v", err)
|
||||
return -1
|
||||
}
|
||||
|
||||
// encode
|
||||
token := tkm.Encode(text, nil, nil)
|
||||
|
||||
return len(token)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user