This commit is contained in:
parent
cd4f3b85fb
commit
f06f341d12
@ -3,11 +3,11 @@ RUN apk add --no-cache tzdata ca-certificates
|
||||
|
||||
FROM alpine:3.21
|
||||
ARG TARGETPLATFORM
|
||||
COPY bin/arch/${TARGETPLATFORM}/ai-agent-web /app/ai-agent-web
|
||||
COPY bin/arch/${TARGETPLATFORM}/ai-agent /app/ai-agent
|
||||
COPY agents /app/agents
|
||||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
||||
COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
WORKDIR /app
|
||||
EXPOSE 7120
|
||||
CMD ["/app/ai-agent-web"]
|
||||
CMD ["/app/ai-agent"]
|
||||
|
4
Makefile
4
Makefile
@ -2,8 +2,8 @@
|
||||
AGENTS_DIR = agents
|
||||
DIST_DIRECTORY = ./bin
|
||||
DIST_APPNAME = ai-agent
|
||||
DIST_EXENAME = ai-agent-web
|
||||
BUILDINFO_CLASS = codelab/ai-agent/internal/conf
|
||||
DIST_EXENAME = ai-agent
|
||||
BUILDINFO_CLASS = github.com/ltylab/ai-agent/internal/conf
|
||||
BUILDINFO_VERSION := $(shell git describe --tags 2>/dev/null || echo "git/$(shell git rev-parse --short HEAD 2>/dev/null || echo 'none')")
|
||||
CROSS_BUILD_TRIPLES = darwin/amd64 \
|
||||
darwin/arm64 \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Luo Tianyi CodeLab AI Agent
|
||||
# Luo Tianyi Codelabs AI Agent
|
||||
|
||||
提供类似 QQ 界面的公共 AI 聊天机器人,基于 Google Gemini 模型。
|
||||
|
||||
@ -22,14 +22,14 @@ export GOOGLE_AI_KEY=your-key
|
||||
您也可以使用 Docker 运行:
|
||||
```bash
|
||||
docker run -d -p 57120:7120 -e GOOGLE_AI_KEY=your-key \
|
||||
--name ai-agent-web ghcr.io/ltylab/codelab-ai-agent
|
||||
--name ai-agent-web ghcr.io/github.com/ltylab/ai-agent
|
||||
```
|
||||
|
||||
如果需要自定义 AI Agent,请将您的 AI Agent 配置文件映射到 `/app/agents` 目录:
|
||||
```bash
|
||||
docker run -d -p 57120:7120 -e GOOGLE_AI_KEY=your-key \
|
||||
-v /path/to/your/agents:/app/agents \
|
||||
--name ai-agent-web ghcr.io/ltylab/codelab-ai-agent
|
||||
--name ai-agent-web ghcr.io/github.com/ltylab/ai-agent
|
||||
```
|
||||
|
||||
可以通过 `-model` 参数修改模型,推荐使用下面两个免费模型:
|
||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
||||
module codelab/ai-agent
|
||||
module github.com/ltylab/ai-agent
|
||||
|
||||
go 1.23.3
|
||||
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
"path"
|
||||
"regexp"
|
||||
|
||||
"codelab/ai-agent/internal/conf"
|
||||
"codelab/ai-agent/internal/log"
|
||||
"codelab/ai-agent/web/assets"
|
||||
"github.com/ltylab/ai-agent/internal/conf"
|
||||
"github.com/ltylab/ai-agent/internal/log"
|
||||
"github.com/ltylab/ai-agent/web/assets"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ var (
|
||||
BuildTime = "<unknown>"
|
||||
BuildMode = "development"
|
||||
PackageLicense = "Unlicense"
|
||||
PackageCopyright = "This is an unlicensed software (under public domain) by Luo's CodeLabs <lty.name>."
|
||||
PackageCopyright = "This is an unlicensed software (under public domain) by Luo Tianyi Codelabs <https://lty.name/>."
|
||||
|
||||
DefaultListen = ":7120"
|
||||
DefaultAgentsDir = "agents"
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"codelab/ai-agent/internal/agent"
|
||||
"codelab/ai-agent/internal/log"
|
||||
"github.com/ltylab/ai-agent/internal/agent"
|
||||
"github.com/ltylab/ai-agent/internal/log"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/generative-ai-go/genai"
|
||||
|
@ -6,10 +6,10 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"codelab/ai-agent/internal/agent"
|
||||
"codelab/ai-agent/internal/log"
|
||||
"codelab/ai-agent/web"
|
||||
"codelab/ai-agent/web/assets"
|
||||
"github.com/ltylab/ai-agent/internal/agent"
|
||||
"github.com/ltylab/ai-agent/internal/log"
|
||||
"github.com/ltylab/ai-agent/web"
|
||||
"github.com/ltylab/ai-agent/web/assets"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
6
main.go
6
main.go
@ -4,9 +4,9 @@ import (
|
||||
"flag"
|
||||
"os"
|
||||
|
||||
"codelab/ai-agent/internal/conf"
|
||||
"codelab/ai-agent/internal/log"
|
||||
"codelab/ai-agent/internal/server"
|
||||
"github.com/ltylab/ai-agent/internal/conf"
|
||||
"github.com/ltylab/ai-agent/internal/log"
|
||||
"github.com/ltylab/ai-agent/internal/server"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user