Compare commits
No commits in common. "master" and "feature/session" have entirely different histories.
master
...
feature/se
21
Dockerfile
21
Dockerfile
|
@ -1,21 +0,0 @@
|
|||
# 创建最终镜像,用于运行编译后的Go程序
|
||||
FROM alpine
|
||||
|
||||
RUN echo 'http://mirrors.ustc.edu.cn/alpine/v3.5/main' > /etc/apk/repositories \
|
||||
&& echo 'http://mirrors.ustc.edu.cn/alpine/v3.5/community' >>/etc/apk/repositories \
|
||||
&& apk update && apk add tzdata \
|
||||
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
&& echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 将编译好的二进制文件从构建阶段复制到运行阶段
|
||||
COPY ./ /app
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
# 设置容器启动时运行的命令
|
||||
|
||||
|
||||
CMD ["./bin/server"]
|
7
Makefile
7
Makefile
|
@ -21,10 +21,3 @@ endif
|
|||
# generate wire
|
||||
wire:
|
||||
cd ./cmd/server && wire
|
||||
|
||||
.PHONY: build
|
||||
# build
|
||||
build:
|
||||
# make config;
|
||||
make wire;
|
||||
mkdir -p bin/ && go build -ldflags "-X main.Version=$(VERSION)" -o ./bin/ ./...
|
|
@ -0,0 +1,35 @@
|
|||
server:
|
||||
port: 8090
|
||||
host: "0.0.0.0"
|
||||
|
||||
ollama:
|
||||
base_url: "http://localhost:11434"
|
||||
model: "qwen3:8b"
|
||||
timeout: 30s
|
||||
|
||||
# 模型参数
|
||||
modelParam:
|
||||
temperature: 0.7
|
||||
max_tokens: 2000
|
||||
|
||||
tools:
|
||||
weather:
|
||||
enabled: true
|
||||
calculator:
|
||||
enabled: true
|
||||
zltxOrderDetail: # 直连天下订单详情
|
||||
enabled: true
|
||||
base_url: https://gateway.dev.cdlsxd.cn
|
||||
biz_system: "zltx"
|
||||
zltxOrderLog: # 直连天下订单日志
|
||||
enabled: true
|
||||
base_url: https://gateway.dev.cdlsxd.cn
|
||||
biz_system: "zltx"
|
||||
knowledge: # 知识库
|
||||
enabled: true
|
||||
base_url: http://117.175.169.61:8080
|
||||
api_key: sk-EfnUANKMj3DUOiEPJZ5xS8SGMsbO6be_qYAg9uZ8T3zyoFM-
|
||||
|
||||
logging:
|
||||
level: "info"
|
||||
format: "json"
|
|
@ -4,20 +4,17 @@ server:
|
|||
host: "0.0.0.0"
|
||||
|
||||
ollama:
|
||||
base_url: "http://127.0.0.1:11434"
|
||||
model: "qwen3-coder:480b-cloud"
|
||||
generate_model: "qwen3-coder:480b-cloud"
|
||||
base_url: "http://localhost:11434"
|
||||
model: "qwen3:8b"
|
||||
timeout: "120s"
|
||||
level: "info"
|
||||
format: "json"
|
||||
|
||||
|
||||
|
||||
sys:
|
||||
session_len: 6
|
||||
session_len: 3
|
||||
channel_pool_len: 100
|
||||
channel_pool_size: 32
|
||||
llm_pool_len: 5
|
||||
|
||||
redis:
|
||||
host: 47.97.27.195:6379
|
||||
type: node
|
||||
|
@ -35,16 +32,19 @@ db:
|
|||
tools:
|
||||
zltxOrderDetail:
|
||||
enabled: true
|
||||
base_url: "https://revcl.1688sup.com/api/admin/direct/ai/%s"
|
||||
add_url: "https://revcl.1688sup.com/api/admin/direct/log/%s/%s"
|
||||
base_url: "https://gateway.dev.cdlsxd.cn/"
|
||||
api_key: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ1c2VyQ2VudGVyIiwiZXhwIjoxNzU4MDkxOTU4LCJuYmYiOjE3NTgwOTAxNTgsImp0aSI6IjEiLCJQaG9uZSI6IjE4MDAwMDAwMDAwIiwiVXNlck5hbWUiOiJsc3hkIiwiUmVhbE5hbWUiOiLotoXnuqfnrqHnkIblkZgiLCJBY2NvdW50VHlwZSI6MSwiR3JvdXBDb2RlcyI6IlZDTF9DQVNISUVSLFZDTF9PUEVSQVRFLFZDTF9BRE1JTixWQ0xfQUFBLFZDTF9WQ0xfT1BFUkFULFZDTF9JTlZPSUNFLENSTV9BRE1JTixMSUFOTElBTl9BRE1JTixNQVJLRVRNQUcyX0FETUlOLFBIT05FQklMTF9BRE1JTixRSUFOWkhVX1NVUFBFUl9BRE0sTUFSS0VUSU5HU0FBU19TVVBFUkFETUlOLENBUkRfQ09ERSxDQVJEX1BST0NVUkVNRU5ULE1BUktFVElOR1NZU1RFTV9TVVBFUixTVEFUSVNUSUNBTFNZU1RFTV9BRE1JTixaTFRYX0FETUlOLFpMVFhfT1BFUkFURSIsIkRpbmdVc2VySWQiOiIxNjIwMjYxMjMwMjg5MzM4MzQifQ.Bjsx9f8yfcrV9EWxb0n6POwnXVOq9XPRD78JFZnnf1_VAVMN78W4W570SZL27PWuDnkD7E4oUg6RzeZwZgl7BZrNpNr-a-QpNC5qCptqrqXeNfVStmX7pxWA8GqnzI8ybkZgbhQ58Gje7DzdJtBq_8zte_LDaYhTYXdIc5EAG0AbCzAk22nPTl47nkMeHtmisXQVLEsdibl1hW3ViFJlXwfXvUrOENItmL1_mRYkggUB0MaTu2nHJOYM6PaOVGLHx-74eepnmK2rm6konFEb6ed-Ukc6gVR-nM9yWZaYLYNGNKJLwZoCX3tRuerq74n4kzQgWmUEJeaVI1yIGSw1zw"
|
||||
zltxOrderDirectLog:
|
||||
enabled: true
|
||||
base_url: "https://gateway.dev.cdlsxd.cn/zltx_api/admin/direct/log/"
|
||||
api_key: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ1c2VyQ2VudGVyIiwiZXhwIjoxNzU2MTgyNTM1LCJuYmYiOjE3NTYxODA3MzUsImp0aSI6IjEiLCJQaG9uZSI6IjE4MDAwMDAwMDAwIiwiVXNlck5hbWUiOiJsc3hkIiwiUmVhbE5hbWUiOiLotoXnuqfnrqHnkIblkZgiLCJBY2NvdW50VHlwZSI6MSwiR3JvdXBDb2RlcyI6IlZDTF9DQVNISUVSLFZDTF9PUEVSQVRFLFZDTF9BRE1JTixWQ0xfQUFBLFZDTF9WQ0xfT1BFUkFULFZDTF9JTlZPSUNFLENSTV9BRE1JTixMSUFOTElBTl9BRE1JTixNQVJLRVRNQUcyX0FETUlOLFBIT05FQklMTF9BRE1JTixRSUFOWkhVX1NVUFBFUl9BRE0sTUFSS0VUSU5HU0FBU19TVVBFUkFETUlOLENBUkRfQ09ERSxDQVJEX1BST0NVUkVNRU5ULE1BUktFVElOR1NZU1RFTV9TVVBFUixTVEFUSVNUSUNBTFNZU1RFTV9BRE1JTixaTFRYX0FETUlOLFpMVFhfT1BFUkFURSIsIkRpbmdVc2VySWQiOiIxNjIwMjYxMjMwMjg5MzM4MzQifQ.N1xv1PYbcO8_jR5adaczc16YzGsr4z101gwEZdulkRaREBJNYTOnFrvRxTFx3RJTooXsqTqroE1MR84v_1WPX6BS6kKonA-kC1Jgot6yrt5rFWhGNGb2Cpr9rKIFCCQYmiGd3AUgDazEeaQ0_sodv3E-EXg9VfE1SX8nMcck9Yjnc8NCy7RTWaBIaSeOdZcEl-JfCD0S6GSx3oErp_hk-U9FKGwf60wAuDGTY1R0BP4BYpcEqS-C2LSnsSGyURi54Cuk5xH8r1WuF0Dm5bwAj5d7Hvs77-N_sUF-C5ONqyZJRAEhYLgcmN9RX_WQZfizdQJxizlTczdpzYfy-v-1eQ"
|
||||
zltxProduct:
|
||||
enabled: true
|
||||
base_url: "https://revcl.1688sup.com/api/admin/oursProduct"
|
||||
add_url: "https://revcl.1688sup.com/api/admin/platformProduct/getProductsByOfficialProductId"
|
||||
base_url: "https://gateway.dev.cdlsxd.cn/zltx_api/admin/oursProduct"
|
||||
add_url: "https://gateway.dev.cdlsxd.cn/zltx_api/admin/platformProduct/"
|
||||
api_key: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ1c2VyQ2VudGVyIiwiZXhwIjoxNzU2MTgyNTM1LCJuYmYiOjE3NTYxODA3MzUsImp0aSI6IjEiLCJQaG9uZSI6IjE4MDAwMDAwMDAwIiwiVXNlck5hbWUiOiJsc3hkIiwiUmVhbE5hbWUiOiLotoXnuqfnrqHnkIblkZgiLCJBY2NvdW50VHlwZSI6MSwiR3JvdXBDb2RlcyI6IlZDTF9DQVNISUVSLFZDTF9PUEVSQVRFLFZDTF9BRE1JTixWQ0xfQUFBLFZDTF9WQ0xfT1BFUkFULFZDTF9JTlZPSUNFLENSTV9BRE1JTixMSUFOTElBTl9BRE1JTixNQVJLRVRNQUcyX0FETUlOLFBIT05FQklMTF9BRE1JTixRSUFOWkhVX1NVUFBFUl9BRE0sTUFSS0VUSU5HU0FBU19TVVBFUkFETUlOLENBUkRfQ09ERSxDQVJEX1BST0NVUkVNRU5ULE1BUktFVElOR1NZU1RFTV9TVVBFUixTVEFUSVNUSUNBTFNZU1RFTV9BRE1JTixaTFRYX0FETUlOLFpMVFhfT1BFUkFURSIsIkRpbmdVc2VySWQiOiIxNjIwMjYxMjMwMjg5MzM4MzQifQ.N1xv1PYbcO8_jR5adaczc16YzGsr4z101gwEZdulkRaREBJNYTOnFrvRxTFx3RJTooXsqTqroE1MR84v_1WPX6BS6kKonA-kC1Jgot6yrt5rFWhGNGb2Cpr9rKIFCCQYmiGd3AUgDazEeaQ0_sodv3E-EXg9VfE1SX8nMcck9Yjnc8NCy7RTWaBIaSeOdZcEl-JfCD0S6GSx3oErp_hk-U9FKGwf60wAuDGTY1R0BP4BYpcEqS-C2LSnsSGyURi54Cuk5xH8r1WuF0Dm5bwAj5d7Hvs77-N_sUF-C5ONqyZJRAEhYLgcmN9RX_WQZfizdQJxizlTczdpzYfy-v-1eQ"
|
||||
zltxOrderStatistics:
|
||||
base_url: "https://revcl.1688sup.com/api/admin/direct/ai/search/"
|
||||
base_url: "https://gateway.dev.cdlsxd.cn/zltx_api/admin/direct/ai/search/"
|
||||
enabled: true
|
||||
api_key: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ1c2VyQ2VudGVyIiwiZXhwIjoxNzU2MTgyNTM1LCJuYmYiOjE3NTYxODA3MzUsImp0aSI6IjEiLCJQaG9uZSI6IjE4MDAwMDAwMDAwIiwiVXNlck5hbWUiOiJsc3hkIiwiUmVhbE5hbWUiOiLotoXnuqfnrqHnkIblkZgiLCJBY2NvdW50VHlwZSI6MSwiR3JvdXBDb2RlcyI6IlZDTF9DQVNISUVSLFZDTF9PUEVSQVRFLFZDTF9BRE1JTixWQ0xfQUFBLFZDTF9WQ0xfT1BFUkFULFZDTF9JTlZPSUNFLENSTV9BRE1JTixMSUFOTElBTl9BRE1JTixNQVJLRVRNQUcyX0FETUlOLFBIT05FQklMTF9BRE1JTixRSUFOWkhVX1NVUFBFUl9BRE0sTUFSS0VUSU5HU0FBU19TVVBFUkFETUlOLENBUkRfQ09ERSxDQVJEX1BST0NVUkVNRU5ULE1BUktFVElOR1NZU1RFTV9TVVBFUixTVEFUSVNUSUNBTFNZU1RFTV9BRE1JTixaTFRYX0FETUlOLFpMVFhfT1BFUkFURSIsIkRpbmdVc2VySWQiOiIxNjIwMjYxMjMwMjg5MzM4MzQifQ.N1xv1PYbcO8_jR5adaczc16YzGsr4z101gwEZdulkRaREBJNYTOnFrvRxTFx3RJTooXsqTqroE1MR84v_1WPX6BS6kKonA-kC1Jgot6yrt5rFWhGNGb2Cpr9rKIFCCQYmiGd3AUgDazEeaQ0_sodv3E-EXg9VfE1SX8nMcck9Yjnc8NCy7RTWaBIaSeOdZcEl-JfCD0S6GSx3oErp_hk-U9FKGwf60wAuDGTY1R0BP4BYpcEqS-C2LSnsSGyURi54Cuk5xH8r1WuF0Dm5bwAj5d7Hvs77-N_sUF-C5ONqyZJRAEhYLgcmN9RX_WQZfizdQJxizlTczdpzYfy-v-1eQ"
|
||||
knowledge:
|
||||
|
|
22
deploy.sh
22
deploy.sh
|
@ -1,22 +0,0 @@
|
|||
export GO111MODULE=on
|
||||
export GOPROXY=https://goproxy.cn,direct
|
||||
export GOPATH=/root/go
|
||||
export GOCACHE=/root/.cache/go-build
|
||||
export CONTAINER_NAME=ai_scheduler
|
||||
export CGO_ENABLED='0'
|
||||
|
||||
|
||||
git pull origin master
|
||||
go mod tidy
|
||||
make build
|
||||
docker build -t ${CONTAINER_NAME} .
|
||||
docker stop ${CONTAINER_NAME}
|
||||
docker rm -f ${CONTAINER_NAME}
|
||||
docker run -itd \
|
||||
--name "${CONTAINER_NAME}" \
|
||||
--restart=always \
|
||||
-e "OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://host.docker.internal:11434}" \
|
||||
-p 8090:8090 \
|
||||
"${CONTAINER_NAME}"
|
||||
|
||||
docker logs -f ${CONTAINER_NAME}
|
49
go.mod
49
go.mod
|
@ -11,7 +11,7 @@ require (
|
|||
github.com/gofiber/fiber/v2 v2.52.9
|
||||
github.com/gofiber/websocket/v2 v2.2.1
|
||||
github.com/google/wire v0.7.0
|
||||
github.com/ollama/ollama v0.12.3
|
||||
github.com/ollama/ollama v0.12.0
|
||||
github.com/redis/go-redis/v9 v9.14.0
|
||||
github.com/spf13/viper v1.17.0
|
||||
github.com/tmc/langchaingo v0.1.13
|
||||
|
@ -25,56 +25,24 @@ require (
|
|||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/agnivade/levenshtein v1.1.1 // indirect
|
||||
github.com/andybalholm/brotli v1.1.0 // 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/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/chewxy/hm v1.0.0 // indirect
|
||||
github.com/chewxy/math32 v1.11.0 // 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/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/dlclark/regexp2 v1.11.4 // indirect
|
||||
github.com/emirpasic/gods/v2 v2.0.0-alpha // indirect
|
||||
github.com/fasthttp/websocket v1.5.3 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // 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/go-sql-driver/mysql v1.8.1 // 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/google/uuid v1.6.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.17.9 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // 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/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/pkoukk/tiktoken-go v0.1.6 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.3.0 // indirect
|
||||
|
@ -83,33 +51,18 @@ require (
|
|||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spf13/afero v1.10.0 // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
github.com/spf13/cobra v1.7.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/stretchr/testify v1.11.1 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.51.0 // indirect
|
||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/xtgo/set v1.0.0 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.9.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.36.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa // indirect
|
||||
golang.org/x/image v0.22.0 // indirect
|
||||
golang.org/x/net v0.38.0 // indirect
|
||||
golang.org/x/sync v0.12.0 // indirect
|
||||
golang.org/x/sys v0.31.0 // indirect
|
||||
golang.org/x/term v0.30.0 // indirect
|
||||
golang.org/x/text v0.23.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
gonum.org/v1/gonum v0.15.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gorgonia.org/vecf32 v0.9.0 // indirect
|
||||
gorgonia.org/vecf64 v0.9.0 // indirect
|
||||
)
|
||||
|
|
185
go.sum
185
go.sum
|
@ -38,121 +38,61 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
|
|||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8=
|
||||
gitea.cdlsxd.cn/self-tools/l_request v1.0.8 h1:FaKRql9mCVcSoaGqPeBOAruZ52slzRngQ6VRTYKNSsA=
|
||||
gitea.cdlsxd.cn/self-tools/l_request v1.0.8/go.mod h1:Qf4hVXm2Eu5vOvwXk8D7U0q/aekMCkZ4Fg9wnRKlasQ=
|
||||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
|
||||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
|
||||
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
|
||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
||||
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
||||
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 h1:q4dksr6ICHXqG5hm0ZW5IHyeEJXoIJSOZeBLmWPNeIQ=
|
||||
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40/go.mod h1:Q7yQnSMnLvcXlZ8RV+jwz/6y1rQTqbX6C82SndT52Zs=
|
||||
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
|
||||
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/chewxy/hm v1.0.0 h1:zy/TSv3LV2nD3dwUEQL2VhXeoXbb9QkpmdRAVUFiA6k=
|
||||
github.com/chewxy/hm v1.0.0/go.mod h1:qg9YI4q6Fkj/whwHR1D+bOGeF7SniIP40VweVepLjg0=
|
||||
github.com/chewxy/math32 v1.0.0/go.mod h1:Miac6hA1ohdDUTagnvJy/q+aNnEk16qWUdb8ZVhvCN0=
|
||||
github.com/chewxy/math32 v1.11.0 h1:8sek2JWqeaKkVnHa7bPVqCEOUPbARo4SGxs6toKyAOo=
|
||||
github.com/chewxy/math32 v1.11.0/go.mod h1:dOB2rcuFrCn6UHrze36WSLVPKtzPMRAQvBvUwkSsLqs=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw=
|
||||
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/d4l3k/go-bfloat16 v0.0.0-20211005043715-690c3bdd05f1 h1:cBzrdJPAFBsgCrDPnZxlp1dF2+k4r1kVpD7+1S1PVjY=
|
||||
github.com/d4l3k/go-bfloat16 v0.0.0-20211005043715-690c3bdd05f1/go.mod h1:uw2gLcxEuYUlAd/EXyjc/v55nd3+47YAgWbSXVxPrNI=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
|
||||
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
|
||||
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
||||
github.com/emirpasic/gods/v2 v2.0.0-alpha h1:dwFlh8pBg1VMOXWGipNMRt8v96dKAIvBehtCt6OtunU=
|
||||
github.com/emirpasic/gods/v2 v2.0.0-alpha/go.mod h1:W0y4M2dtBB9U5z3YlghmpuUhiaZT2h6yoeE+C1sCp6A=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fasthttp/websocket v1.5.3 h1:TPpQuLwJYfd4LJPXvHDYPMFWbLjsT91n3GpWtCQtdek=
|
||||
github.com/fasthttp/websocket v1.5.3/go.mod h1:46gg/UBmTU1kUaTcwQXpUxtRwG2PvIZYeA8oL6vF3Fs=
|
||||
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
||||
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
||||
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
|
||||
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw=
|
||||
github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g=
|
||||
github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks=
|
||||
github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY=
|
||||
github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-kratos/kratos/v2 v2.9.1 h1:EGif6/S/aK/RCR5clIbyhioTNyoSrii3FC118jG40Z0=
|
||||
github.com/go-kratos/kratos/v2 v2.9.1/go.mod h1:a1MQLjMhIh7R0kcJS9SzJYR43BRI7EPzzN0J1Ksu2bA=
|
||||
github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/gofiber/fiber/v2 v2.52.9 h1:YjKl5DOiyP3j0mO61u3NTmK7or8GzzWzCFzkboyP5cw=
|
||||
github.com/gofiber/fiber/v2 v2.52.9/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
|
||||
github.com/gofiber/websocket/v2 v2.2.1 h1:C9cjxvloojayOp9AovmpQrk8VqvVnT8Oao3+IUygH7w=
|
||||
github.com/gofiber/websocket/v2 v2.2.1/go.mod h1:Ao/+nyNnX5u/hIFPuHl28a+NIkrqK7PRimyKaj4JxVU=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
|
@ -178,16 +118,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq
|
|||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
|
||||
github.com/google/flatbuffers v24.3.25+incompatible h1:CX395cjN9Kke9mmalRoL3d81AtFUxJM+yDthflgJGkI=
|
||||
github.com/google/flatbuffers v24.3.25+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
|
@ -197,11 +129,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
|
@ -224,34 +153,21 @@ github.com/google/wire v0.7.0/go.mod h1:n6YbUQD9cPKTnHXEBN2DXlOp/mVADhVErcMFb0v3
|
|||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
|
||||
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
|
@ -260,8 +176,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
|
@ -269,33 +183,14 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
|
|||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/nlpodyssey/gopickle v0.3.0 h1:BLUE5gxFLyyNOPzlXxt6GoHEMMxD0qhsE4p0CIQyoLw=
|
||||
github.com/nlpodyssey/gopickle v0.3.0/go.mod h1:f070HJ/yR+eLi5WmM1OXJEGaTpuJEUiib19olXgYha0=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/ollama/ollama v0.12.0 h1:BRry7G2Skz7Mu+E6rz40tzBXNbLTEhheGT8umc1zvxo=
|
||||
github.com/ollama/ollama v0.12.0/go.mod h1:9+1//yWPsDE2u+l1a5mpaKrYw4VdnSsRU3ioq5BvMms=
|
||||
github.com/ollama/ollama v0.12.3 h1:dHni+/BYDig8u8r7++FLdj6ebZaG95B2ZMqVTqqqYvc=
|
||||
github.com/ollama/ollama v0.12.3/go.mod h1:9+1//yWPsDE2u+l1a5mpaKrYw4VdnSsRU3ioq5BvMms=
|
||||
github.com/pdevine/tensor v0.0.0-20240510204454-f88f4562727c h1:GwiUUjKefgvSNmv3NCvI/BL0kDebW6Xa+kcdpdc1mTY=
|
||||
github.com/pdevine/tensor v0.0.0-20240510204454-f88f4562727c/go.mod h1:PSojXDXF7TbgQiD6kkd98IHOS0QqTyUEaWRiS8+BLu8=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY=
|
||||
github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI=
|
||||
github.com/pierrec/lz4/v4 v4.1.8/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
|
||||
github.com/pkoukk/tiktoken-go v0.1.6 h1:JF0TlJzhTbrI30wCvFuiw6FzP2+/bR+FIxUdgEAcUsw=
|
||||
|
@ -308,12 +203,9 @@ github.com/redis/go-redis/v9 v9.14.0 h1:u4tNCjXOyzfgeLN+vAZaW1xUooqWDqVEsZN0U01j
|
|||
github.com/redis/go-redis/v9 v9.14.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
|
||||
github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ=
|
||||
github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||
|
@ -326,8 +218,6 @@ github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY=
|
|||
github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
|
||||
github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
|
||||
github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
|
||||
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI=
|
||||
|
@ -336,15 +226,12 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
|||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
|
@ -353,41 +240,26 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
|
|||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/tmc/langchaingo v0.1.13 h1:rcpMWBIi2y3B90XxfE4Ao8dhCQPVDMaNPnN5cGB1CaA=
|
||||
github.com/tmc/langchaingo v0.1.13/go.mod h1:vpQ5NOIhpzxDfTZK9B6tf2GM/MoaHewPWM5KXXGh7hg=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
|
||||
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g=
|
||||
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
||||
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
||||
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||
github.com/xtgo/set v1.0.0 h1:6BCNBRv3ORNDQ7fyoJXRv+tstJz3m1JVFQErfeZz2pY=
|
||||
github.com/xtgo/set v1.0.0/go.mod h1:d3NHzGzSa0NmB2NhFyECA+QdRp29oEn2xbT+TpeFoM8=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
|
||||
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
|
||||
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
|
||||
go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 h1:lGdhQUN/cnWdSH3291CUuxSEqc+AsGTiDxPP3r2J0l4=
|
||||
go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
|
@ -397,14 +269,10 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm
|
|||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||
golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE=
|
||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
|
@ -413,17 +281,8 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH
|
|||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa h1:t2QcU6V556bFjYgu4L6C+6VrCPyJZ+eyRsABUPs1mz4=
|
||||
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk=
|
||||
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.22.0 h1:UtK5yLUzilVrkjMAZAZ34DXGpASN8i8pj8g+O+yd10g=
|
||||
golang.org/x/image v0.22.0/go.mod h1:9hPFhljd4zZ1GNSIZJ49sqbp45GKK9t6w+iXvGqZUz4=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
|
@ -435,7 +294,6 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRu
|
|||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
|
@ -446,7 +304,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
|
@ -478,8 +335,6 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY
|
|||
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
||||
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
|
@ -502,7 +357,6 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
|
||||
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -536,18 +390,12 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
|
@ -560,7 +408,6 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3
|
|||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||
|
@ -568,10 +415,8 @@ golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
|||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
|
@ -584,7 +429,6 @@ golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgw
|
|||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
|
@ -608,7 +452,6 @@ golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roY
|
|||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
|
@ -617,24 +460,12 @@ golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4f
|
|||
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
|
||||
gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
|
||||
gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0=
|
||||
gonum.org/v1/gonum v0.15.0 h1:2lYxjRbTYyxkJxlhC+LvJIx3SsANPdRybu1tGj9/OrQ=
|
||||
gonum.org/v1/gonum v0.15.0/go.mod h1:xzZVBJBtS+Mz4q0Yl2LJTk+OxOg4jiXZ7qBoM0uISGo=
|
||||
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
|
||||
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
|
||||
gonum.org/v1/plot v0.9.0/go.mod h1:3Pcqqmp6RHvJI72kgb8fThyUnav364FOsdDo2aGW5lY=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
|
@ -684,7 +515,6 @@ google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfG
|
|||
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
|
||||
|
@ -698,7 +528,6 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D
|
|||
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
|
@ -714,13 +543,9 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji
|
|||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
||||
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
|
||||
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
|
@ -733,9 +558,6 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
|
|||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -746,16 +568,11 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
|||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorgonia.org/vecf32 v0.9.0 h1:PClazic1r+JVJ1dEzRXgeiVl4g1/Hf/w+wUSqnco1Xg=
|
||||
gorgonia.org/vecf32 v0.9.0/go.mod h1:NCc+5D2oxddRL11hd+pCB1PEyXWOyiQxfZ/1wwhOXCA=
|
||||
gorgonia.org/vecf64 v0.9.0 h1:bgZDP5x0OzBF64PjMGC3EvTdOoMEcmfAh1VCUnZFm1A=
|
||||
gorgonia.org/vecf64 v0.9.0/go.mod h1:hp7IOWCnRiVQKON73kkC/AUMtEXyf9kGlVrtPQ9ccVA=
|
||||
gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg=
|
||||
gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo=
|
||||
gorm.io/gorm v1.31.0 h1:0VlycGreVhK7RF/Bwt51Fk8v0xLiiiFdbGDPIZQ7mJY=
|
||||
|
@ -767,9 +584,7 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package llm_service
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/data/model"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"context"
|
||||
)
|
||||
|
||||
type LlmService interface {
|
||||
IntentRecognize(ctx context.Context, sysInfo model.AiSy, history []model.AiChatHi, userInput string, tasks []model.AiTask) (string, error)
|
||||
}
|
||||
|
||||
// buildSystemPrompt 构建系统提示词
|
||||
func buildSystemPrompt(prompt string) string {
|
||||
if len(prompt) == 0 {
|
||||
prompt = "[system] 你是一个智能路由系统,核心职责是 **精准解析用户意图并路由至对应任务模块**\n[rule]\n1.返回以下格式的JSON:{ \"index\": \"工具索引index\", \"confidence\": 0.0-1.0,\"reasoning\": \"判断理由\"}\n2.严格返回字符串格式,禁用markdown格式返回\n3.只返回json字符串,不包含任何其他解释性文字\n4.当用户意图非常不清晰时使用,尝试进行追问具体希望查询内容"
|
||||
}
|
||||
|
||||
return prompt
|
||||
}
|
||||
|
||||
func buildAssistant(his []model.AiChatHi) (chatHis entitys.ChatHis) {
|
||||
for _, item := range his {
|
||||
if len(chatHis.SessionId) == 0 {
|
||||
chatHis.SessionId = item.SessionID
|
||||
}
|
||||
chatHis.Messages = append(chatHis.Messages, entitys.HisMessage{
|
||||
Role: item.Role,
|
||||
Content: item.Content,
|
||||
Timestamp: item.CreateAt.Format("2006-01-02 15:04:05"),
|
||||
})
|
||||
}
|
||||
chatHis.Context = entitys.HisContext{
|
||||
UserLanguage: "zh-CN",
|
||||
SystemMode: "technical_support",
|
||||
}
|
||||
return
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
package llm_service
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/data/model"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"ai_scheduler/internal/pkg"
|
||||
"ai_scheduler/internal/pkg/utils_langchain"
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/tmc/langchaingo/llms"
|
||||
)
|
||||
|
||||
type LangChainService struct {
|
||||
client *utils_langchain.UtilLangChain
|
||||
}
|
||||
|
||||
func NewLangChainGenerate(
|
||||
client *utils_langchain.UtilLangChain,
|
||||
) *LangChainService {
|
||||
|
||||
return &LangChainService{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *LangChainService) IntentRecognize(ctx context.Context, sysInfo model.AiSy, history []model.AiChatHi, userInput string, tasks []model.AiTask) (msg string, err error) {
|
||||
prompt := r.getPrompt(sysInfo, history, userInput, tasks)
|
||||
AgentClient := r.client.Get()
|
||||
defer r.client.Put(AgentClient)
|
||||
match, err := AgentClient.Llm.GenerateContent(
|
||||
ctx, // 使用可取消的上下文
|
||||
prompt,
|
||||
llms.WithJSONMode(),
|
||||
)
|
||||
msg = match.Choices[0].Content
|
||||
return
|
||||
}
|
||||
|
||||
func (r *LangChainService) getPrompt(sysInfo model.AiSy, history []model.AiChatHi, reqInput string, tasks []model.AiTask) []llms.MessageContent {
|
||||
var (
|
||||
prompt = make([]llms.MessageContent, 0)
|
||||
)
|
||||
prompt = append(prompt, llms.MessageContent{
|
||||
Role: llms.ChatMessageTypeSystem,
|
||||
Parts: []llms.ContentPart{
|
||||
llms.TextPart(buildSystemPrompt(sysInfo.SysPrompt)),
|
||||
},
|
||||
}, llms.MessageContent{
|
||||
Role: llms.ChatMessageTypeTool,
|
||||
Parts: []llms.ContentPart{
|
||||
llms.TextPart(pkg.JsonStringIgonErr(buildAssistant(history))),
|
||||
},
|
||||
}, llms.MessageContent{
|
||||
Role: llms.ChatMessageTypeTool,
|
||||
Parts: []llms.ContentPart{
|
||||
llms.TextPart(pkg.JsonStringIgonErr(r.registerTools(tasks))),
|
||||
},
|
||||
}, llms.MessageContent{
|
||||
Role: llms.ChatMessageTypeHuman,
|
||||
Parts: []llms.ContentPart{
|
||||
llms.TextPart(reqInput),
|
||||
},
|
||||
})
|
||||
return prompt
|
||||
}
|
||||
|
||||
func (r *LangChainService) registerTools(tasks []model.AiTask) []llms.Tool {
|
||||
taskPrompt := make([]llms.Tool, 0)
|
||||
for _, task := range tasks {
|
||||
var taskConfig entitys.TaskConfig
|
||||
err := json.Unmarshal([]byte(task.Config), &taskConfig)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
taskPrompt = append(taskPrompt, llms.Tool{
|
||||
Type: "function",
|
||||
Function: &llms.FunctionDefinition{
|
||||
Name: task.Index,
|
||||
Description: task.Desc,
|
||||
Parameters: taskConfig.Param,
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
return taskPrompt
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
package llm_service
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/config"
|
||||
"ai_scheduler/internal/data/model"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"ai_scheduler/internal/pkg"
|
||||
"ai_scheduler/internal/pkg/utils_ollama"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/gofiber/fiber/v2/log"
|
||||
"github.com/ollama/ollama/api"
|
||||
)
|
||||
|
||||
type OllamaService struct {
|
||||
client *utils_ollama.Client
|
||||
config *config.Config
|
||||
}
|
||||
|
||||
func NewOllamaGenerate(
|
||||
client *utils_ollama.Client,
|
||||
config *config.Config,
|
||||
) *OllamaService {
|
||||
return &OllamaService{
|
||||
client: client,
|
||||
config: config,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *OllamaService) IntentRecognize(ctx context.Context, requireData *entitys.RequireData) (msg string, err error) {
|
||||
prompt, err := r.getPrompt(ctx, requireData)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
toolDefinitions := r.registerToolsOllama(requireData.Tasks)
|
||||
match, err := r.client.ToolSelect(context.TODO(), prompt, toolDefinitions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
log.Info("意图识别结果: %v", pkg.JsonStringIgonErr(match))
|
||||
if len(match.Message.Content) == 0 {
|
||||
if match.Message.ToolCalls != nil {
|
||||
var matchFromTools = &entitys.Match{
|
||||
Confidence: 1,
|
||||
Index: match.Message.ToolCalls[0].Function.Name,
|
||||
Parameters: pkg.JsonStringIgonErr(match.Message.ToolCalls[0].Function.Arguments),
|
||||
IsMatch: true,
|
||||
}
|
||||
match.Message.Content = pkg.JsonStringIgonErr(matchFromTools)
|
||||
} else {
|
||||
err = errors.New("不太明白你想表达的意思呢,可以在仔细描述一下您所需要的内容吗,感谢感谢")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
msg = match.Message.Content
|
||||
return
|
||||
}
|
||||
|
||||
func (r *OllamaService) getPrompt(ctx context.Context, requireData *entitys.RequireData) ([]api.Message, error) {
|
||||
|
||||
var (
|
||||
prompt = make([]api.Message, 0)
|
||||
)
|
||||
prompt = append(prompt, api.Message{
|
||||
Role: "system",
|
||||
Content: buildSystemPrompt(requireData.Sys.SysPrompt),
|
||||
}, api.Message{
|
||||
Role: "assistant",
|
||||
Content: fmt.Sprintf("聊天记录:%s", pkg.JsonStringIgonErr(buildAssistant(requireData.Histories))),
|
||||
}, api.Message{
|
||||
Role: "user",
|
||||
Content: requireData.UserInput,
|
||||
})
|
||||
|
||||
if len(requireData.ImgByte) > 0 {
|
||||
_, err := r.RecognizeWithImg(ctx, requireData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
}
|
||||
return prompt, nil
|
||||
}
|
||||
|
||||
func (r *OllamaService) RecognizeWithImg(ctx context.Context, requireData *entitys.RequireData) (desc api.GenerateResponse, err error) {
|
||||
if requireData.ImgByte == nil {
|
||||
return
|
||||
}
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: "",
|
||||
Content: "图片识别中。。。",
|
||||
Type: entitys.ResponseLoading,
|
||||
}
|
||||
desc, err = r.client.Generation(ctx, &api.GenerateRequest{
|
||||
Model: r.config.Ollama.GenerateModel,
|
||||
Stream: new(bool),
|
||||
System: "识别图片内容",
|
||||
Prompt: requireData.UserInput,
|
||||
Images: requireData.ImgByte,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (r *OllamaService) registerToolsOllama(tasks []model.AiTask) []api.Tool {
|
||||
taskPrompt := make([]api.Tool, 0)
|
||||
for _, task := range tasks {
|
||||
var taskConfig entitys.TaskConfigDetail
|
||||
err := json.Unmarshal([]byte(task.Config), &taskConfig)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
taskPrompt = append(taskPrompt, api.Tool{
|
||||
Type: "function",
|
||||
Function: api.ToolFunction{
|
||||
Name: task.Index,
|
||||
Description: task.Desc,
|
||||
Parameters: api.ToolFunctionParameters{
|
||||
Type: taskConfig.Param.Type,
|
||||
Required: taskConfig.Param.Required,
|
||||
Properties: taskConfig.Param.Properties,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
return taskPrompt
|
||||
}
|
|
@ -1,15 +1,5 @@
|
|||
package biz
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/biz/llm_service"
|
||||
import "github.com/google/wire"
|
||||
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
var ProviderSetBiz = wire.NewSet(
|
||||
NewAiRouterBiz,
|
||||
NewSessionBiz,
|
||||
NewChatHistoryBiz,
|
||||
llm_service.NewLangChainGenerate,
|
||||
llm_service.NewOllamaGenerate,
|
||||
)
|
||||
var ProviderSetBiz = wire.NewSet(NewAiRouterBiz, NewSessionBiz, NewChatHistoryBiz)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package biz
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/biz/llm_service"
|
||||
"ai_scheduler/internal/config"
|
||||
"ai_scheduler/internal/data/constants"
|
||||
errors "ai_scheduler/internal/data/error"
|
||||
|
@ -10,333 +9,207 @@ import (
|
|||
"ai_scheduler/internal/entitys"
|
||||
"ai_scheduler/internal/pkg"
|
||||
"ai_scheduler/internal/pkg/mapstructure"
|
||||
|
||||
"ai_scheduler/internal/tools"
|
||||
"ai_scheduler/internal/pkg/utils_ollama"
|
||||
tools "ai_scheduler/internal/tools"
|
||||
"ai_scheduler/tmpl/dataTemp"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.cdlsxd.cn/self-tools/l_request"
|
||||
"github.com/gofiber/fiber/v2/log"
|
||||
"github.com/gofiber/websocket/v2"
|
||||
"github.com/tmc/langchaingo/llms"
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
// AiRouterBiz 智能路由服务
|
||||
type AiRouterBiz struct {
|
||||
//aiClient entitys.AIClient
|
||||
toolManager *tools.Manager
|
||||
sessionImpl *impl.SessionImpl
|
||||
sysImpl *impl.SysImpl
|
||||
taskImpl *impl.TaskImpl
|
||||
hisImpl *impl.ChatImpl
|
||||
conf *config.Config
|
||||
rds *pkg.Rdb
|
||||
langChain *llm_service.LangChainService
|
||||
Ollama *llm_service.OllamaService
|
||||
utilAgent *utils_ollama.UtilOllama
|
||||
channelPool *pkg.SafeChannelPool
|
||||
}
|
||||
|
||||
// NewRouterService 创建路由服务
|
||||
func NewAiRouterBiz(
|
||||
//aiClient entitys.AIClient,
|
||||
toolManager *tools.Manager,
|
||||
sessionImpl *impl.SessionImpl,
|
||||
sysImpl *impl.SysImpl,
|
||||
taskImpl *impl.TaskImpl,
|
||||
hisImpl *impl.ChatImpl,
|
||||
conf *config.Config,
|
||||
langChain *llm_service.LangChainService,
|
||||
Ollama *llm_service.OllamaService,
|
||||
utilAgent *utils_ollama.UtilOllama,
|
||||
channelPool *pkg.SafeChannelPool,
|
||||
) *AiRouterBiz {
|
||||
return &AiRouterBiz{
|
||||
//aiClient: aiClient,
|
||||
toolManager: toolManager,
|
||||
sessionImpl: sessionImpl,
|
||||
conf: conf,
|
||||
sysImpl: sysImpl,
|
||||
hisImpl: hisImpl,
|
||||
taskImpl: taskImpl,
|
||||
langChain: langChain,
|
||||
Ollama: Ollama,
|
||||
utilAgent: utilAgent,
|
||||
channelPool: channelPool,
|
||||
}
|
||||
}
|
||||
|
||||
// Route 执行智能路由
|
||||
func (r *AiRouterBiz) Route(ctx context.Context, req *entitys.ChatRequest) (*entitys.ChatResponse, error) {
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Route 执行智能路由
|
||||
func (r *AiRouterBiz) RouteWithSocket(c *websocket.Conn, req *entitys.ChatSockRequest) (err error) {
|
||||
//必要数据验证和获取
|
||||
var requireData entitys.RequireData
|
||||
err = r.dataAuth(c, &requireData)
|
||||
ch, err := r.channelPool.Get()
|
||||
if err != nil {
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
//初始化通道/上下文
|
||||
requireData.Ch = make(chan entitys.Response)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
// 启动独立的消息处理协程
|
||||
done := r.startMessageHandler(ctx, c, &requireData, req.Text)
|
||||
defer func() {
|
||||
close(requireData.Ch) //关闭主通道
|
||||
<-done // 等待消息处理完成
|
||||
cancel()
|
||||
}()
|
||||
|
||||
//获取图片信息
|
||||
err = r.getImgData(req.Img, &requireData)
|
||||
if err != nil {
|
||||
log.Errorf("GetImgData error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
//获取系统信息
|
||||
err = r.getRequireData(req.Text, &requireData)
|
||||
if err != nil {
|
||||
log.Errorf("SQL error: %v", err)
|
||||
return
|
||||
}
|
||||
//意图识别
|
||||
err = r.recognize(ctx, &requireData)
|
||||
if err != nil {
|
||||
log.Errorf("LLM error: %v", err)
|
||||
return
|
||||
}
|
||||
//向下传递
|
||||
if err = r.handleMatch(ctx, &requireData); err != nil {
|
||||
log.Errorf("Handle error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// startMessageHandler 启动独立的消息处理协程
|
||||
func (r *AiRouterBiz) startMessageHandler(
|
||||
ctx context.Context,
|
||||
c *websocket.Conn,
|
||||
requireData *entitys.RequireData,
|
||||
userInput string,
|
||||
) <-chan struct{} {
|
||||
done := make(chan struct{})
|
||||
var chat []string
|
||||
|
||||
go func() {
|
||||
defer func() {
|
||||
close(done)
|
||||
// 保存历史记录
|
||||
var his = []*model.AiChatHi{
|
||||
{
|
||||
SessionID: requireData.Session,
|
||||
Role: "user",
|
||||
Content: userInput, // 用户输入在外部处理
|
||||
},
|
||||
}
|
||||
if len(chat) > 0 {
|
||||
his = append(his, &model.AiChatHi{
|
||||
SessionID: requireData.Session,
|
||||
Role: "assistant",
|
||||
Content: strings.Join(chat, ""),
|
||||
})
|
||||
}
|
||||
for _, hi := range his {
|
||||
r.hisImpl.Add(hi)
|
||||
}
|
||||
}()
|
||||
|
||||
for v := range requireData.Ch { // 自动检测通道关闭
|
||||
if err := sendWithTimeout(c, v, 2*time.Second); err != nil {
|
||||
log.Errorf("Send error: %v", err)
|
||||
return
|
||||
}
|
||||
if v.Type == entitys.ResponseText || v.Type == entitys.ResponseStream || v.Type == entitys.ResponseJson {
|
||||
chat = append(chat, v.Content)
|
||||
}
|
||||
if err != nil {
|
||||
entitys.MsgSend(c, entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: err.Error(),
|
||||
Type: entitys.ResponseErr,
|
||||
})
|
||||
}
|
||||
entitys.MsgSend(c, entitys.ResponseData{
|
||||
Done: true,
|
||||
Content: "",
|
||||
Type: entitys.ResponseEnd,
|
||||
})
|
||||
err = r.channelPool.Put(ch)
|
||||
if err != nil {
|
||||
close(ch)
|
||||
}
|
||||
}()
|
||||
session := c.Headers("X-Session", "")
|
||||
if len(session) == 0 {
|
||||
return errors.SessionNotFound
|
||||
}
|
||||
auth := c.Headers("X-Authorization", "")
|
||||
if len(auth) == 0 {
|
||||
return errors.AuthNotFound
|
||||
}
|
||||
key := c.Headers("X-App-Key", "")
|
||||
if len(key) == 0 {
|
||||
return errors.KeyNotFound
|
||||
}
|
||||
|
||||
return done
|
||||
}
|
||||
sysInfo, err := r.getSysInfo(key)
|
||||
if err != nil {
|
||||
return errors.SysNotFound
|
||||
}
|
||||
|
||||
// 辅助函数:带超时的 WebSocket 发送
|
||||
func sendWithTimeout(c *websocket.Conn, data entitys.Response, timeout time.Duration) error {
|
||||
sendCtx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
defer cancel()
|
||||
history, err := r.getSessionChatHis(session)
|
||||
if err != nil {
|
||||
return errors.SystemError
|
||||
}
|
||||
|
||||
done := make(chan error, 1)
|
||||
task, err := r.getTasks(sysInfo.SysID)
|
||||
if err != nil {
|
||||
return errors.SystemError
|
||||
}
|
||||
//意图预测
|
||||
prompt := r.getPromptLLM(sysInfo, history, req.Text, task)
|
||||
match, err := r.utilAgent.Llm.GenerateContent(context.TODO(), prompt,
|
||||
llms.WithJSONMode(),
|
||||
)
|
||||
if err != nil {
|
||||
return errors.SystemError
|
||||
}
|
||||
log.Info(match.Choices[0].Content)
|
||||
ch <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: match.Choices[0].Content,
|
||||
Type: entitys.ResponseLog,
|
||||
}
|
||||
var matchJson entitys.Match
|
||||
err = json.Unmarshal([]byte(match.Choices[0].Content), &matchJson)
|
||||
if err != nil {
|
||||
return errors.SystemError
|
||||
}
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
done <- fmt.Errorf("panic in MsgSend: %v", r)
|
||||
err = fmt.Errorf("recovered from panic: %v", r)
|
||||
}
|
||||
close(done)
|
||||
}()
|
||||
// 如果 MsgSend 阻塞,这里会卡住
|
||||
err := entitys.MsgSend(c, data)
|
||||
done <- err
|
||||
defer close(ch)
|
||||
err = r.handleMatch(c, ch, &matchJson, task, sysInfo)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}()
|
||||
|
||||
select {
|
||||
case err := <-done:
|
||||
return err
|
||||
case <-sendCtx.Done():
|
||||
return sendCtx.Err()
|
||||
}
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) getImgData(imgUrl string, requireData *entitys.RequireData) (err error) {
|
||||
|
||||
if len(imgUrl) == 0 {
|
||||
return
|
||||
}
|
||||
if err = pkg.ValidateImageURL(imgUrl); err != nil {
|
||||
return err
|
||||
}
|
||||
req := l_request.Request{
|
||||
Method: "GET",
|
||||
Url: imgUrl,
|
||||
}
|
||||
res, err := req.Send()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if _, ex := res.Headers["Content-Type"]; !ex {
|
||||
return errors.ParamErr("图片格式错误:Content-Type未获取")
|
||||
}
|
||||
if !strings.HasPrefix(res.Headers["Content-Type"], "image/") {
|
||||
return errors.ParamErr("expected image content, got %s", res.Headers["Content-Type"])
|
||||
}
|
||||
requireData.ImgByte = append(requireData.ImgByte, res.Content)
|
||||
return
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) recognize(ctx context.Context, requireData *entitys.RequireData) (err error) {
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: "",
|
||||
Content: "准备意图识别",
|
||||
Type: entitys.ResponseLog,
|
||||
}
|
||||
//意图识别
|
||||
recognizeMsg, err := r.Ollama.IntentRecognize(ctx, requireData)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: "",
|
||||
Content: recognizeMsg,
|
||||
Type: entitys.ResponseLog,
|
||||
}
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: "",
|
||||
Content: "意图识别结束",
|
||||
Type: entitys.ResponseLog,
|
||||
}
|
||||
var match entitys.Match
|
||||
if err = json.Unmarshal([]byte(recognizeMsg), &match); err != nil {
|
||||
err = errors.SysErr("数据结构错误:%v", err.Error())
|
||||
return
|
||||
}
|
||||
requireData.Match = &match
|
||||
return
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) getRequireData(userInput string, requireData *entitys.RequireData) (err error) {
|
||||
requireData.Sys, err = r.getSysInfo(requireData.Key)
|
||||
if err != nil {
|
||||
err = errors.SysErr("获取系统信息失败:%v", err.Error())
|
||||
return
|
||||
}
|
||||
requireData.Histories, err = r.getSessionChatHis(requireData.Session)
|
||||
if err != nil {
|
||||
err = errors.SysErr("获取历史记录失败:%v", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
requireData.Tasks, err = r.getTasks(requireData.Sys.SysID)
|
||||
if err != nil {
|
||||
err = errors.SysErr("获取任务列表失败:%v", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
requireData.UserInput = userInput
|
||||
if len(requireData.UserInput) == 0 {
|
||||
err = errors.SysErr("获取用户输入失败")
|
||||
return
|
||||
}
|
||||
if len(requireData.UserInput) == 0 {
|
||||
err = errors.SysErr("获取用户输入失败")
|
||||
return
|
||||
for v := range ch {
|
||||
if err := entitys.MsgSend(c, v); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) dataAuth(c *websocket.Conn, requireData *entitys.RequireData) (err error) {
|
||||
requireData.Session = c.Query("x-session", "")
|
||||
if len(requireData.Session) == 0 {
|
||||
err = errors.SessionNotFound
|
||||
return
|
||||
}
|
||||
requireData.Auth = c.Query("x-authorization", "")
|
||||
if len(requireData.Auth) == 0 {
|
||||
err = errors.AuthNotFound
|
||||
return
|
||||
}
|
||||
requireData.Key = c.Query("x-app-key", "")
|
||||
if len(requireData.Key) == 0 {
|
||||
err = errors.KeyNotFound
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) handleOtherTask(ctx context.Context, requireData *entitys.RequireData) (err error) {
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: "",
|
||||
Content: requireData.Match.Reasoning,
|
||||
func (r *AiRouterBiz) handleOtherTask(c *websocket.Conn, ch chan entitys.ResponseData, matchJson *entitys.Match) (err error) {
|
||||
ch <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: matchJson.Reasoning,
|
||||
Type: entitys.ResponseText,
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) handleMatch(ctx context.Context, requireData *entitys.RequireData) (err error) {
|
||||
func (r *AiRouterBiz) handleMatch(c *websocket.Conn, ch chan entitys.ResponseData, matchJson *entitys.Match, tasks []model.AiTask, sysInfo model.AiSy) (err error) {
|
||||
|
||||
if !requireData.Match.IsMatch {
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: "",
|
||||
Content: requireData.Match.Chat,
|
||||
if !matchJson.IsMatch {
|
||||
ch <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: matchJson.Reasoning,
|
||||
Type: entitys.ResponseText,
|
||||
}
|
||||
return
|
||||
}
|
||||
var pointTask *model.AiTask
|
||||
for _, task := range requireData.Tasks {
|
||||
if task.Index == requireData.Match.Index {
|
||||
for _, task := range tasks {
|
||||
if task.Index == matchJson.Index {
|
||||
pointTask = &task
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if pointTask == nil || pointTask.Index == "other" {
|
||||
return r.handleOtherTask(ctx, requireData)
|
||||
return r.handleOtherTask(c, ch, matchJson)
|
||||
}
|
||||
switch pointTask.Type {
|
||||
case constants.TaskTypeApi:
|
||||
return r.handleApiTask(ctx, requireData, pointTask)
|
||||
return r.handleApiTask(ch, c, matchJson, pointTask)
|
||||
case constants.TaskTypeFunc:
|
||||
return r.handleTask(ctx, requireData, pointTask)
|
||||
return r.handleTask(ch, c, matchJson, pointTask)
|
||||
case constants.TaskTypeKnowle:
|
||||
return r.handleKnowle(ctx, requireData, pointTask)
|
||||
return r.handleKnowle(ch, c, matchJson, pointTask, sysInfo)
|
||||
default:
|
||||
return r.handleOtherTask(ctx, requireData)
|
||||
return r.handleOtherTask(c, ch, matchJson)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) handleTask(ctx context.Context, requireData *entitys.RequireData, task *model.AiTask) (err error) {
|
||||
func (r *AiRouterBiz) handleTask(channel chan entitys.ResponseData, c *websocket.Conn, matchJson *entitys.Match, task *model.AiTask) (err error) {
|
||||
|
||||
var configData entitys.ConfigDataTool
|
||||
err = json.Unmarshal([]byte(task.Config), &configData)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = r.toolManager.ExecuteTool(ctx, configData.Tool, requireData)
|
||||
err = r.toolManager.ExecuteTool(channel, c, configData.Tool, []byte(matchJson.Parameters))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -345,7 +218,7 @@ func (r *AiRouterBiz) handleTask(ctx context.Context, requireData *entitys.Requi
|
|||
}
|
||||
|
||||
// 知识库
|
||||
func (r *AiRouterBiz) handleKnowle(ctx context.Context, requireData *entitys.RequireData, task *model.AiTask) (err error) {
|
||||
func (r *AiRouterBiz) handleKnowle(channel chan entitys.ResponseData, c *websocket.Conn, matchJson *entitys.Match, task *model.AiTask, sysInfo model.AiSy) (err error) {
|
||||
|
||||
var (
|
||||
configData entitys.ConfigDataTool
|
||||
|
@ -359,11 +232,11 @@ func (r *AiRouterBiz) handleKnowle(ctx context.Context, requireData *entitys.Req
|
|||
}
|
||||
|
||||
// 通过session 找到知识库session
|
||||
var has bool
|
||||
if len(requireData.Session) == 0 {
|
||||
session := c.Headers("X-Session", "")
|
||||
if len(session) == 0 {
|
||||
return errors.SessionNotFound
|
||||
}
|
||||
requireData.SessionInfo, has, err = r.sessionImpl.FindOne(r.sessionImpl.WithSessionId(requireData.Session))
|
||||
sessionInfo, has, err := r.sessionImpl.FindOne(r.sessionImpl.WithSessionId(session))
|
||||
if err != nil {
|
||||
return
|
||||
} else if !has {
|
||||
|
@ -386,15 +259,15 @@ func (r *AiRouterBiz) handleKnowle(ctx context.Context, requireData *entitys.Req
|
|||
}
|
||||
|
||||
// 知识库的session为空,请求知识库获取, 并绑定
|
||||
if requireData.SessionInfo.KnowlegeSessionID == "" {
|
||||
if sessionInfo.KnowlegeSessionID == "" {
|
||||
// 请求知识库
|
||||
if sessionIdKnowledge, err = tools.GetKnowledgeBaseSession(host, requireData.Sys.KnowlegeBaseID, requireData.Sys.KnowlegeTenantKey); err != nil {
|
||||
if sessionIdKnowledge, err = tools.GetKnowledgeBaseSession(host, sysInfo.KnowlegeBaseID, sysInfo.KnowlegeTenantKey); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 绑定知识库session,下次可以使用
|
||||
requireData.SessionInfo.KnowlegeSessionID = sessionIdKnowledge
|
||||
if err = r.sessionImpl.Update(&requireData.SessionInfo, r.sessionImpl.WithSessionId(requireData.SessionInfo.SessionID)); err != nil {
|
||||
sessionInfo.KnowlegeSessionID = sessionIdKnowledge
|
||||
if err = r.sessionImpl.Update(&sessionInfo, r.sessionImpl.WithSessionId(sessionInfo.SessionID)); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -402,21 +275,25 @@ func (r *AiRouterBiz) handleKnowle(ctx context.Context, requireData *entitys.Req
|
|||
// 用户输入解析
|
||||
var ok bool
|
||||
input := make(map[string]string)
|
||||
if err = json.Unmarshal([]byte(requireData.Match.Parameters), &input); err != nil {
|
||||
if err = json.Unmarshal([]byte(matchJson.Parameters), &input); err != nil {
|
||||
return
|
||||
}
|
||||
if query, ok = input["query"]; !ok {
|
||||
return fmt.Errorf("query不能为空")
|
||||
}
|
||||
|
||||
requireData.KnowledgeConf = entitys.KnowledgeBaseRequest{
|
||||
Session: requireData.SessionInfo.KnowlegeSessionID,
|
||||
ApiKey: requireData.Sys.KnowlegeTenantKey,
|
||||
knowledgeConfig := tools.KnowledgeBaseRequest{
|
||||
Session: sessionInfo.KnowlegeSessionID,
|
||||
ApiKey: sysInfo.KnowlegeTenantKey,
|
||||
Query: query,
|
||||
}
|
||||
b, err := json.Marshal(knowledgeConfig)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 执行工具
|
||||
err = r.toolManager.ExecuteTool(ctx, configData.Tool, requireData)
|
||||
err = r.toolManager.ExecuteTool(channel, c, configData.Tool, b)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -424,16 +301,17 @@ func (r *AiRouterBiz) handleKnowle(ctx context.Context, requireData *entitys.Req
|
|||
return
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) handleApiTask(ctx context.Context, requireData *entitys.RequireData, task *model.AiTask) (err error) {
|
||||
func (r *AiRouterBiz) handleApiTask(channels chan entitys.ResponseData, c *websocket.Conn, matchJson *entitys.Match, task *model.AiTask) (err error) {
|
||||
var (
|
||||
request l_request.Request
|
||||
auth = c.Headers("X-Authorization", "")
|
||||
requestParam map[string]interface{}
|
||||
)
|
||||
err = json.Unmarshal([]byte(requireData.Match.Parameters), &requestParam)
|
||||
err = json.Unmarshal([]byte(matchJson.Parameters), &requestParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
request.Url = strings.ReplaceAll(task.Config, "${authorization}", requireData.Auth)
|
||||
request.Url = strings.ReplaceAll(task.Config, "${authorization}", auth)
|
||||
for k, v := range requestParam {
|
||||
task.Config = strings.ReplaceAll(task.Config, "${"+k+"}", fmt.Sprintf("%v", v))
|
||||
}
|
||||
|
@ -447,18 +325,14 @@ func (r *AiRouterBiz) handleApiTask(ctx context.Context, requireData *entitys.Re
|
|||
return
|
||||
}
|
||||
if len(request.Url) == 0 {
|
||||
err = errors.NewBusinessErr(422, "api地址获取失败")
|
||||
err = errors.NewBusinessErr("00022", "api地址获取失败")
|
||||
return
|
||||
}
|
||||
res, err := request.Send()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: "",
|
||||
Content: pkg.JsonStringIgonErr(res.Text),
|
||||
Type: entitys.ResponseJson,
|
||||
}
|
||||
c.WriteMessage(1, res.Content)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -467,7 +341,7 @@ func (r *AiRouterBiz) getSessionChatHis(sessionId string) (his []model.AiChatHi,
|
|||
cond := builder.NewCond()
|
||||
cond = cond.And(builder.Eq{"session_id": sessionId})
|
||||
|
||||
_, err = r.hisImpl.GetListToStruct(&cond, &dataTemp.ReqPageBo{Limit: r.conf.Sys.SessionLen}, &his, "his_id desc")
|
||||
_, err = r.hisImpl.GetListToStruct(&cond, &dataTemp.ReqPageBo{Limit: r.conf.Sys.SessionLen}, &his, "his_id asc")
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -491,3 +365,102 @@ func (r *AiRouterBiz) getTasks(sysId int32) (tasks []model.AiTask, err error) {
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) registerTools(tasks []model.AiTask) []llms.Tool {
|
||||
taskPrompt := make([]llms.Tool, 0)
|
||||
for _, task := range tasks {
|
||||
var taskConfig entitys.TaskConfig
|
||||
err := json.Unmarshal([]byte(task.Config), &taskConfig)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
taskPrompt = append(taskPrompt, llms.Tool{
|
||||
Type: "function",
|
||||
Function: &llms.FunctionDefinition{
|
||||
Name: task.Index,
|
||||
Description: task.Desc,
|
||||
Parameters: taskConfig.Param,
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
return taskPrompt
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) getPrompt(sysInfo model.AiSy, history []model.AiChatHi, reqInput string) []entitys.Message {
|
||||
var (
|
||||
prompt = make([]entitys.Message, 0)
|
||||
)
|
||||
prompt = append(prompt, entitys.Message{
|
||||
Role: "system",
|
||||
Content: r.buildSystemPrompt(sysInfo.SysPrompt),
|
||||
}, entitys.Message{
|
||||
Role: "assistant",
|
||||
Content: pkg.JsonStringIgonErr(r.buildAssistant(history)),
|
||||
}, entitys.Message{
|
||||
Role: "user",
|
||||
Content: reqInput,
|
||||
})
|
||||
return prompt
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) getPromptLLM(sysInfo model.AiSy, history []model.AiChatHi, reqInput string, tasks []model.AiTask) []llms.MessageContent {
|
||||
var (
|
||||
prompt = make([]llms.MessageContent, 0)
|
||||
)
|
||||
prompt = append(prompt, llms.MessageContent{
|
||||
Role: llms.ChatMessageTypeSystem,
|
||||
Parts: []llms.ContentPart{
|
||||
llms.TextPart(r.buildSystemPrompt(sysInfo.SysPrompt)),
|
||||
},
|
||||
}, llms.MessageContent{
|
||||
Role: llms.ChatMessageTypeTool,
|
||||
Parts: []llms.ContentPart{
|
||||
llms.TextPart(pkg.JsonStringIgonErr(r.buildAssistant(history))),
|
||||
},
|
||||
}, llms.MessageContent{
|
||||
Role: llms.ChatMessageTypeTool,
|
||||
Parts: []llms.ContentPart{
|
||||
llms.TextPart(pkg.JsonStringIgonErr(r.registerTools(tasks))),
|
||||
},
|
||||
}, llms.MessageContent{
|
||||
Role: llms.ChatMessageTypeHuman,
|
||||
Parts: []llms.ContentPart{
|
||||
llms.TextPart(reqInput),
|
||||
},
|
||||
})
|
||||
return prompt
|
||||
}
|
||||
|
||||
// buildSystemPrompt 构建系统提示词
|
||||
func (r *AiRouterBiz) buildSystemPrompt(prompt string) string {
|
||||
if len(prompt) == 0 {
|
||||
prompt = "[system] 你是一个智能路由系统,核心职责是 **精准解析用户意图并路由至对应任务模块**\n[rule]\n1.返回以下格式的JSON:{ \"index\": \"工具索引index\", \"confidence\": 0.0-1.0,\"reasoning\": \"判断理由\"}\n2.严格返回字符串格式,禁用markdown格式返回\n3.只返回json字符串,不包含任何其他解释性文字\n4.当用户意图非常不清晰时使用,尝试进行追问具体希望查询内容"
|
||||
}
|
||||
|
||||
return prompt
|
||||
}
|
||||
|
||||
func (r *AiRouterBiz) buildAssistant(his []model.AiChatHi) (chatHis entitys.ChatHis) {
|
||||
for _, item := range his {
|
||||
if len(chatHis.SessionId) == 0 {
|
||||
chatHis.SessionId = item.SessionID
|
||||
}
|
||||
chatHis.Messages = append(chatHis.Messages, entitys.HisMessage{
|
||||
Role: item.Role,
|
||||
Content: item.Content,
|
||||
Timestamp: item.CreateAt.Format("2006-01-02 15:04:05"),
|
||||
})
|
||||
}
|
||||
chatHis.Context = entitys.HisContext{
|
||||
UserLanguage: "zh-CN",
|
||||
SystemMode: "technical_support",
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// handleKnowledgeQA 处理知识问答意图
|
||||
func (r *AiRouterBiz) handleKnowledgeQA(ctx context.Context, req *entitys.ChatRequest, messages []entitys.Message) (*entitys.ChatResponse, error) {
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ type configData struct {
|
|||
|
||||
func Test_Order(t *testing.T) {
|
||||
routerBiz := in()
|
||||
ch := make(chan entitys.Response, 5)
|
||||
ch := make(chan entitys.ResponseData, 5)
|
||||
defer close(ch)
|
||||
err := routerBiz.handleTask(ch, nil, &entitys.Match{Index: "order_diagnosis", Parameters: `{"order_number":"822895927188791297"}`}, &model.AiTask{Config: `{"tool": "zltxOrderDetail", "param": {"type": "object", "optional": [], "required": ["order_number"], "properties": {"order_number": {"type": "string", "description": "订单编号/流水号"}}}}`})
|
||||
select {
|
||||
|
@ -47,7 +47,7 @@ func Test_Order(t *testing.T) {
|
|||
|
||||
func Test_OrderLog(t *testing.T) {
|
||||
routerBiz := in()
|
||||
ch := make(chan entitys.Response, 5)
|
||||
ch := make(chan entitys.ResponseData, 5)
|
||||
defer close(ch)
|
||||
err := routerBiz.handleTask(ch, nil, &entitys.Match{Index: "order_diagnosis", Parameters: `{"order_number":"822979421673758721","serial_number":"822979421979938817"}`}, &model.AiTask{Config: `{"tool": "zltxOrderDirectLog", "param": {"type": "object", "optional": [], "required": ["order_number"], "properties": {"order_number": {"type": "string", "description": "订单编号/流水号"}}}}`})
|
||||
t.Log(err)
|
||||
|
@ -55,17 +55,9 @@ func Test_OrderLog(t *testing.T) {
|
|||
|
||||
func Test_ProductLog(t *testing.T) {
|
||||
routerBiz := in()
|
||||
ch := make(chan entitys.Response, 5)
|
||||
ch := make(chan entitys.ResponseData, 5)
|
||||
defer close(ch)
|
||||
err := routerBiz.handleTask(ch, nil, &entitys.Match{Index: "order_diagnosis", Parameters: `{"name":"利楚测试"}`}, &model.AiTask{Config: `{"tool": "zltxProduct", "param": {"type": "object", "optional": [], "required": ["order_number"], "properties": {"order_number": {"type": "string", "description": "订单编号/流水号"}}}}`})
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
func Test_ZltxStatistics(t *testing.T) {
|
||||
routerBiz := in()
|
||||
ch := make(chan entitys.Response, 5)
|
||||
defer close(ch)
|
||||
err := routerBiz.handleTask(ch, nil, &entitys.Match{Index: "order_diagnosis", Parameters: `{"number":"13737882067"}`}, &model.AiTask{Config: `{"tool": "zltxOrderStatistics", "param": {"type": "object", "optional": [], "required": ["number"], "properties": {"number": {"type": "string", "description": "充值账号/分销商ID"}}}}`})
|
||||
err := routerBiz.handleTask(ch, nil, &entitys.Match{Index: "order_diagnosis", Parameters: `{"id":"101","serial_number":"822979421979938817"}`}, &model.AiTask{Config: `{"tool": "zltxProduct", "param": {"type": "object", "optional": [], "required": ["order_number"], "properties": {"order_number": {"type": "string", "description": "订单编号/流水号"}}}}`})
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
|
@ -93,7 +85,7 @@ func in() *AiRouterBiz {
|
|||
taskImpl := impl.NewTaskImpl(db)
|
||||
chatImpl := impl.NewChatImpl(db)
|
||||
safeChannelPool, _ := pkg.NewSafeChannelPool(configConfig)
|
||||
routerBiz := NewAiRouterBiz(manager, sessionImpl, sysImpl, taskImpl, chatImpl, configConfig, utilOllama, safeChannelPool, client)
|
||||
routerBiz := NewAiRouterBiz(manager, sessionImpl, sysImpl, taskImpl, chatImpl, configConfig, utilOllama, safeChannelPool)
|
||||
|
||||
return routerBiz
|
||||
}
|
||||
|
|
|
@ -2,14 +2,13 @@ package biz
|
|||
|
||||
import (
|
||||
"ai_scheduler/internal/data/constants"
|
||||
errorcode "ai_scheduler/internal/data/error"
|
||||
"ai_scheduler/internal/data/impl"
|
||||
"ai_scheduler/internal/data/model"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"fmt"
|
||||
"github.com/gofiber/fiber/v2/utils"
|
||||
"time"
|
||||
|
||||
"ai_scheduler/internal/config"
|
||||
)
|
||||
|
@ -22,11 +21,10 @@ type SessionBiz struct {
|
|||
conf *config.Config
|
||||
}
|
||||
|
||||
func NewSessionBiz(conf *config.Config, sessionImpl *impl.SessionImpl, sysImpl *impl.SysImpl, chatImpl *impl.ChatImpl) *SessionBiz {
|
||||
func NewSessionBiz(conf *config.Config, sessionImpl *impl.SessionImpl, sysImpl *impl.SysImpl) *SessionBiz {
|
||||
return &SessionBiz{
|
||||
sessionRepo: sessionImpl,
|
||||
sysRepo: sysImpl,
|
||||
chatRepo: chatImpl,
|
||||
conf: conf,
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +37,7 @@ func (s *SessionBiz) SessionInit(ctx context.Context, req *entitys.SessionInitRe
|
|||
if err != nil {
|
||||
return
|
||||
} else if !has {
|
||||
err = errorcode.SysNotFound
|
||||
err = fmt.Errorf("sys not found")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -62,7 +60,6 @@ func (s *SessionBiz) SessionInit(ctx context.Context, req *entitys.SessionInitRe
|
|||
SysID: sysConfig.SysID,
|
||||
SessionID: utils.UUID(),
|
||||
UserID: req.UserId,
|
||||
UserName: req.UserName,
|
||||
}
|
||||
err = s.sessionRepo.Create(&session)
|
||||
if err != nil {
|
||||
|
@ -75,8 +72,6 @@ func (s *SessionBiz) SessionInit(ctx context.Context, req *entitys.SessionInitRe
|
|||
Content: sysConfig.Prologue,
|
||||
}
|
||||
result.Chat = append(result.Chat, chat)
|
||||
result.SessionId = session.SessionID
|
||||
result.Prologue = sysConfig.Prologue
|
||||
|
||||
// 开场白写入会话历史
|
||||
s.chatRepo.AsyncCreate(ctx, model.AiChatHi{
|
||||
|
@ -86,8 +81,6 @@ func (s *SessionBiz) SessionInit(ctx context.Context, req *entitys.SessionInitRe
|
|||
})
|
||||
|
||||
} else {
|
||||
result.SessionId = session.SessionID
|
||||
result.Prologue = sysConfig.Prologue
|
||||
// 存在,返回会话历史
|
||||
var chatList []model.AiChatHi
|
||||
chatList, err = s.chatRepo.FindAll(
|
||||
|
@ -105,7 +98,6 @@ func (s *SessionBiz) SessionInit(ctx context.Context, req *entitys.SessionInitRe
|
|||
SessionID: chat.SessionID,
|
||||
Role: constants.Caller(chat.Role),
|
||||
Content: chat.Content,
|
||||
Prologue: sysConfig.Prologue,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ type SysConfig struct {
|
|||
SessionLen int `mapstructure:"session_len"`
|
||||
ChannelPoolLen int `mapstructure:"channel_pool_len"`
|
||||
ChannelPoolSize int `mapstructure:"channel_pool_size"`
|
||||
LlmPoolLen int `mapstructure:"llm_pool_len"`
|
||||
}
|
||||
|
||||
// ServerConfig 服务器配置
|
||||
|
@ -39,10 +38,9 @@ type ServerConfig struct {
|
|||
|
||||
// OllamaConfig Ollama配置
|
||||
type OllamaConfig struct {
|
||||
BaseURL string `mapstructure:"base_url"`
|
||||
Model string `mapstructure:"model"`
|
||||
GenerateModel string `mapstructure:"generate_model"`
|
||||
Timeout time.Duration `mapstructure:"timeout"`
|
||||
BaseURL string `mapstructure:"base_url"`
|
||||
Model string `mapstructure:"model"`
|
||||
Timeout time.Duration `mapstructure:"timeout"`
|
||||
}
|
||||
|
||||
type Redis struct {
|
||||
|
|
|
@ -1,34 +1,32 @@
|
|||
package errorcode
|
||||
|
||||
import "fmt"
|
||||
|
||||
var (
|
||||
Success = &BusinessErr{code: 200, message: "成功"}
|
||||
ParamError = &BusinessErr{code: 401, message: "参数错误"}
|
||||
NotFoundError = &BusinessErr{code: 404, message: "请求地址未找到"}
|
||||
SystemError = &BusinessErr{code: 405, message: "系统错误"}
|
||||
Success = &BusinessErr{code: "0000", message: "成功"}
|
||||
ParamError = &BusinessErr{code: "0001", message: "参数错误"}
|
||||
NotFoundError = &BusinessErr{code: "0004", message: "请求地址未找到"}
|
||||
SystemError = &BusinessErr{code: "0005", message: "系统错误"}
|
||||
|
||||
ClientNotFound = &BusinessErr{code: 406, message: "未找到client_id"}
|
||||
SessionNotFound = &BusinessErr{code: 407, message: "未找到会话信息"}
|
||||
AuthNotFound = &BusinessErr{code: 408, message: "身份验证失败"}
|
||||
KeyNotFound = &BusinessErr{code: 409, message: "身份验证失败"}
|
||||
SysNotFound = &BusinessErr{code: 410, message: "未找到系统信息"}
|
||||
InvalidParam = &BusinessErr{code: InvalidParamCode, message: "无效参数"}
|
||||
SupplierNotFound = &BusinessErr{code: "0006", message: "供应商不存在"}
|
||||
SessionNotFound = &BusinessErr{code: "0007", message: "未找到会话信息"}
|
||||
AuthNotFound = &BusinessErr{code: "0008", message: "身份验证失败"}
|
||||
KeyNotFound = &BusinessErr{code: "0009", message: "身份验证失败"}
|
||||
SysNotFound = &BusinessErr{code: "0010", message: "未找到系统信息"}
|
||||
InvalidParam = &BusinessErr{code: InvalidParamCode, message: "无效参数"}
|
||||
)
|
||||
|
||||
const (
|
||||
InvalidParamCode = 408
|
||||
InvalidParamCode = "0008"
|
||||
)
|
||||
|
||||
type BusinessErr struct {
|
||||
code int
|
||||
code string
|
||||
message string
|
||||
}
|
||||
|
||||
func (e *BusinessErr) Error() string {
|
||||
return e.message
|
||||
}
|
||||
func (e *BusinessErr) Code() int {
|
||||
func (e *BusinessErr) Code() string {
|
||||
return e.code
|
||||
}
|
||||
|
||||
|
@ -38,18 +36,10 @@ func (e *BusinessErr) Is(target error) bool {
|
|||
}
|
||||
|
||||
// CustomErr 自定义错误
|
||||
func NewBusinessErr(code int, message string) *BusinessErr {
|
||||
func NewBusinessErr(code string, message string) *BusinessErr {
|
||||
return &BusinessErr{code: code, message: message}
|
||||
}
|
||||
|
||||
func SysErr(message string, arg ...any) *BusinessErr {
|
||||
return &BusinessErr{code: SystemError.code, message: fmt.Sprintf(message, arg)}
|
||||
}
|
||||
|
||||
func ParamErr(message string, arg ...any) *BusinessErr {
|
||||
return &BusinessErr{code: ParamError.code, message: fmt.Sprintf(message, arg)}
|
||||
}
|
||||
|
||||
func (e *BusinessErr) Wrap(err error) *BusinessErr {
|
||||
return NewBusinessErr(e.code, err.Error())
|
||||
}
|
||||
|
|
|
@ -9,13 +9,13 @@ import (
|
|||
|
||||
type SysImpl struct {
|
||||
dataTemp.DataTemp
|
||||
BaseRepository[model.AiSy]
|
||||
BaseModel[model.AiSy]
|
||||
}
|
||||
|
||||
func NewSysImpl(db *utils.Db) *SysImpl {
|
||||
return &SysImpl{
|
||||
DataTemp: *dataTemp.NewDataTemp(db, new(model.AiSy)),
|
||||
BaseRepository: NewBaseModel[model.AiSy](db.Client),
|
||||
DataTemp: *dataTemp.NewDataTemp(db, new(model.AiSy)),
|
||||
BaseModel: BaseModel[model.AiSy]{},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@ type AiSession struct {
|
|||
UpdateAt *time.Time `gorm:"column:update_at;default:CURRENT_TIMESTAMP" json:"update_at"`
|
||||
Status int32 `gorm:"column:status;not null" json:"status"`
|
||||
DeleteAt *time.Time `gorm:"column:delete_at" json:"delete_at"`
|
||||
UserID string `gorm:"column:user_id;comment:用户id" json:"user_id"` // 用户id
|
||||
UserName string `gorm:"column:user_name;comment:用户名称" json:"user_name"` // 用户id
|
||||
UserID string `gorm:"column:user_id;comment:用户id" json:"user_id"` // 用户id
|
||||
}
|
||||
|
||||
// TableName AiSession's table name
|
||||
|
|
|
@ -8,5 +8,4 @@ type ChatHistory struct {
|
|||
SessionID string `json:"session_id"`
|
||||
Role constants.Caller `json:"role"`
|
||||
Content string `json:"content"`
|
||||
Prologue string `json:"prologue"`
|
||||
}
|
||||
|
|
|
@ -6,34 +6,27 @@ import (
|
|||
"github.com/gofiber/websocket/v2"
|
||||
)
|
||||
|
||||
type ResponseType string
|
||||
type Response string
|
||||
|
||||
const (
|
||||
ResponseJson ResponseType = "json"
|
||||
ResponseLoading ResponseType = "loading"
|
||||
ResponseEnd ResponseType = "end"
|
||||
ResponseStream ResponseType = "stream"
|
||||
ResponseText ResponseType = "txt"
|
||||
ResponseImg ResponseType = "img"
|
||||
ResponseFile ResponseType = "file"
|
||||
ResponseErr ResponseType = "error"
|
||||
ResponseLog ResponseType = "log"
|
||||
ResponseAuth ResponseType = "auth"
|
||||
ResponseJson Response = "json"
|
||||
ResponseLoading Response = "loading"
|
||||
ResponseEnd Response = "end"
|
||||
ResponseStream Response = "stream"
|
||||
ResponseText Response = "txt"
|
||||
ResponseImg Response = "img"
|
||||
ResponseFile Response = "file"
|
||||
ResponseErr Response = "error"
|
||||
ResponseLog Response = "log"
|
||||
)
|
||||
|
||||
type ResponseData struct {
|
||||
Done bool
|
||||
Content string
|
||||
Type ResponseType
|
||||
Type Response
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
Content string
|
||||
Type ResponseType
|
||||
Index string
|
||||
}
|
||||
|
||||
func MsgSet(msgType ResponseType, msg string, done bool) []byte {
|
||||
func MsgSet(msgType Response, msg string, done bool) []byte {
|
||||
jsonByte, err := json.Marshal(ResponseData{
|
||||
Done: done,
|
||||
Content: msg,
|
||||
|
@ -46,12 +39,9 @@ func MsgSet(msgType ResponseType, msg string, done bool) []byte {
|
|||
return jsonByte
|
||||
}
|
||||
|
||||
func MsgSend(c *websocket.Conn, msg Response) error {
|
||||
// 检查上下文是否已取消
|
||||
if msg.Type == ResponseText {
|
||||
|
||||
}
|
||||
func MsgSend(c *websocket.Conn, msg ResponseData) error {
|
||||
jsonByte, _ := json.Marshal(msg)
|
||||
|
||||
return c.WriteMessage(websocket.TextMessage, jsonByte)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
package entitys
|
||||
|
||||
type SessionInitRequest struct {
|
||||
SysId string `json:"sys_id"`
|
||||
UserId string `json:"user_id"`
|
||||
UserName string `json:"user_name"`
|
||||
SysId string `json:"sys_id"`
|
||||
UserId string `json:"user_id"`
|
||||
}
|
||||
|
||||
type SessionInitResponse struct {
|
||||
SessionId string `json:"session_id"`
|
||||
Chat []ChatHistory `json:"chat"`
|
||||
Prologue string `json:"prologue"`
|
||||
Chat []ChatHistory `json:"chat"`
|
||||
}
|
||||
|
||||
type SessionListRequest struct {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package entitys
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/data/model"
|
||||
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
|
@ -22,12 +20,6 @@ type ChatRequestMeta struct {
|
|||
Authorization string `json:"authorization"`
|
||||
}
|
||||
|
||||
type FirstSockRequest struct {
|
||||
Authorization string `json:"authorization"`
|
||||
SessionID string `json:"session_id"`
|
||||
AppKey string `json:"app_key"`
|
||||
}
|
||||
|
||||
type ChatSockRequest struct {
|
||||
Text string `json:"text" binding:"required"`
|
||||
Img string `json:"img" binding:"required"`
|
||||
|
@ -75,7 +67,7 @@ type Tool interface {
|
|||
Name() string
|
||||
Description() string
|
||||
Definition() ToolDefinition
|
||||
Execute(ctx context.Context, requireData *RequireData) error
|
||||
Execute(channel chan ResponseData, c *websocket.Conn, args json.RawMessage) error
|
||||
}
|
||||
|
||||
type ConfigDataHttp struct {
|
||||
|
@ -113,15 +105,11 @@ type ConfigParam struct {
|
|||
Type string `json:"type"`
|
||||
}
|
||||
type Match struct {
|
||||
Confidence any `json:"confidence"`
|
||||
Confidence string `json:"confidence"`
|
||||
Index string `json:"index"`
|
||||
IsMatch bool `json:"is_match"`
|
||||
Parameters string `json:"parameters"`
|
||||
Reasoning string `json:"reasoning"`
|
||||
History []byte `json:"history"`
|
||||
UserInput string `json:"user_input"`
|
||||
Auth string `json:"auth"`
|
||||
Chat string `json:"chat"`
|
||||
}
|
||||
type ChatHis struct {
|
||||
SessionId string `json:"session_id"`
|
||||
|
@ -139,28 +127,8 @@ type HisContext struct {
|
|||
SystemMode string `json:"system_mode"`
|
||||
}
|
||||
|
||||
type RequireData struct {
|
||||
Session string
|
||||
Key string
|
||||
Sys model.AiSy
|
||||
Histories []model.AiChatHi
|
||||
SessionInfo model.AiSession
|
||||
Tasks []model.AiTask
|
||||
Match *Match
|
||||
UserInput string
|
||||
Auth string
|
||||
Ch chan Response
|
||||
KnowledgeConf KnowledgeBaseRequest
|
||||
ImgByte []api.ImageData
|
||||
}
|
||||
|
||||
type KnowledgeBaseRequest struct {
|
||||
Session string // 知识库会话id
|
||||
ApiKey string // 知识库apiKey
|
||||
Query string // 用户输入
|
||||
}
|
||||
|
||||
// RouterService 路由服务接口
|
||||
type RouterService interface {
|
||||
Route(ctx context.Context, req *ChatRequest) (*ChatResponse, error)
|
||||
RouteWithSocket(c *websocket.Conn, req *ChatSockRequest) error
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package pkg
|
|||
import (
|
||||
"ai_scheduler/internal/config"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"errors"
|
||||
"sync"
|
||||
)
|
||||
|
||||
|
@ -24,29 +25,29 @@ func NewSafeChannelPool(c *config.Config) (*SafeChannelPool, func()) {
|
|||
}
|
||||
|
||||
// 从池中获取 channel(若无空闲则创建新 channel)
|
||||
func (p *SafeChannelPool) Get() chan entitys.ResponseData {
|
||||
func (p *SafeChannelPool) Get() (chan entitys.ResponseData, error) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
||||
if p.closed {
|
||||
return make(chan entitys.ResponseData, p.bufSize)
|
||||
return nil, errors.New("pool is closed")
|
||||
}
|
||||
|
||||
select {
|
||||
case ch := <-p.pool: // 从池中取
|
||||
return ch
|
||||
return ch, nil
|
||||
default: // 池为空,创建新 channel
|
||||
return make(chan entitys.ResponseData, p.bufSize)
|
||||
return make(chan entitys.ResponseData, p.bufSize), nil
|
||||
}
|
||||
}
|
||||
|
||||
// 将 channel 放回池中(必须确保 channel 已清空!)
|
||||
func (p *SafeChannelPool) Put(ch chan entitys.ResponseData) {
|
||||
func (p *SafeChannelPool) Put(ch chan entitys.ResponseData) error {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
||||
if p.closed {
|
||||
return
|
||||
return errors.New("pool is closed")
|
||||
}
|
||||
|
||||
// 清空 channel(防止复用时读取旧数据)
|
||||
|
@ -61,7 +62,7 @@ func (p *SafeChannelPool) Put(ch chan entitys.ResponseData) {
|
|||
default: // 池已满,直接关闭 channel(避免泄漏)
|
||||
close(ch)
|
||||
}
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
// 关闭池(释放所有资源)
|
||||
|
|
|
@ -1,57 +1,8 @@
|
|||
package pkg
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/entitys"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
import "encoding/json"
|
||||
|
||||
func JsonStringIgonErr(data interface{}) string {
|
||||
return string(JsonByteIgonErr(data))
|
||||
}
|
||||
|
||||
func JsonByteIgonErr(data interface{}) []byte {
|
||||
dataByte, _ := json.Marshal(data)
|
||||
return dataByte
|
||||
}
|
||||
|
||||
// IsChannelClosed 检查给定的 channel 是否已经关闭
|
||||
// 参数 ch: 要检查的 channel,类型为 chan entitys.ResponseData
|
||||
// 返回值: bool 类型,true 表示 channel 已关闭,false 表示未关闭
|
||||
func IsChannelClosed(ch chan entitys.ResponseData) bool {
|
||||
select {
|
||||
case _, ok := <-ch: // 尝试从 channel 中读取数据
|
||||
return !ok // 如果 ok=false,说明 channel 已关闭
|
||||
default: // 如果 channel 暂时无数据可读(但不一定关闭)
|
||||
return false // channel 未关闭(但可能有数据未读取)
|
||||
}
|
||||
}
|
||||
|
||||
// ValidateImageURL 验证图片 URL 是否有效
|
||||
func ValidateImageURL(rawURL string) error {
|
||||
// 1. 基础格式验证
|
||||
parsed, err := url.Parse(rawURL)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid URL format: %v", err)
|
||||
}
|
||||
|
||||
// 2. 检查协议是否为 http/https
|
||||
if parsed.Scheme != "http" && parsed.Scheme != "https" {
|
||||
return errors.New("URL must use http or https protocol")
|
||||
}
|
||||
|
||||
// 3. 检查是否有空的主机名
|
||||
if parsed.Host == "" {
|
||||
return errors.New("URL missing host")
|
||||
}
|
||||
|
||||
// 4. 检查路径是否为空(可选)
|
||||
if strings.TrimSpace(parsed.Path) == "" {
|
||||
return errors.New("URL path is empty")
|
||||
}
|
||||
|
||||
return nil
|
||||
return string(dataByte)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package pkg
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/pkg/utils_langchain"
|
||||
"ai_scheduler/internal/pkg/utils_ollama"
|
||||
|
||||
"github.com/google/wire"
|
||||
|
@ -10,7 +9,7 @@ import (
|
|||
var ProviderSetClient = wire.NewSet(
|
||||
NewRdb,
|
||||
NewGormDb,
|
||||
utils_langchain.NewUtilLangChain,
|
||||
utils_ollama.NewUtilOllama,
|
||||
utils_ollama.NewClient,
|
||||
NewSafeChannelPool,
|
||||
)
|
||||
|
|
|
@ -1,129 +0,0 @@
|
|||
package utils_langchain
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/config"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gofiber/fiber/v2/log"
|
||||
"github.com/tmc/langchaingo/llms/ollama"
|
||||
)
|
||||
|
||||
type UtilLangChain struct {
|
||||
LlmClientPool *sync.Pool
|
||||
poolSize int // 记录池大小,用于调试
|
||||
model string
|
||||
serverURL string
|
||||
c *config.Config
|
||||
}
|
||||
|
||||
type LlmObj struct {
|
||||
Number string
|
||||
Llm *ollama.LLM
|
||||
}
|
||||
|
||||
func NewUtilLangChain(c *config.Config, logger log.AllLogger) *UtilLangChain {
|
||||
poolSize := c.Sys.LlmPoolLen
|
||||
if poolSize <= 0 {
|
||||
poolSize = 10 // 默认值
|
||||
logger.Warnf("LlmPoolLen not set, using default: %d", poolSize)
|
||||
}
|
||||
|
||||
// 初始化 Pool
|
||||
pool := &sync.Pool{
|
||||
New: func() interface{} {
|
||||
llm, err := ollama.New(
|
||||
ollama.WithModel(c.Ollama.Model),
|
||||
ollama.WithHTTPClient(http.DefaultClient),
|
||||
ollama.WithServerURL(getUrl(c)),
|
||||
ollama.WithKeepAlive("-1s"),
|
||||
)
|
||||
if err != nil {
|
||||
logger.Fatalf("Failed to create Ollama client: %v", err)
|
||||
panic(err) // 或者返回 nil + 错误处理
|
||||
}
|
||||
number := randStr(5)
|
||||
log.Info(number)
|
||||
return &LlmObj{
|
||||
Number: number,
|
||||
Llm: llm,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// 预填充 Pool
|
||||
for i := 0; i < poolSize; i++ {
|
||||
pool.Put(pool.New())
|
||||
}
|
||||
|
||||
return &UtilLangChain{
|
||||
LlmClientPool: pool,
|
||||
poolSize: poolSize,
|
||||
model: c.Ollama.Model,
|
||||
serverURL: getUrl(c),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (o *UtilLangChain) NewClient() *ollama.LLM {
|
||||
llm, _ := ollama.New(
|
||||
ollama.WithModel(o.c.Ollama.Model),
|
||||
ollama.WithHTTPClient(&http.Client{
|
||||
Transport: &http.Transport{
|
||||
MaxIdleConns: 100, // 最大空闲连接数(默认 2,太小)
|
||||
MaxIdleConnsPerHost: 100, // 每个 Host 的最大空闲连接数(默认 2)
|
||||
IdleConnTimeout: 90 * time.Second, // 空闲连接超时时间
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second, // 连接超时
|
||||
KeepAlive: 30 * time.Second, // TCP Keep-Alive
|
||||
}).DialContext,
|
||||
},
|
||||
Timeout: 60 * time.Second, // 整体请求超时(避免无限等待)
|
||||
}),
|
||||
ollama.WithServerURL(getUrl(o.c)),
|
||||
ollama.WithKeepAlive("-1s"),
|
||||
)
|
||||
return llm
|
||||
}
|
||||
|
||||
// Get 返回一个可用的 LLM 客户端
|
||||
func (o *UtilLangChain) Get() *LlmObj {
|
||||
client := o.LlmClientPool.Get().(*LlmObj)
|
||||
return client
|
||||
}
|
||||
|
||||
// Put 归还客户端(可选:检查是否仍可用)
|
||||
func (o *UtilLangChain) Put(llm *LlmObj) {
|
||||
if llm == nil {
|
||||
return
|
||||
}
|
||||
o.LlmClientPool.Put(llm)
|
||||
}
|
||||
|
||||
// Stats 返回池的统计信息(用于监控)
|
||||
func (o *UtilLangChain) Stats() (current, max int) {
|
||||
return o.poolSize, o.poolSize
|
||||
}
|
||||
|
||||
func getUrl(c *config.Config) string {
|
||||
baseURL := c.Ollama.BaseURL
|
||||
envURL := os.Getenv("OLLAMA_BASE_URL")
|
||||
if envURL != "" {
|
||||
baseURL = envURL
|
||||
}
|
||||
return baseURL
|
||||
}
|
||||
|
||||
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
|
||||
func randStr(n int) string {
|
||||
b := make([]rune, n)
|
||||
for i := range b {
|
||||
b[i] = letters[rand.Intn(len(letters))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
|
@ -45,9 +45,10 @@ func (c *Client) ToolSelect(ctx context.Context, messages []api.Message, tools [
|
|||
Model: c.config.Model,
|
||||
Messages: messages,
|
||||
Stream: new(bool), // 设置为false,不使用流式响应
|
||||
Think: &api.ThinkValue{Value: false},
|
||||
Think: &api.ThinkValue{Value: true},
|
||||
Tools: tools,
|
||||
}
|
||||
|
||||
err = c.client.Chat(ctx, req, func(resp api.ChatResponse) error {
|
||||
res = resp
|
||||
return nil
|
||||
|
@ -59,13 +60,10 @@ func (c *Client) ToolSelect(ctx context.Context, messages []api.Message, tools [
|
|||
return
|
||||
}
|
||||
|
||||
func (c *Client) ChatStream(ctx context.Context, ch chan entitys.Response, messages []api.Message, index string, model string) (err error) {
|
||||
if len(model) == 0 {
|
||||
model = c.config.Model
|
||||
}
|
||||
func (c *Client) ChatStream(ctx context.Context, ch chan entitys.ResponseData, messages []api.Message) (err error) {
|
||||
// 构建聊天请求
|
||||
req := &api.ChatRequest{
|
||||
Model: model,
|
||||
Model: c.config.Model,
|
||||
Messages: messages,
|
||||
Stream: nil,
|
||||
Think: &api.ThinkValue{Value: true},
|
||||
|
@ -76,8 +74,8 @@ func (c *Client) ChatStream(ctx context.Context, ch chan entitys.Response, messa
|
|||
defer w.Done()
|
||||
err = c.client.Chat(ctx, req, func(resp api.ChatResponse) error {
|
||||
if resp.Message.Content != "" {
|
||||
ch <- entitys.Response{
|
||||
Index: index,
|
||||
ch <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: resp.Message.Content,
|
||||
Type: entitys.ResponseStream,
|
||||
}
|
||||
|
@ -93,14 +91,6 @@ func (c *Client) ChatStream(ctx context.Context, ch chan entitys.Response, messa
|
|||
return
|
||||
}
|
||||
|
||||
func (c *Client) Generation(ctx context.Context, generateRequest *api.GenerateRequest) (result api.GenerateResponse, err error) {
|
||||
err = c.client.Generate(ctx, generateRequest, func(resp api.GenerateResponse) error {
|
||||
result = resp
|
||||
return nil
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// convertResponse 转换响应格式
|
||||
func (c *Client) convertResponse(resp *api.ChatResponse) *entitys.ChatResponse {
|
||||
//result := &entitys.ChatResponse{
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package utils_ollama
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/config"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/gofiber/fiber/v2/log"
|
||||
"github.com/tmc/langchaingo/llms/ollama"
|
||||
)
|
||||
|
||||
type UtilOllama struct {
|
||||
Llm *ollama.LLM
|
||||
}
|
||||
|
||||
func NewUtilOllama(c *config.Config, logger log.AllLogger) *UtilOllama {
|
||||
llm, err := ollama.New(
|
||||
ollama.WithModel(c.Ollama.Model),
|
||||
ollama.WithHTTPClient(http.DefaultClient),
|
||||
ollama.WithServerURL(getUrl(c)),
|
||||
ollama.WithKeepAlive("-1s"),
|
||||
)
|
||||
if err != nil {
|
||||
logger.Fatal(err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return &UtilOllama{
|
||||
Llm: llm,
|
||||
}
|
||||
}
|
||||
|
||||
//func (o *UtilOllama) a() {
|
||||
// var agent agents.Agent
|
||||
// agent = agents.NewOneShotAgent(llm, tools, opts...)
|
||||
//
|
||||
// agents.NewExecutor()
|
||||
//}
|
||||
|
||||
func getUrl(c *config.Config) string {
|
||||
baseURL := c.Ollama.BaseURL
|
||||
envURL := os.Getenv("OLLAMA_BASE_URL")
|
||||
if envURL != "" {
|
||||
baseURL = envURL
|
||||
}
|
||||
return baseURL
|
||||
}
|
|
@ -2,8 +2,6 @@ package services
|
|||
|
||||
import (
|
||||
errorcode "ai_scheduler/internal/data/error"
|
||||
"net/http"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/log"
|
||||
)
|
||||
|
@ -20,16 +18,16 @@ func handRes(c *fiber.Ctx, _err error, rsp interface{}) error {
|
|||
err = e
|
||||
} else {
|
||||
log.Error(c.UserContext(), "系统错误 error: ", _err)
|
||||
err = errorcode.NewBusinessErr(http.StatusInternalServerError, _err.Error())
|
||||
err = errorcode.NewBusinessErr("500", _err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
body := fiber.Map{
|
||||
"code": err.Code(),
|
||||
"code": err.Code,
|
||||
"msg": err.Error(),
|
||||
"data": rsp,
|
||||
}
|
||||
|
||||
log.Info(c.UserContext(), c.Path(), "请求参数=", string(c.BodyRaw()), "响应=", body)
|
||||
log.Info(c.UserContext(), c.Path(), "请求参数=", c.BodyRaw(), "响应=", body)
|
||||
return c.JSON(body)
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ func (h *ChatService) Chat(c *websocket.Conn) {
|
|||
h.Gw.AddClient(client)
|
||||
log.Println("client connected:", clientID)
|
||||
log.Println("客户端已连接")
|
||||
|
||||
// 循环读取客户端消息
|
||||
for {
|
||||
messageType, message, err := c.ReadMessage()
|
||||
|
@ -82,7 +81,12 @@ func (h *ChatService) Chat(c *websocket.Conn) {
|
|||
log.Println("读取错误:", err)
|
||||
break
|
||||
}
|
||||
|
||||
//简单协议:bind:<uid>
|
||||
if c.Headers("Sec-Websocket-Protocol") == "bind" && c.Headers("X-Session") != "" {
|
||||
uid := c.Headers("X-Session")
|
||||
_ = h.Gw.BindUid(clientID, uid)
|
||||
log.Printf("bind %s -> uid:%s\n", clientID, uid)
|
||||
}
|
||||
msg, chatType := h.handleMessageToString(c, messageType, message)
|
||||
if chatType == constants.ConnStatusClosed {
|
||||
break
|
||||
|
@ -97,26 +101,11 @@ func (h *ChatService) Chat(c *websocket.Conn) {
|
|||
log.Println("JSON parse error:", err)
|
||||
continue
|
||||
}
|
||||
|
||||
//简单协议:bind:<uid>
|
||||
if c.Headers("Sec-Websocket-Protocol") == "bind" && req.SessionID != "" {
|
||||
uid := c.Query("x-session")
|
||||
_ = h.Gw.BindUid(clientID, req.SessionID)
|
||||
log.Printf("bind %s -> uid:%s\n", clientID, uid)
|
||||
}
|
||||
|
||||
err = h.routerBiz.RouteWithSocket(c, &req)
|
||||
if err != nil {
|
||||
log.Println("处理失败:", err)
|
||||
entitys.MsgSend(c, entitys.Response{
|
||||
Content: err.Error(),
|
||||
Type: entitys.ResponseText,
|
||||
})
|
||||
continue
|
||||
}
|
||||
_ = entitys.MsgSend(c, entitys.Response{
|
||||
Content: "",
|
||||
Type: entitys.ResponseEnd,
|
||||
})
|
||||
}
|
||||
h.Gw.RemoveClient(clientID)
|
||||
_ = c.Close()
|
||||
|
|
|
@ -27,11 +27,7 @@ func (s *SessionService) SessionInit(c *fiber.Ctx) error {
|
|||
|
||||
result, err := s.sessionBiz.SessionInit(c.Context(), req)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.JSON(result)
|
||||
return handRes(c, err, result)
|
||||
}
|
||||
|
||||
// SessionList 获取会话列表
|
||||
|
@ -43,11 +39,7 @@ func (s *SessionService) SessionList(c *fiber.Ctx) error {
|
|||
|
||||
sessionList, err := s.sessionBiz.SessionList(c.Context(), req)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.JSON(fiber.Map{
|
||||
return handRes(c, err, fiber.Map{
|
||||
"session_list": sessionList,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import (
|
|||
"ai_scheduler/internal/entitys"
|
||||
"ai_scheduler/internal/pkg/l_request"
|
||||
"bufio"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/gofiber/websocket/v2"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
@ -58,10 +58,21 @@ func (k *KnowledgeBaseTool) Definition() entitys.ToolDefinition {
|
|||
}
|
||||
|
||||
// Execute 执行知识库查询
|
||||
func (k *KnowledgeBaseTool) Execute(ctx context.Context, requireData *entitys.RequireData) error {
|
||||
func (k *KnowledgeBaseTool) Execute(channel chan entitys.ResponseData, c *websocket.Conn, args json.RawMessage) error {
|
||||
|
||||
return k.chat(requireData)
|
||||
var params KnowledgeBaseRequest
|
||||
if err := json.Unmarshal(args, ¶ms); err != nil {
|
||||
return fmt.Errorf("unmarshal args failed: %w", err)
|
||||
}
|
||||
|
||||
return k.chat(channel, c, params)
|
||||
|
||||
}
|
||||
|
||||
type KnowledgeBaseRequest struct {
|
||||
Session string // 知识库会话id
|
||||
ApiKey string // 知识库apiKey
|
||||
Query string // 用户输入
|
||||
}
|
||||
|
||||
// Message 表示解析后的 SSE 消息
|
||||
|
@ -71,7 +82,7 @@ type Message struct {
|
|||
ID string // 消息 ID(可选)
|
||||
}
|
||||
|
||||
type MsgContent struct {
|
||||
type MegContent struct {
|
||||
Id string `json:"id"`
|
||||
ResponseType string `json:"response_type"`
|
||||
Content string `json:"content"`
|
||||
|
@ -79,37 +90,21 @@ type MsgContent struct {
|
|||
KnowledgeReferences interface{} `json:"knowledge_references"`
|
||||
}
|
||||
|
||||
// 解析知识库响应内容,并把通过channel结果返回
|
||||
func (this *KnowledgeBaseTool) msgContentParse(input string, channel chan entitys.Response) (msgContent MsgContent, err error) {
|
||||
err = json.Unmarshal([]byte(input), &msgContent)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("unmarshal input failed: %w", err)
|
||||
}
|
||||
|
||||
channel <- entitys.Response{
|
||||
Index: this.Name(),
|
||||
Content: msgContent.Content,
|
||||
Type: entitys.ResponseStream,
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 请求知识库聊天
|
||||
func (this *KnowledgeBaseTool) chat(requireData *entitys.RequireData) (err error) {
|
||||
func (this *KnowledgeBaseTool) chat(channel chan entitys.ResponseData, c *websocket.Conn, param KnowledgeBaseRequest) (err error) {
|
||||
|
||||
req := l_request.Request{
|
||||
Method: "post",
|
||||
Url: this.config.BaseURL + "/api/v1/knowledge-chat/" + requireData.KnowledgeConf.Session,
|
||||
Url: this.config.BaseURL + "/api/v1/knowledge-chat/" + param.Session,
|
||||
Params: nil,
|
||||
Headers: map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"X-API-Key": requireData.KnowledgeConf.ApiKey,
|
||||
"X-API-Key": param.ApiKey,
|
||||
},
|
||||
Cookies: nil,
|
||||
Data: nil,
|
||||
Json: map[string]interface{}{
|
||||
"query": requireData.KnowledgeConf.Query,
|
||||
"query": param.Query,
|
||||
},
|
||||
Files: nil,
|
||||
Raw: "",
|
||||
|
@ -123,7 +118,7 @@ func (this *KnowledgeBaseTool) chat(requireData *entitys.RequireData) (err error
|
|||
}
|
||||
defer rsp.Body.Close()
|
||||
|
||||
err = this.connectAndReadSSE(rsp, requireData.Ch)
|
||||
err = connectAndReadSSE(rsp, channel)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -132,7 +127,7 @@ func (this *KnowledgeBaseTool) chat(requireData *entitys.RequireData) (err error
|
|||
}
|
||||
|
||||
// 连接 SSE 并读取数据
|
||||
func (this *KnowledgeBaseTool) connectAndReadSSE(resp *http.Response, channel chan entitys.Response) error {
|
||||
func connectAndReadSSE(resp *http.Response, channel chan entitys.ResponseData) error {
|
||||
|
||||
// 验证响应状态和格式
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
|
@ -152,9 +147,10 @@ func (this *KnowledgeBaseTool) connectAndReadSSE(resp *http.Response, channel ch
|
|||
if line == "" {
|
||||
// 空行表示一条消息结束,处理当前消息
|
||||
if currentMsg.Data != "" || currentMsg.Event != "" || currentMsg.ID != "" {
|
||||
_, err := this.msgContentParse(currentMsg.Data, channel)
|
||||
if err != nil {
|
||||
return fmt.Errorf("msgContentParse failed: %w", err)
|
||||
channel <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: currentMsg.Data,
|
||||
Type: entitys.ResponseJson,
|
||||
}
|
||||
currentMsg = Message{} // 重置消息
|
||||
}
|
||||
|
@ -187,9 +183,10 @@ func (this *KnowledgeBaseTool) connectAndReadSSE(resp *http.Response, channel ch
|
|||
|
||||
// 处理最后一条未结束的消息(无结尾空行)
|
||||
if currentMsg.Data != "" || currentMsg.Event != "" || currentMsg.ID != "" {
|
||||
_, err := this.msgContentParse(currentMsg.Data, channel)
|
||||
if err != nil {
|
||||
return fmt.Errorf("msgContentParse failed: %w", err)
|
||||
channel <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: currentMsg.Data,
|
||||
Type: entitys.ResponseJson,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,11 @@ import (
|
|||
"ai_scheduler/internal/data/constants"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"ai_scheduler/internal/pkg/utils_ollama"
|
||||
"context"
|
||||
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/gofiber/websocket/v2"
|
||||
)
|
||||
|
||||
// Manager 工具管理器
|
||||
|
@ -69,11 +71,6 @@ func NewManager(config *config.Config, llm *utils_ollama.Client) *Manager {
|
|||
knowledgeTool := NewKnowledgeBaseTool(config.Tools.Knowledge)
|
||||
m.tools[knowledgeTool.Name()] = knowledgeTool
|
||||
}
|
||||
|
||||
// 普通对话
|
||||
chat := NewNormalChatTool(m.llm, config)
|
||||
m.tools[chat.Name()] = chat
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
|
@ -103,13 +100,13 @@ func (m *Manager) GetToolDefinitions(caller constants.Caller) []entitys.ToolDefi
|
|||
}
|
||||
|
||||
// ExecuteTool 执行工具
|
||||
func (m *Manager) ExecuteTool(ctx context.Context, name string, requireData *entitys.RequireData) error {
|
||||
func (m *Manager) ExecuteTool(channel chan entitys.ResponseData, c *websocket.Conn, name string, args json.RawMessage) error {
|
||||
tool, exists := m.GetTool(name)
|
||||
if !exists {
|
||||
return fmt.Errorf("tool not found: %s", name)
|
||||
}
|
||||
|
||||
return tool.Execute(ctx, requireData)
|
||||
return tool.Execute(channel, c, args)
|
||||
}
|
||||
|
||||
// ExecuteToolCalls 执行多个工具调用
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
package tools
|
||||
|
||||
import (
|
||||
"ai_scheduler/internal/config"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"ai_scheduler/internal/pkg"
|
||||
"ai_scheduler/internal/pkg/utils_ollama"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/ollama/ollama/api"
|
||||
)
|
||||
|
||||
// NormalChatTool 普通对话
|
||||
type NormalChatTool struct {
|
||||
llm *utils_ollama.Client
|
||||
config *config.Config
|
||||
}
|
||||
|
||||
// NewNormalChatTool 实例普通对话
|
||||
func NewNormalChatTool(llm *utils_ollama.Client, config *config.Config) *NormalChatTool {
|
||||
return &NormalChatTool{llm: llm, config: config}
|
||||
}
|
||||
|
||||
// Name 返回工具名称
|
||||
func (w *NormalChatTool) Name() string {
|
||||
return "normalChat"
|
||||
}
|
||||
|
||||
// Description 返回工具描述
|
||||
func (w *NormalChatTool) Description() string {
|
||||
return "用户想进行一般性问答"
|
||||
}
|
||||
|
||||
type NormalChat struct {
|
||||
ChatContent string `json:"chat_content"`
|
||||
}
|
||||
|
||||
// Definition 返回工具定义
|
||||
func (w *NormalChatTool) Definition() entitys.ToolDefinition {
|
||||
return entitys.ToolDefinition{}
|
||||
}
|
||||
|
||||
// Execute 执行直连天下订单详情查询
|
||||
func (w *NormalChatTool) Execute(ctx context.Context, requireData *entitys.RequireData) error {
|
||||
var req NormalChat
|
||||
if err := json.Unmarshal([]byte(requireData.Match.Parameters), &req); err != nil {
|
||||
return fmt.Errorf("invalid zltxOrderDetail request: %w", err)
|
||||
}
|
||||
if req.ChatContent == "" {
|
||||
req.ChatContent = "介绍一下你能做什么"
|
||||
}
|
||||
|
||||
// 这里可以集成真实的直连天下订单详情API
|
||||
return w.chat(requireData, &req)
|
||||
}
|
||||
|
||||
// getMockZltxOrderDetail 获取模拟直连天下订单详情数据
|
||||
func (w *NormalChatTool) chat(requireData *entitys.RequireData, chat *NormalChat) (err error) {
|
||||
//requireData.Ch <- entitys.Response{
|
||||
// Index: w.Name(),
|
||||
// Content: "<think></think>",
|
||||
// Type: entitys.ResponseStream,
|
||||
//}
|
||||
|
||||
err = w.llm.ChatStream(context.TODO(), requireData.Ch, []api.Message{
|
||||
{
|
||||
Role: "system",
|
||||
Content: "你是一个聊天助手",
|
||||
},
|
||||
{
|
||||
Role: "assistant",
|
||||
Content: fmt.Sprintf("聊天记录:%s", pkg.JsonStringIgonErr(requireData.Histories)),
|
||||
},
|
||||
{
|
||||
Role: "user",
|
||||
Content: chat.ChatContent,
|
||||
},
|
||||
}, w.Name(), w.config.Ollama.GenerateModel)
|
||||
if err != nil {
|
||||
return fmt.Errorf(":%s", err)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
|
@ -3,13 +3,13 @@ package tools
|
|||
import (
|
||||
"ai_scheduler/internal/config"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"ai_scheduler/internal/pkg"
|
||||
"ai_scheduler/internal/pkg/utils_ollama"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"gitea.cdlsxd.cn/self-tools/l_request"
|
||||
"github.com/gofiber/websocket/v2"
|
||||
"github.com/ollama/ollama/api"
|
||||
)
|
||||
|
||||
|
@ -81,62 +81,70 @@ type ZltxOrderDetailData struct {
|
|||
}
|
||||
|
||||
// Execute 执行直连天下订单详情查询
|
||||
func (w *ZltxOrderDetailTool) Execute(ctx context.Context, requireData *entitys.RequireData) error {
|
||||
func (w *ZltxOrderDetailTool) Execute(channel chan entitys.ResponseData, c *websocket.Conn, args json.RawMessage) error {
|
||||
var req ZltxOrderDetailRequest
|
||||
if err := json.Unmarshal([]byte(requireData.Match.Parameters), &req); err != nil {
|
||||
if err := json.Unmarshal(args, &req); err != nil {
|
||||
return fmt.Errorf("invalid zltxOrderDetail request: %w", err)
|
||||
}
|
||||
|
||||
if req.OrderNumber == "" {
|
||||
return fmt.Errorf("number is required")
|
||||
}
|
||||
|
||||
// 这里可以集成真实的直连天下订单详情API
|
||||
return w.getZltxOrderDetail(requireData, req.OrderNumber)
|
||||
return w.getZltxOrderDetail(channel, c, req.OrderNumber)
|
||||
}
|
||||
|
||||
// getMockZltxOrderDetail 获取模拟直连天下订单详情数据
|
||||
func (w *ZltxOrderDetailTool) getZltxOrderDetail(requireData *entitys.RequireData, number string) (err error) {
|
||||
func (w *ZltxOrderDetailTool) getZltxOrderDetail(ch chan entitys.ResponseData, c *websocket.Conn, number string) (err error) {
|
||||
//查询订单详情
|
||||
var auth string
|
||||
if c != nil {
|
||||
auth = c.Headers("X-Authorization", "")
|
||||
}
|
||||
if len(auth) == 0 {
|
||||
auth = w.config.APIKey
|
||||
}
|
||||
req := l_request.Request{
|
||||
Url: fmt.Sprintf(w.config.BaseURL, number),
|
||||
Url: fmt.Sprintf("%szltx_api/admin/direct/ai/%s", w.config.BaseURL, number),
|
||||
Headers: map[string]string{
|
||||
"Authorization": fmt.Sprintf("Bearer %s", requireData.Auth),
|
||||
"Authorization": fmt.Sprintf("Bearer %s", auth),
|
||||
},
|
||||
Method: "GET",
|
||||
}
|
||||
res, err := req.Send()
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("订单查询失败:网络请求错误:%s", err.Error())
|
||||
return fmt.Errorf("订单查询失败:%s", err.Error())
|
||||
}
|
||||
var codeMap map[string]interface{}
|
||||
if err = json.Unmarshal(res.Content, &codeMap); err != nil {
|
||||
return
|
||||
}
|
||||
if codeMap["code"].(float64) != 200 {
|
||||
return fmt.Errorf("订单查询失败:状态码错误:%s", string(res.Content))
|
||||
return fmt.Errorf("订单查询失败:%s", res.Text)
|
||||
}
|
||||
|
||||
var resData ZltxOrderDetailResponse
|
||||
if err = json.Unmarshal(res.Content, &resData); err != nil {
|
||||
return
|
||||
}
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: w.Name(),
|
||||
ch <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: res.Text,
|
||||
Type: entitys.ResponseJson,
|
||||
}
|
||||
if resData.Data.Direct != nil && resData.Data.Direct["needAi"].(bool) {
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: w.Name(),
|
||||
ch <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: "正在分析订单日志",
|
||||
Type: entitys.ResponseLoading,
|
||||
}
|
||||
|
||||
req = l_request.Request{
|
||||
Url: fmt.Sprintf(w.config.AddURL, resData.Data.Direct["orderOrderNumber"].(string), resData.Data.Direct["serialNumber"].(string)),
|
||||
Url: fmt.Sprintf("%szltx_api/admin/direct/log/%s/%s", w.config.BaseURL, resData.Data.Direct["orderOrderNumber"].(string), resData.Data.Direct["serialNumber"].(string)),
|
||||
Headers: map[string]string{
|
||||
"Authorization": fmt.Sprintf("Bearer %s", requireData.Auth),
|
||||
"Authorization": fmt.Sprintf("Bearer %s", auth),
|
||||
},
|
||||
Method: "GET",
|
||||
}
|
||||
|
@ -156,34 +164,20 @@ func (w *ZltxOrderDetailTool) getZltxOrderDetail(requireData *entitys.RequireDat
|
|||
return fmt.Errorf("订单日志解析失败:%s", err)
|
||||
}
|
||||
|
||||
err = w.llm.ChatStream(context.TODO(), requireData.Ch, []api.Message{
|
||||
err = w.llm.ChatStream(context.TODO(), ch, []api.Message{
|
||||
{
|
||||
Role: "system",
|
||||
Content: "你是一个订单日志助手。用户可能会提供订单日志,你需要分析订单日志,提取出订单失败的原因。",
|
||||
},
|
||||
{
|
||||
Role: "assistant",
|
||||
Content: fmt.Sprintf("聊天记录:%s", pkg.JsonStringIgonErr(requireData.Histories)),
|
||||
},
|
||||
{
|
||||
Role: "assistant",
|
||||
Content: fmt.Sprintf("需要分析的订单日志:%s", string(dataJson)),
|
||||
},
|
||||
{
|
||||
Role: "user",
|
||||
Content: requireData.UserInput,
|
||||
Content: fmt.Sprintf("订单日志:%s", string(dataJson)),
|
||||
},
|
||||
}, w.Name(), "")
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("订单日志解析失败:%s", err)
|
||||
}
|
||||
}
|
||||
if resData.Data.Direct == nil {
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: w.Name(),
|
||||
Content: "该订单无充值流水记录,不需要进行订单错误分析,建议检查订单收单模式以及扣款方式等原因😘",
|
||||
Type: entitys.ResponseText,
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@ package tools
|
|||
import (
|
||||
"ai_scheduler/internal/config"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"gitea.cdlsxd.cn/self-tools/l_request"
|
||||
"github.com/gofiber/websocket/v2"
|
||||
)
|
||||
|
||||
type ZltxOrderLogTool struct {
|
||||
|
@ -67,25 +67,31 @@ type ZltxOrderDirectLogData struct {
|
|||
Data map[string]interface{} `json:"data"`
|
||||
}
|
||||
|
||||
func (t *ZltxOrderLogTool) Execute(ctx context.Context, requireData *entitys.RequireData) error {
|
||||
func (t *ZltxOrderLogTool) Execute(channel chan entitys.ResponseData, c *websocket.Conn, args json.RawMessage) error {
|
||||
var req ZltxOrderLogRequest
|
||||
if err := json.Unmarshal([]byte(requireData.Match.Parameters), &req); err != nil {
|
||||
if err := json.Unmarshal(args, &req); err != nil {
|
||||
return fmt.Errorf("invalid zltxOrderLog request: %w", err)
|
||||
}
|
||||
if req.OrderNumber == "" || req.SerialNumber == "" {
|
||||
return fmt.Errorf("orderNumber and serialNumber is required")
|
||||
}
|
||||
return t.getZltxOrderLog(req.OrderNumber, req.SerialNumber, requireData)
|
||||
return t.getZltxOrderLog(channel, c, req.OrderNumber, req.SerialNumber)
|
||||
}
|
||||
|
||||
func (t *ZltxOrderLogTool) getZltxOrderLog(orderNumber, serialNumber string, requireData *entitys.RequireData) (err error) {
|
||||
func (t *ZltxOrderLogTool) getZltxOrderLog(channel chan entitys.ResponseData, c *websocket.Conn, orderNumber, serialNumber string) (err error) {
|
||||
//查询订单详情
|
||||
|
||||
var auth string
|
||||
if c != nil {
|
||||
auth = c.Headers("X-Authorization", "")
|
||||
}
|
||||
if len(auth) == 0 {
|
||||
auth = t.config.APIKey
|
||||
}
|
||||
url := fmt.Sprintf("%s%s/%s", t.config.BaseURL, orderNumber, serialNumber)
|
||||
req := l_request.Request{
|
||||
Url: url,
|
||||
Headers: map[string]string{
|
||||
"Authorization": fmt.Sprintf("Bearer %s", requireData.Auth),
|
||||
"Authorization": fmt.Sprintf("Bearer %s", auth),
|
||||
},
|
||||
Method: "GET",
|
||||
}
|
||||
|
@ -95,15 +101,20 @@ func (t *ZltxOrderLogTool) getZltxOrderLog(orderNumber, serialNumber string, req
|
|||
return
|
||||
}
|
||||
if resData.Code != 200 {
|
||||
return fmt.Errorf("订单查询失败:日志查询失败:%s", resData.Error)
|
||||
return fmt.Errorf("订单查询失败:%s", resData.Error)
|
||||
}
|
||||
if err = json.Unmarshal(res.Content, &resData); err != nil {
|
||||
return
|
||||
}
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: t.Name(),
|
||||
Content: res.Text,
|
||||
Type: entitys.ResponseJson,
|
||||
if c != nil {
|
||||
_ = c.WriteMessage(websocket.TextMessage, res.Content)
|
||||
return
|
||||
} else {
|
||||
channel <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: res.Text,
|
||||
Type: entitys.ResponseJson,
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -3,13 +3,12 @@ package tools
|
|||
import (
|
||||
"ai_scheduler/internal/config"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"gitea.cdlsxd.cn/self-tools/l_request"
|
||||
"github.com/gofiber/websocket/v2"
|
||||
)
|
||||
|
||||
type ZltxProductTool struct {
|
||||
|
@ -53,12 +52,12 @@ type ZltxProductRequest struct {
|
|||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func (z ZltxProductTool) Execute(ctx context.Context, requireData *entitys.RequireData) error {
|
||||
func (z ZltxProductTool) Execute(channel chan entitys.ResponseData, c *websocket.Conn, args json.RawMessage) error {
|
||||
var req ZltxProductRequest
|
||||
if err := json.Unmarshal([]byte(requireData.Match.Parameters), &req); err != nil {
|
||||
if err := json.Unmarshal(args, &req); err != nil {
|
||||
return fmt.Errorf("invalid zltxProduct request: %w", err)
|
||||
}
|
||||
return z.getZltxProduct(&req, requireData)
|
||||
return z.getZltxProduct(channel, c, req.Id, req.Name)
|
||||
}
|
||||
|
||||
type ZltxProductResponse struct {
|
||||
|
@ -133,16 +132,22 @@ type ZltxProductData struct {
|
|||
PlatformProductList interface{} `json:"platform_product_list"`
|
||||
}
|
||||
|
||||
func (z ZltxProductTool) getZltxProduct(body *ZltxProductRequest, requireData *entitys.RequireData) error {
|
||||
|
||||
func (z ZltxProductTool) getZltxProduct(channel chan entitys.ResponseData, c *websocket.Conn, id string, name string) error {
|
||||
var auth string
|
||||
if c != nil {
|
||||
auth = c.Headers("X-Authorization", "")
|
||||
}
|
||||
if len(auth) == 0 {
|
||||
auth = z.config.APIKey
|
||||
}
|
||||
var Url string
|
||||
var params map[string]string
|
||||
if body.Id != "" {
|
||||
Url = fmt.Sprintf("%s/%s", z.config.BaseURL, body.Id)
|
||||
if id != "" {
|
||||
Url = fmt.Sprintf("%s/%s", z.config.BaseURL, id)
|
||||
} else {
|
||||
Url = fmt.Sprintf("%s?keyword=%s&limit=10&page=1", z.config.BaseURL, body.Name)
|
||||
Url = fmt.Sprintf("%s?keyword=%s&limit=10&page=1", z.config.BaseURL, name)
|
||||
params = map[string]string{
|
||||
"keyword": body.Name,
|
||||
"keyword": name,
|
||||
"limit": "10",
|
||||
"page": "1",
|
||||
}
|
||||
|
@ -153,7 +158,7 @@ func (z ZltxProductTool) getZltxProduct(body *ZltxProductRequest, requireData *e
|
|||
//根据商品ID或名称走不同的接口查询
|
||||
Url: Url,
|
||||
Headers: map[string]string{
|
||||
"Authorization": fmt.Sprintf("Bearer %s", requireData.Auth),
|
||||
"Authorization": fmt.Sprintf("Bearer %s", auth),
|
||||
},
|
||||
Params: params,
|
||||
Method: "GET",
|
||||
|
@ -163,20 +168,17 @@ func (z ZltxProductTool) getZltxProduct(body *ZltxProductRequest, requireData *e
|
|||
return err
|
||||
}
|
||||
var resp ZltxProductResponse
|
||||
if err = json.Unmarshal(res.Content, &resp); err != nil {
|
||||
if err := json.Unmarshal(res.Content, &resp); err != nil {
|
||||
return fmt.Errorf("解析商品数据失败:%w", err)
|
||||
}
|
||||
if resp.Code != 200 {
|
||||
return fmt.Errorf("商品查询失败:%s", string(res.Content))
|
||||
return fmt.Errorf("商品查询失败:%s", resp.Error)
|
||||
}
|
||||
if resp.Data.List == nil || len(resp.Data.List) == 0 {
|
||||
var respData ZltxProductDataById
|
||||
if err := json.Unmarshal(res.Content, &respData); err != nil {
|
||||
return fmt.Errorf("解析商品数据失败:%w", err)
|
||||
}
|
||||
if respData.Data.ID == 0 {
|
||||
return fmt.Errorf("商品查询失败:暂无数据")
|
||||
}
|
||||
resp.Data.List = []ZltxProductData{respData.Data}
|
||||
resp.Data.DataCount = 1
|
||||
}
|
||||
|
@ -185,7 +187,7 @@ func (z ZltxProductTool) getZltxProduct(body *ZltxProductRequest, requireData *e
|
|||
for i := range resp.Data.List {
|
||||
// 调用 平台商品列表
|
||||
if resp.Data.List[i].AuthProductIds != "" {
|
||||
platformProductList := z.ExecutePlatformProductList(requireData.Auth, resp.Data.List[i].AuthProductIds, resp.Data.List[i].OfficialProductID)
|
||||
platformProductList := z.ExecutePlatformProductList(auth, resp.Data.List[i].AuthProductIds)
|
||||
resp.Data.List[i].PlatformProductList = platformProductList
|
||||
}
|
||||
}
|
||||
|
@ -194,102 +196,28 @@ func (z ZltxProductTool) getZltxProduct(body *ZltxProductRequest, requireData *e
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: z.Name(),
|
||||
channel <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: string(marshal),
|
||||
Type: entitys.ResponseJson,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PlatformProductResponse struct {
|
||||
Code int `json:"code"`
|
||||
Data []struct {
|
||||
ID int `json:"id"`
|
||||
PlatformID int `json:"platform_id"`
|
||||
OfficialProductID int `json:"official_product_id"`
|
||||
Weight int `json:"weight"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Discount string `json:"discount"`
|
||||
Price string `json:"price"`
|
||||
Extra string `json:"extra"`
|
||||
AccountType []string `json:"account_type"`
|
||||
Status int `json:"status"`
|
||||
CreateTime string `json:"create_time"`
|
||||
UpdateTime string `json:"update_time"`
|
||||
RebatePrice string `json:"rebate_price"`
|
||||
ExchangeType int `json:"exchange_type"`
|
||||
IsReportInfo int `json:"is_report_info"`
|
||||
Describe string `json:"describe"`
|
||||
PlatformAliasID int `json:"platform_alias_id"`
|
||||
Platform struct {
|
||||
ID int `json:"id"`
|
||||
Tag string `json:"tag"`
|
||||
Name string `json:"name"`
|
||||
Status int `json:"status"`
|
||||
Weight int `json:"weight"`
|
||||
UpdateTime string `json:"update_time"`
|
||||
SearchTime string `json:"search_time"`
|
||||
Balance string `json:"balance"`
|
||||
BalanceWarning string `json:"balance_warning"`
|
||||
StockType int `json:"stock_type"`
|
||||
IsIndependent int `json:"is_independent"`
|
||||
IndependentDeadline string `json:"independent_deadline"`
|
||||
CreateTime string `json:"create_time"`
|
||||
} `json:"platform"`
|
||||
} `json:"data"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
type PlatformData struct {
|
||||
ID int `json:"id"`
|
||||
PlatformID int `json:"platform_id"`
|
||||
OfficialProductID int `json:"official_product_id"`
|
||||
Weight int `json:"weight"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Discount string `json:"discount"`
|
||||
Price string `json:"price"`
|
||||
Extra string `json:"extra"`
|
||||
AccountType []string `json:"account_type"`
|
||||
Status int `json:"status"`
|
||||
CreateTime string `json:"create_time"`
|
||||
UpdateTime string `json:"update_time"`
|
||||
RebatePrice string `json:"rebate_price"`
|
||||
ExchangeType int `json:"exchange_type"`
|
||||
IsReportInfo int `json:"is_report_info"`
|
||||
Describe string `json:"describe"`
|
||||
PlatformAliasID int `json:"platform_alias_id"`
|
||||
Platform struct {
|
||||
ID int `json:"id"`
|
||||
Tag string `json:"tag"`
|
||||
Name string `json:"name"`
|
||||
Status int `json:"status"`
|
||||
Weight int `json:"weight"`
|
||||
UpdateTime string `json:"update_time"`
|
||||
SearchTime string `json:"search_time"`
|
||||
Balance string `json:"balance"`
|
||||
BalanceWarning string `json:"balance_warning"`
|
||||
StockType int `json:"stock_type"`
|
||||
IsIndependent int `json:"is_independent"`
|
||||
IndependentDeadline string `json:"independent_deadline"`
|
||||
CreateTime string `json:"create_time"`
|
||||
} `json:"platform"`
|
||||
}
|
||||
|
||||
func (z ZltxProductTool) ExecutePlatformProductList(auth string, authProductIds string, officialProductID int) []PlatformData {
|
||||
func (z ZltxProductTool) ExecutePlatformProductList(auth string, authProductIds string) []map[string]any {
|
||||
if authProductIds == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
//authProductIds 以逗号分割
|
||||
authProductIdList := strings.Split(authProductIds, ",")
|
||||
var result []map[string]any
|
||||
|
||||
for _, authProductId := range authProductIdList {
|
||||
var platformProductResponse PlatformProductResponse
|
||||
var platformProductResponse map[string]any
|
||||
req := l_request.Request{
|
||||
//https://gateway.dev.cdlsxd.cn/zltx_api/admin/platformProduct/getProductsByOfficialProductId?official_product_id=282&is_all=true
|
||||
Url: fmt.Sprintf("%s?official_product_id=%d&is_all=true", z.config.AddURL, officialProductID),
|
||||
//https://gateway.dev.cdlsxd.cn/zltx_api/admin/platformProduct/{product_id}?id={product_id}
|
||||
Url: fmt.Sprintf("%s/%s?id=%s", z.config.AddURL, authProductId, authProductId),
|
||||
Headers: map[string]string{
|
||||
"Authorization": fmt.Sprintf("Bearer %s", auth),
|
||||
},
|
||||
|
@ -306,19 +234,16 @@ func (z ZltxProductTool) ExecutePlatformProductList(auth string, authProductIds
|
|||
// 可以考虑记录日志而不是直接跳过
|
||||
continue
|
||||
}
|
||||
authProductIdInt, err := strconv.Atoi(authProductId)
|
||||
if err != nil {
|
||||
// 可以考虑记录日志而不是直接跳过
|
||||
continue
|
||||
}
|
||||
for _, platformProduct := range platformProductResponse.Data {
|
||||
if platformProduct.ID == authProductIdInt {
|
||||
return []PlatformData{platformProduct}
|
||||
|
||||
// 只提取 data 部分
|
||||
if data, ok := platformProductResponse["data"]; ok {
|
||||
if dataMap, ok := data.(map[string]any); ok {
|
||||
result = append(result, dataMap)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
return result
|
||||
}
|
||||
|
||||
type ZltxProductPlatformProductList struct {
|
||||
|
|
|
@ -3,12 +3,11 @@ package tools
|
|||
import (
|
||||
"ai_scheduler/internal/config"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"gitea.cdlsxd.cn/self-tools/l_request"
|
||||
"github.com/gofiber/websocket/v2"
|
||||
)
|
||||
|
||||
type ZltxOrderStatisticsTool struct {
|
||||
|
@ -47,24 +46,21 @@ type ZltxOrderStatisticsRequest struct {
|
|||
Number string `json:"number"`
|
||||
}
|
||||
|
||||
func (z ZltxOrderStatisticsTool) Execute(ctx context.Context, requireData *entitys.RequireData) error {
|
||||
func (z ZltxOrderStatisticsTool) Execute(channel chan entitys.ResponseData, c *websocket.Conn, args json.RawMessage) error {
|
||||
var req ZltxOrderStatisticsRequest
|
||||
if err := json.Unmarshal([]byte(requireData.Match.Parameters), &req); err != nil {
|
||||
if err := json.Unmarshal(args, &req); err != nil {
|
||||
return err
|
||||
}
|
||||
if req.Number == "" {
|
||||
return fmt.Errorf("number is required")
|
||||
}
|
||||
return z.getZltxOrderStatistics(req.Number, requireData)
|
||||
return z.getZltxOrderStatistics(channel, c, req.Number)
|
||||
}
|
||||
|
||||
type ZltxOrderStatisticsResponse struct {
|
||||
Code int `json:"code"`
|
||||
Data struct {
|
||||
RecentThreeDays []ZltxOrderStatisticsData `json:"recentThreeDays"`
|
||||
RecentOneMonth []ZltxOrderStatisticsData `json:"recentOneMonth"`
|
||||
} `json:"data"`
|
||||
Error string `json:"error"`
|
||||
Code int `json:"code"`
|
||||
Data []ZltxOrderStatisticsData `json:"data"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
type ZltxOrderStatisticsData struct {
|
||||
|
@ -75,14 +71,20 @@ type ZltxOrderStatisticsData struct {
|
|||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
func (z ZltxOrderStatisticsTool) getZltxOrderStatistics(number string, requireData *entitys.RequireData) error {
|
||||
func (z ZltxOrderStatisticsTool) getZltxOrderStatistics(channel chan entitys.ResponseData, c *websocket.Conn, number string) error {
|
||||
//查询订单详情
|
||||
|
||||
var auth string
|
||||
if c != nil {
|
||||
auth = c.Headers("X-Authorization", "")
|
||||
}
|
||||
if len(auth) == 0 {
|
||||
auth = z.config.APIKey
|
||||
}
|
||||
url := fmt.Sprintf("%s%s", z.config.BaseURL, number)
|
||||
req := l_request.Request{
|
||||
Url: url,
|
||||
Headers: map[string]string{
|
||||
"Authorization": fmt.Sprintf("Bearer %s", requireData.Auth),
|
||||
"Authorization": fmt.Sprintf("Bearer %s", auth),
|
||||
},
|
||||
Method: "GET",
|
||||
}
|
||||
|
@ -95,23 +97,17 @@ func (z ZltxOrderStatisticsTool) getZltxOrderStatistics(number string, requireDa
|
|||
return err
|
||||
}
|
||||
if resData.Code != 200 {
|
||||
return fmt.Errorf("为获取到数据,请检查权限: %s", string(res.Content))
|
||||
return fmt.Errorf("zltx order statistics error: %s", resData.Error)
|
||||
}
|
||||
//按照日期排序
|
||||
sort.Slice(resData.Data.RecentThreeDays, func(i, j int) bool {
|
||||
return resData.Data.RecentThreeDays[i].Date < resData.Data.RecentThreeDays[j].Date
|
||||
})
|
||||
sort.Slice(resData.Data.RecentOneMonth, func(i, j int) bool {
|
||||
return resData.Data.RecentOneMonth[i].Date < resData.Data.RecentOneMonth[j].Date
|
||||
})
|
||||
jsonByte, err := json.Marshal(resData)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
requireData.Ch <- entitys.Response{
|
||||
Index: z.Name(),
|
||||
Content: string(jsonByte),
|
||||
Type: entitys.ResponseJson,
|
||||
if c != nil {
|
||||
_ = c.WriteMessage(websocket.TextMessage, res.Content)
|
||||
return nil
|
||||
} else {
|
||||
channel <- entitys.ResponseData{
|
||||
Done: false,
|
||||
Content: res.Text,
|
||||
Type: entitys.ResponseJson,
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue