[+]删除链路追踪,修改项目名称
This commit is contained in:
parent
17f4830954
commit
d8d40997b8
|
@ -11,7 +11,7 @@
|
||||||
<a href="https://chatbot.weixin.qq.com" target="_blank">
|
<a href="https://chatbot.weixin.qq.com" target="_blank">
|
||||||
<img alt="微信对话开放平台" src="https://img.shields.io/badge/微信对话开放平台-5ac725">
|
<img alt="微信对话开放平台" src="https://img.shields.io/badge/微信对话开放平台-5ac725">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/Tencent/WeKnora/blob/main/LICENSE">
|
<a href="https://knowlege-lsxd/blob/main/LICENSE">
|
||||||
<img src="https://img.shields.io/badge/License-MIT-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="License">
|
<img src="https://img.shields.io/badge/License-MIT-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="License">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -93,7 +93,7 @@ WeKnora 采用现代化模块化设计,构建了一条完整的文档理解与
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 克隆主仓库
|
# 克隆主仓库
|
||||||
git clone https://github.com/Tencent/WeKnora.git
|
git clone https://knowlege-lsxd.git
|
||||||
cd WeKnora
|
cd WeKnora
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ make clean-db
|
||||||
|
|
||||||
## 🤝 贡献指南
|
## 🤝 贡献指南
|
||||||
|
|
||||||
我们欢迎社区用户参与贡献!如有建议、Bug 或新功能需求,请通过 [Issue](https://github.com/Tencent/WeKnora/issues) 提出,或直接提交 Pull Request。
|
我们欢迎社区用户参与贡献!如有建议、Bug 或新功能需求,请通过 [Issue](https://knowlege-lsxd/issues) 提出,或直接提交 Pull Request。
|
||||||
|
|
||||||
### 🎯 贡献方式
|
### 🎯 贡献方式
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<a href="https://chatbot.weixin.qq.com" target="_blank">
|
<a href="https://chatbot.weixin.qq.com" target="_blank">
|
||||||
<img alt="微信对话开放平台" src="https://img.shields.io/badge/微信对话开放平台-5ac725">
|
<img alt="微信对话开放平台" src="https://img.shields.io/badge/微信对话开放平台-5ac725">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/Tencent/WeKnora/blob/main/LICENSE">
|
<a href="https://knowlege-lsxd/blob/main/LICENSE">
|
||||||
<img src="https://img.shields.io/badge/License-MIT-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="License">
|
<img src="https://img.shields.io/badge/License-MIT-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="License">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -93,7 +93,7 @@ Make sure the following tools are installed on your system:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone the main repository
|
# Clone the main repository
|
||||||
git clone https://github.com/Tencent/WeKnora.git
|
git clone https://knowlege-lsxd.git
|
||||||
cd WeKnora
|
cd WeKnora
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ make clean-db
|
||||||
|
|
||||||
## 🤝 Contributing
|
## 🤝 Contributing
|
||||||
|
|
||||||
We welcome community contributions! For suggestions, bugs, or feature requests, please submit an [Issue](https://github.com/Tencent/WeKnora/issues) or directly create a Pull Request.
|
We welcome community contributions! For suggestions, bugs, or feature requests, please submit an [Issue](https://knowlege-lsxd/issues) or directly create a Pull Request.
|
||||||
|
|
||||||
### 🎯 How to Contribute
|
### 🎯 How to Contribute
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
```go
|
```go
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/Tencent/WeKnora/internal/client"
|
"knowlege-lsxd/internal/client"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ The client includes the following main functional modules:
|
||||||
```go
|
```go
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/Tencent/WeKnora/internal/client"
|
"knowlege-lsxd/internal/client"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module github.com/Tencent/WeKnora/client
|
module knowlege-lsxd/client
|
||||||
|
|
||||||
go 1.24.2
|
go 1.24.2
|
||||||
|
|
|
@ -14,11 +14,11 @@ import (
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
"knowlege-lsxd/internal/config"
|
||||||
"github.com/Tencent/WeKnora/internal/container"
|
"knowlege-lsxd/internal/container"
|
||||||
"github.com/Tencent/WeKnora/internal/runtime"
|
"knowlege-lsxd/internal/runtime"
|
||||||
"github.com/Tencent/WeKnora/internal/tracing"
|
"knowlege-lsxd/internal/tracing"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -0,0 +1,198 @@
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: wechatopenai/weknora-app:latest
|
||||||
|
container_name: WeKnora-app
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
volumes:
|
||||||
|
- data-files:/data/files
|
||||||
|
- ./config:/app/config
|
||||||
|
environment:
|
||||||
|
- GIN_MODE=${GIN_MODE}
|
||||||
|
- DB_DRIVER=postgres
|
||||||
|
- DB_HOST=postgres
|
||||||
|
- DB_PORT=5432
|
||||||
|
- DB_USER=${DB_USER}
|
||||||
|
- DB_PASSWORD=${DB_PASSWORD}
|
||||||
|
- DB_NAME=${DB_NAME}
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
- OTEL_EXPORTER_OTLP_ENDPOINT=jaeger:4317
|
||||||
|
- OTEL_SERVICE_NAME=WeKnora
|
||||||
|
- OTEL_TRACES_EXPORTER=otlp
|
||||||
|
- OTEL_METRICS_EXPORTER=none
|
||||||
|
- OTEL_LOGS_EXPORTER=none
|
||||||
|
- OTEL_PROPAGATORS=tracecontext,baggage
|
||||||
|
- RETRIEVE_DRIVER=${RETRIEVE_DRIVER}
|
||||||
|
- ELASTICSEARCH_ADDR=${ELASTICSEARCH_ADDR}
|
||||||
|
- ELASTICSEARCH_USERNAME=${ELASTICSEARCH_USERNAME}
|
||||||
|
- ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_PASSWORD}
|
||||||
|
- ELASTICSEARCH_INDEX=${ELASTICSEARCH_INDEX}
|
||||||
|
- DOCREADER_ADDR=docreader:50051
|
||||||
|
- STORAGE_TYPE=${STORAGE_TYPE}
|
||||||
|
- LOCAL_STORAGE_BASE_DIR=${LOCAL_STORAGE_BASE_DIR}
|
||||||
|
- MINIO_ENDPOINT=minio:9000
|
||||||
|
- MINIO_ACCESS_KEY_ID=${MINIO_ACCESS_KEY_ID:-minioadmin}
|
||||||
|
- MINIO_SECRET_ACCESS_KEY=${MINIO_SECRET_ACCESS_KEY:-minioadmin}
|
||||||
|
- MINIO_BUCKET_NAME=${MINIO_BUCKET_NAME}
|
||||||
|
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://host.docker.internal:11434}
|
||||||
|
- STREAM_MANAGER_TYPE=${STREAM_MANAGER_TYPE}
|
||||||
|
- REDIS_ADDR=redis:6379
|
||||||
|
- REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||||
|
- REDIS_DB=${REDIS_DB}
|
||||||
|
- REDIS_PREFIX=${REDIS_PREFIX}
|
||||||
|
- ENABLE_GRAPH_RAG=${ENABLE_GRAPH_RAG}
|
||||||
|
- TENANT_AES_KEY=${TENANT_AES_KEY}
|
||||||
|
- CONCURRENCY_POOL_SIZE=${CONCURRENCY_POOL_SIZE:-5}
|
||||||
|
- INIT_LLM_MODEL_NAME=${INIT_LLM_MODEL_NAME}
|
||||||
|
- INIT_LLM_MODEL_BASE_URL=${INIT_LLM_MODEL_BASE_URL}
|
||||||
|
- INIT_LLM_MODEL_API_KEY=${INIT_LLM_MODEL_API_KEY}
|
||||||
|
- INIT_EMBEDDING_MODEL_NAME=${INIT_EMBEDDING_MODEL_NAME}
|
||||||
|
- INIT_EMBEDDING_MODEL_BASE_URL=${INIT_EMBEDDING_MODEL_BASE_URL}
|
||||||
|
- INIT_EMBEDDING_MODEL_API_KEY=${INIT_EMBEDDING_MODEL_API_KEY}
|
||||||
|
- INIT_EMBEDDING_MODEL_DIMENSION=${INIT_EMBEDDING_MODEL_DIMENSION}
|
||||||
|
- INIT_EMBEDDING_MODEL_ID=${INIT_EMBEDDING_MODEL_ID}
|
||||||
|
- INIT_RERANK_MODEL_NAME=${INIT_RERANK_MODEL_NAME}
|
||||||
|
- INIT_RERANK_MODEL_BASE_URL=${INIT_RERANK_MODEL_BASE_URL}
|
||||||
|
- INIT_RERANK_MODEL_API_KEY=${INIT_RERANK_MODEL_API_KEY}
|
||||||
|
depends_on:
|
||||||
|
redis:
|
||||||
|
condition: service_started
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
minio:
|
||||||
|
condition: service_started
|
||||||
|
networks:
|
||||||
|
- WeKnora-network
|
||||||
|
restart: unless-stopped
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
|
minio:
|
||||||
|
image: minio/minio:latest
|
||||||
|
container_name: WeKnora-minio
|
||||||
|
ports:
|
||||||
|
- "${MINIO_PORT:-9000}:9000"
|
||||||
|
- "${MINIO_CONSOLE_PORT:-9001}:9001"
|
||||||
|
environment:
|
||||||
|
- MINIO_ROOT_USER=${MINIO_ACCESS_KEY_ID:-minioadmin}
|
||||||
|
- MINIO_ROOT_PASSWORD=${MINIO_SECRET_ACCESS_KEY:-minioadmin}
|
||||||
|
command: server --console-address ":9001" /data
|
||||||
|
volumes:
|
||||||
|
- minio_data:/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 20s
|
||||||
|
retries: 3
|
||||||
|
networks:
|
||||||
|
- WeKnora-network
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image: wechatopenai/weknora-ui:latest
|
||||||
|
container_name: WeKnora-frontend
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
networks:
|
||||||
|
- WeKnora-network
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
docreader:
|
||||||
|
image: wechatopenai/weknora-docreader:latest
|
||||||
|
container_name: WeKnora-docreader
|
||||||
|
ports:
|
||||||
|
- "50051:50051"
|
||||||
|
environment:
|
||||||
|
- COS_SECRET_ID=${COS_SECRET_ID}
|
||||||
|
- COS_SECRET_KEY=${COS_SECRET_KEY}
|
||||||
|
- COS_REGION=${COS_REGION}
|
||||||
|
- COS_BUCKET_NAME=${COS_BUCKET_NAME}
|
||||||
|
- COS_APP_ID=${COS_APP_ID}
|
||||||
|
- COS_PATH_PREFIX=${COS_PATH_PREFIX}
|
||||||
|
- COS_ENABLE_OLD_DOMAIN=${COS_ENABLE_OLD_DOMAIN}
|
||||||
|
- VLM_MODEL_BASE_URL=${VLM_MODEL_BASE_URL}
|
||||||
|
- VLM_MODEL_NAME=${VLM_MODEL_NAME}
|
||||||
|
- VLM_MODEL_API_KEY=${VLM_MODEL_API_KEY}
|
||||||
|
- STORAGE_TYPE=${STORAGE_TYPE}
|
||||||
|
- MINIO_PUBLIC_ENDPOINT=http://localhost:${MINIO_PORT:-9000}
|
||||||
|
- MINIO_ENDPOINT=minio:9000
|
||||||
|
- MINIO_ACCESS_KEY_ID=${MINIO_ACCESS_KEY_ID:-minioadmin}
|
||||||
|
- MINIO_SECRET_ACCESS_KEY=${MINIO_SECRET_ACCESS_KEY:-minioadmin}
|
||||||
|
- MINIO_BUCKET_NAME=${MINIO_BUCKET_NAME}
|
||||||
|
- MINIO_USE_SSL=${MINIO_USE_SSL}
|
||||||
|
- WEB_PROXY=${WEB_PROXY}
|
||||||
|
networks:
|
||||||
|
- WeKnora-network
|
||||||
|
restart: unless-stopped
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
|
jaeger:
|
||||||
|
image: jaegertracing/all-in-one:latest
|
||||||
|
ports:
|
||||||
|
- "6831:6831/udp" # Jaeger Thrift接收器
|
||||||
|
- "6832:6832/udp" # Jaeger Thrift接收器(Compact)
|
||||||
|
- "5778:5778" # 配置端口
|
||||||
|
- "16686:16686" # Web UI
|
||||||
|
- "4317:4317" # OTLP gRPC接收器
|
||||||
|
- "4318:4318" # OTLP HTTP接收器
|
||||||
|
- "14250:14250" # 接收模型端口
|
||||||
|
- "14268:14268" # Jaeger HTTP接收器
|
||||||
|
- "9411:9411" # Zipkin兼容性端口
|
||||||
|
environment:
|
||||||
|
- COLLECTOR_OTLP_ENABLED=true
|
||||||
|
- COLLECTOR_ZIPKIN_HOST_PORT=:9411
|
||||||
|
volumes:
|
||||||
|
- jaeger_data:/var/lib/jaeger # 持久化 Jaeger 数据
|
||||||
|
networks:
|
||||||
|
- WeKnora-network
|
||||||
|
restart: unless-stopped
|
||||||
|
# 修改的PostgreSQL配置
|
||||||
|
postgres:
|
||||||
|
image: paradedb/paradedb:latest
|
||||||
|
container_name: WeKnora-postgres
|
||||||
|
ports:
|
||||||
|
- "${DB_PORT}:5432"
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=${DB_USER}
|
||||||
|
# NOCC:hardcode-password(工具误报)
|
||||||
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||||
|
- POSTGRES_DB=${DB_NAME}
|
||||||
|
volumes:
|
||||||
|
- postgres-data:/var/lib/postgresql/data
|
||||||
|
- ./migrations/paradedb:/docker-entrypoint-initdb.d
|
||||||
|
networks:
|
||||||
|
- WeKnora-network
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
|
||||||
|
interval: 10s # 增加时间间隔
|
||||||
|
timeout: 10s # 增加超时时间
|
||||||
|
retries: 3 # 减少重试次数,让失败更快反馈
|
||||||
|
start_period: 30s # 给予初始启动更多时间
|
||||||
|
restart: unless-stopped
|
||||||
|
# 添加停机时的优雅退出时间
|
||||||
|
stop_grace_period: 1m
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:7.0-alpine
|
||||||
|
container_name: WeKnora-redis
|
||||||
|
ports:
|
||||||
|
- "${REDIS_PORT}:6379"
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- WeKnora-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
WeKnora-network:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres-data:
|
||||||
|
data-files:
|
||||||
|
jaeger_data:
|
||||||
|
redis_data:
|
||||||
|
minio_data:
|
|
@ -16,7 +16,6 @@ services:
|
||||||
- DB_PASSWORD=${DB_PASSWORD}
|
- DB_PASSWORD=${DB_PASSWORD}
|
||||||
- DB_NAME=${DB_NAME}
|
- DB_NAME=${DB_NAME}
|
||||||
- TZ=Asia/Shanghai
|
- TZ=Asia/Shanghai
|
||||||
- OTEL_EXPORTER_OTLP_ENDPOINT=jaeger:4317
|
|
||||||
- OTEL_SERVICE_NAME=WeKnora
|
- OTEL_SERVICE_NAME=WeKnora
|
||||||
- OTEL_TRACES_EXPORTER=otlp
|
- OTEL_TRACES_EXPORTER=otlp
|
||||||
- OTEL_METRICS_EXPORTER=none
|
- OTEL_METRICS_EXPORTER=none
|
||||||
|
@ -127,27 +126,6 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
jaeger:
|
|
||||||
image: jaegertracing/all-in-one:latest
|
|
||||||
ports:
|
|
||||||
- "6831:6831/udp" # Jaeger Thrift接收器
|
|
||||||
- "6832:6832/udp" # Jaeger Thrift接收器(Compact)
|
|
||||||
- "5778:5778" # 配置端口
|
|
||||||
- "16686:16686" # Web UI
|
|
||||||
- "4317:4317" # OTLP gRPC接收器
|
|
||||||
- "4318:4318" # OTLP HTTP接收器
|
|
||||||
- "14250:14250" # 接收模型端口
|
|
||||||
- "14268:14268" # Jaeger HTTP接收器
|
|
||||||
- "9411:9411" # Zipkin兼容性端口
|
|
||||||
environment:
|
|
||||||
- COLLECTOR_OTLP_ENABLED=true
|
|
||||||
- COLLECTOR_ZIPKIN_HOST_PORT=:9411
|
|
||||||
volumes:
|
|
||||||
- jaeger_data:/var/lib/jaeger # 持久化 Jaeger 数据
|
|
||||||
networks:
|
|
||||||
- WeKnora-network
|
|
||||||
restart: unless-stopped
|
|
||||||
# 修改的PostgreSQL配置
|
# 修改的PostgreSQL配置
|
||||||
postgres:
|
postgres:
|
||||||
image: paradedb/paradedb:latest
|
image: paradedb/paradedb:latest
|
||||||
|
@ -193,6 +171,5 @@ networks:
|
||||||
volumes:
|
volumes:
|
||||||
postgres-data:
|
postgres-data:
|
||||||
data-files:
|
data-files:
|
||||||
jaeger_data:
|
|
||||||
redis_data:
|
redis_data:
|
||||||
minio_data:
|
minio_data:
|
||||||
|
|
|
@ -772,7 +772,7 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases/kb-00000001/knowle
|
||||||
--header 'X-API-Key: sk-vQHV2NZI_LK5W7wHQvH3yGYExX8YnhaHwZipUYbiZKCYJbBQ' \
|
--header 'X-API-Key: sk-vQHV2NZI_LK5W7wHQvH3yGYExX8YnhaHwZipUYbiZKCYJbBQ' \
|
||||||
--header 'Content-Type: application/json' \
|
--header 'Content-Type: application/json' \
|
||||||
--data '{
|
--data '{
|
||||||
"url":"https://github.com/Tencent/WeKnora",
|
"url":"https://knowlege-lsxd",
|
||||||
"enable_multimodel":true
|
"enable_multimodel":true
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
@ -788,7 +788,7 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases/kb-00000001/knowle
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"title": "",
|
"title": "",
|
||||||
"description": "",
|
"description": "",
|
||||||
"source": "https://github.com/Tencent/WeKnora",
|
"source": "https://knowlege-lsxd",
|
||||||
"parse_status": "processing",
|
"parse_status": "processing",
|
||||||
"enable_status": "disabled",
|
"enable_status": "disabled",
|
||||||
"embedding_model_id": "dff7bc94-7885-4dd1-bfd5-bd96e4df2fc3",
|
"embedding_model_id": "dff7bc94-7885-4dd1-bfd5-bd96e4df2fc3",
|
||||||
|
@ -831,7 +831,7 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases/kb-00000001/knowle
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"title": "",
|
"title": "",
|
||||||
"description": "",
|
"description": "",
|
||||||
"source": "https://github.com/Tencent/WeKnora",
|
"source": "https://knowlege-lsxd",
|
||||||
"parse_status": "pending",
|
"parse_status": "pending",
|
||||||
"enable_status": "disabled",
|
"enable_status": "disabled",
|
||||||
"embedding_model_id": "dff7bc94-7885-4dd1-bfd5-bd96e4df2fc3",
|
"embedding_model_id": "dff7bc94-7885-4dd1-bfd5-bd96e4df2fc3",
|
||||||
|
@ -922,7 +922,7 @@ curl --location 'http://localhost:8080/api/v1/knowledge/batch?ids=9c8af585-ae15-
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"title": "",
|
"title": "",
|
||||||
"description": "",
|
"description": "",
|
||||||
"source": "https://github.com/Tencent/WeKnora",
|
"source": "https://knowlege-lsxd",
|
||||||
"parse_status": "pending",
|
"parse_status": "pending",
|
||||||
"enable_status": "disabled",
|
"enable_status": "disabled",
|
||||||
"embedding_model_id": "dff7bc94-7885-4dd1-bfd5-bd96e4df2fc3",
|
"embedding_model_id": "dff7bc94-7885-4dd1-bfd5-bd96e4df2fc3",
|
||||||
|
|
4
go.mod
4
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module github.com/Tencent/WeKnora
|
module knowlege-lsxd
|
||||||
|
|
||||||
go 1.24.0
|
go 1.24.0
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ require (
|
||||||
github.com/elastic/go-elasticsearch/v8 v8.18.0
|
github.com/elastic/go-elasticsearch/v8 v8.18.0
|
||||||
github.com/gin-contrib/cors v1.7.5
|
github.com/gin-contrib/cors v1.7.5
|
||||||
github.com/gin-gonic/gin v1.10.0
|
github.com/gin-gonic/gin v1.10.0
|
||||||
github.com/go-ego/gse v0.80.3
|
|
||||||
github.com/go-viper/mapstructure/v2 v2.2.1
|
github.com/go-viper/mapstructure/v2 v2.2.1
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/hibiken/asynq v0.25.1
|
github.com/hibiken/asynq v0.25.1
|
||||||
|
@ -94,7 +93,6 @@ require (
|
||||||
github.com/subosito/gotenv v1.6.0 // indirect
|
github.com/subosito/gotenv v1.6.0 // indirect
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||||
github.com/vcaesar/cedar v0.20.2 // indirect
|
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.37.0 // indirect
|
go.opentelemetry.io/otel/metric v1.37.0 // indirect
|
||||||
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
|
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
|
||||||
|
|
6
go.sum
6
go.sum
|
@ -46,8 +46,6 @@ github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E
|
||||||
github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=
|
github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=
|
||||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
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/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||||
github.com/go-ego/gse v0.80.3 h1:YNFkjMhlhQnUeuoFcUEd1ivh6SOB764rT8GDsEbDiEg=
|
|
||||||
github.com/go-ego/gse v0.80.3/go.mod h1:Gt3A9Ry1Eso2Kza4MRaiZ7f2DTAvActmETY46Lxg0gU=
|
|
||||||
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
|
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
|
||||||
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
|
@ -216,10 +214,6 @@ github.com/uptrace/bun/dialect/pgdialect v1.1.12 h1:m/CM1UfOkoBTglGO5CUTKnIKKOAp
|
||||||
github.com/uptrace/bun/dialect/pgdialect v1.1.12/go.mod h1:Ij6WIxQILxLlL2frUBxUBOZJtLElD2QQNDcu/PWDHTc=
|
github.com/uptrace/bun/dialect/pgdialect v1.1.12/go.mod h1:Ij6WIxQILxLlL2frUBxUBOZJtLElD2QQNDcu/PWDHTc=
|
||||||
github.com/uptrace/bun/driver/pgdriver v1.1.12 h1:3rRWB1GK0psTJrHwxzNfEij2MLibggiLdTqjTtfHc1w=
|
github.com/uptrace/bun/driver/pgdriver v1.1.12 h1:3rRWB1GK0psTJrHwxzNfEij2MLibggiLdTqjTtfHc1w=
|
||||||
github.com/uptrace/bun/driver/pgdriver v1.1.12/go.mod h1:ssYUP+qwSEgeDDS1xm2XBip9el1y9Mi5mTAvLoiADLM=
|
github.com/uptrace/bun/driver/pgdriver v1.1.12/go.mod h1:ssYUP+qwSEgeDDS1xm2XBip9el1y9Mi5mTAvLoiADLM=
|
||||||
github.com/vcaesar/cedar v0.20.2 h1:TDx7AdZhilKcfE1WvdToTJf5VrC/FXcUOW+KY1upLZ4=
|
|
||||||
github.com/vcaesar/cedar v0.20.2/go.mod h1:lyuGvALuZZDPNXwpzv/9LyxW+8Y6faN7zauFezNsnik=
|
|
||||||
github.com/vcaesar/tt v0.20.1 h1:D/jUeeVCNbq3ad8M7hhtB3J9x5RZ6I1n1eZ0BJp7M+4=
|
|
||||||
github.com/vcaesar/tt v0.20.1/go.mod h1:cH2+AwGAJm19Wa6xvEa+0r+sXDJBT0QgNQey6mwqLeU=
|
|
||||||
github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94=
|
github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94=
|
||||||
github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ=
|
github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ=
|
||||||
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
|
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
|
||||||
|
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/common"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
"knowlege-lsxd/internal/common"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// chunkRepository implements the ChunkRepository interface
|
// chunkRepository implements the ChunkRepository interface
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrKnowledgeNotFound = errors.New("knowledge not found")
|
var ErrKnowledgeNotFound = errors.New("knowledge not found")
|
||||||
|
|
|
@ -4,8 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// messageRepository implements the message repository interface
|
// messageRepository implements the message repository interface
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// modelRepository implements the model repository interface
|
// modelRepository implements the model repository interface
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"maps"
|
"maps"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VectorEmbedding defines the Elasticsearch document structure for vector embeddings
|
// VectorEmbedding defines the Elasticsearch document structure for vector embeddings
|
||||||
|
|
|
@ -15,14 +15,14 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
elasticsearchRetriever "github.com/Tencent/WeKnora/internal/application/repository/retriever/elasticsearch"
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
typesLocal "github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/elastic/go-elasticsearch/v7"
|
"github.com/elastic/go-elasticsearch/v7"
|
||||||
"github.com/elastic/go-elasticsearch/v7/esapi"
|
"github.com/elastic/go-elasticsearch/v7/esapi"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
elasticsearchRetriever "knowlege-lsxd/internal/application/repository/retriever/elasticsearch"
|
||||||
|
"knowlege-lsxd/internal/config"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
typesLocal "knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
type elasticsearchRepository struct {
|
type elasticsearchRepository struct {
|
||||||
|
|
|
@ -6,14 +6,14 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
elasticsearchRetriever "github.com/Tencent/WeKnora/internal/application/repository/retriever/elasticsearch"
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
typesLocal "github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/elastic/go-elasticsearch/v8"
|
"github.com/elastic/go-elasticsearch/v8"
|
||||||
"github.com/elastic/go-elasticsearch/v8/typedapi/core/search"
|
"github.com/elastic/go-elasticsearch/v8/typedapi/core/search"
|
||||||
"github.com/elastic/go-elasticsearch/v8/typedapi/types"
|
"github.com/elastic/go-elasticsearch/v8/typedapi/types"
|
||||||
|
elasticsearchRetriever "knowlege-lsxd/internal/application/repository/retriever/elasticsearch"
|
||||||
|
"knowlege-lsxd/internal/config"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
typesLocal "knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// elasticsearchRepository implements the RetrieveEngineRepository interface for Elasticsearch v8
|
// elasticsearchRepository implements the RetrieveEngineRepository interface for Elasticsearch v8
|
||||||
|
|
|
@ -5,13 +5,13 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/common"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/pgvector/pgvector-go"
|
"github.com/pgvector/pgvector-go"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
|
"knowlege-lsxd/internal/common"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// pgRepository implements PostgreSQL-based retrieval operations
|
// pgRepository implements PostgreSQL-based retrieval operations
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/common"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/pgvector/pgvector-go"
|
"github.com/pgvector/pgvector-go"
|
||||||
|
"knowlege-lsxd/internal/common"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// pgVector defines the database model for vector embeddings storage
|
// pgVector defines the database model for vector embeddings storage
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sessionRepository implements the SessionRepository interface
|
// sessionRepository implements the SessionRepository interface
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -3,9 +3,9 @@ package chatpipline
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginChatCompletion implements chat completion functionality
|
// PluginChatCompletion implements chat completion functionality
|
||||||
|
|
|
@ -3,9 +3,9 @@ package chatpipline
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginChatCompletionStream implements streaming chat completion functionality
|
// PluginChatCompletionStream implements streaming chat completion functionality
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chatpipline
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Plugin defines the interface for chat pipeline plugins
|
// Plugin defines the interface for chat pipeline plugins
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Define a test Plugin implementation
|
// Define a test Plugin implementation
|
||||||
|
|
|
@ -3,10 +3,10 @@ package chatpipline
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
"knowlege-lsxd/internal/models/chat"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// prepareChatModel shared logic to prepare chat model and options
|
// prepareChatModel shared logic to prepare chat model and options
|
||||||
|
|
|
@ -3,8 +3,8 @@ package chatpipline
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginFilterTopK is a plugin that filters search results to keep only the top K items
|
// PluginFilterTopK is a plugin that filters search results to keep only the top K items
|
||||||
|
|
|
@ -10,8 +10,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginIntoChatMessage handles the transformation of search results into chat messages
|
// PluginIntoChatMessage handles the transformation of search results into chat messages
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginMerge handles merging of search result chunks
|
// PluginMerge handles merging of search result chunks
|
||||||
|
|
|
@ -7,10 +7,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
"knowlege-lsxd/internal/config"
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginPreprocess Query preprocessing plugin
|
// PluginPreprocess Query preprocessing plugin
|
||||||
|
|
|
@ -7,10 +7,10 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/models/rerank"
|
"knowlege-lsxd/internal/models/rerank"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginRerank implements reranking functionality for chat pipeline
|
// PluginRerank implements reranking functionality for chat pipeline
|
||||||
|
|
|
@ -11,11 +11,11 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
"knowlege-lsxd/internal/config"
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
"knowlege-lsxd/internal/models/chat"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginRewrite is a plugin for rewriting user queries
|
// PluginRewrite is a plugin for rewriting user queries
|
||||||
|
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
"knowlege-lsxd/internal/config"
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginSearch implements search functionality for chat pipeline
|
// PluginSearch implements search functionality for chat pipeline
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginStreamFilter implements stream filtering functionality for chat pipeline
|
// PluginStreamFilter implements stream filtering functionality for chat pipeline
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/tracing"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"knowlege-lsxd/internal/tracing"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginTracing implements tracing functionality for chat pipeline events
|
// PluginTracing implements tracing functionality for chat pipeline events
|
||||||
|
|
|
@ -6,9 +6,9 @@ package service
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// chunkService implements the ChunkService interface
|
// chunkService implements the ChunkService interface
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MockKnowledgeBaseRepo struct {
|
||||||
|
mock.Mock
|
||||||
|
interfaces.KnowledgeBaseRepository
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MockKnowledgeBaseRepo) Create(ctx context.Context, kb *types.KnowledgeBase) error {
|
||||||
|
args := m.Called(ctx, kb)
|
||||||
|
return args.Error(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func must(err error) {
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/parquet-go/parquet-go"
|
"github.com/parquet-go/parquet-go"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DatasetService provides operations for working with datasets
|
// DatasetService provides operations for working with datasets
|
||||||
|
|
|
@ -7,12 +7,12 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
"knowlege-lsxd/internal/config"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -10,9 +10,9 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/tencentyun/cos-go-sdk-v5"
|
"github.com/tencentyun/cos-go-sdk-v5"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// cosFileService implements the FileService interface for Tencent Cloud COS
|
// cosFileService implements the FileService interface for Tencent Cloud COS
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DummyFileService is a no-op implementation of the FileService interface
|
// DummyFileService is a no-op implementation of the FileService interface
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// localFileService implements the FileService interface for local file system storage
|
// localFileService implements the FileService interface for local file system storage
|
||||||
|
|
|
@ -7,10 +7,10 @@ import (
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/minio/minio-go/v7"
|
"github.com/minio/minio-go/v7"
|
||||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// minioFileService MinIO file service implementation
|
// minioFileService MinIO file service implementation
|
||||||
|
|
|
@ -10,14 +10,14 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/common"
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
"knowlege-lsxd/internal/common"
|
||||||
|
"knowlege-lsxd/internal/config"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/models/chat"
|
||||||
|
"knowlege-lsxd/internal/models/utils"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -17,20 +17,20 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/application/service/retriever"
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
|
||||||
werrors "github.com/Tencent/WeKnora/internal/errors"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils"
|
|
||||||
"github.com/Tencent/WeKnora/internal/tracing"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/Tencent/WeKnora/services/docreader/src/client"
|
|
||||||
"github.com/Tencent/WeKnora/services/docreader/src/proto"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
"knowlege-lsxd/internal/application/service/retriever"
|
||||||
|
"knowlege-lsxd/internal/config"
|
||||||
|
werrors "knowlege-lsxd/internal/errors"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/models/chat"
|
||||||
|
"knowlege-lsxd/internal/models/utils"
|
||||||
|
"knowlege-lsxd/internal/tracing"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
|
"knowlege-lsxd/services/docreader/src/client"
|
||||||
|
"knowlege-lsxd/services/docreader/src/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Error definitions for knowledge service operations
|
// Error definitions for knowledge service operations
|
||||||
|
|
|
@ -8,13 +8,13 @@ import (
|
||||||
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/application/service/retriever"
|
|
||||||
"github.com/Tencent/WeKnora/internal/common"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/embedding"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"knowlege-lsxd/internal/application/service/retriever"
|
||||||
|
"knowlege-lsxd/internal/common"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/models/embedding"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrInvalidTenantID represents an error for invalid tenant ID
|
// ErrInvalidTenantID represents an error for invalid tenant ID
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
|
"knowlege-lsxd/internal/container"
|
||||||
|
"knowlege-lsxd/internal/runtime"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test_CreateKnowledge(t *testing.T) {
|
||||||
|
// 1. 构建容器
|
||||||
|
container := container.BuildContainer(runtime.GetContainer())
|
||||||
|
|
||||||
|
// 2. Mock 依赖
|
||||||
|
mockKBRepo := new(MockKnowledgeBaseRepo)
|
||||||
|
must(container.Provide(func() interfaces.KnowledgeBaseRepository {
|
||||||
|
return mockKBRepo
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 3. 解析服务(自动注入 Mock 的 KnowledgeBaseRepository)
|
||||||
|
var service *knowledgeBaseService
|
||||||
|
must(container.Invoke(func(k *knowledgeBaseService) {
|
||||||
|
service = k
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 4. 设置 Mock 预期
|
||||||
|
mockKBRepo.On("Create", context.Background(), mock.Anything).Return(nil)
|
||||||
|
|
||||||
|
// 5. 调用并断言
|
||||||
|
base, err := service.CreateKnowledgeBase(context.Background(), &types.KnowledgeBase{Name: "Test"})
|
||||||
|
assert.NoError(t, err, base)
|
||||||
|
mockKBRepo.AssertExpectations(t)
|
||||||
|
}
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// messageService implements the MessageService interface for managing messaging operations
|
// messageService implements the MessageService interface for managing messaging operations
|
||||||
|
|
|
@ -21,7 +21,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BLEUMetric struct {
|
type BLEUMetric struct {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func sum(m map[string]int) int {
|
func sum(m map[string]int) int {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package metric
|
package metric
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MAPMetric calculates Mean Average Precision for retrieval evaluation
|
// MAPMetric calculates Mean Average Precision for retrieval evaluation
|
||||||
|
|
|
@ -3,7 +3,7 @@ package metric
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMAPMetric_Compute(t *testing.T) {
|
func TestMAPMetric_Compute(t *testing.T) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package metric
|
package metric
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MRRMetric calculates Mean Reciprocal Rank for retrieval evaluation
|
// MRRMetric calculates Mean Reciprocal Rank for retrieval evaluation
|
||||||
|
|
|
@ -3,7 +3,7 @@ package metric
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMRRMetric_Compute(t *testing.T) {
|
func TestMRRMetric_Compute(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package metric
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NDCGMetric calculates Normalized Discounted Cumulative Gain
|
// NDCGMetric calculates Normalized Discounted Cumulative Gain
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package metric
|
package metric
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PrecisionMetric calculates precision for retrieval evaluation
|
// PrecisionMetric calculates precision for retrieval evaluation
|
||||||
|
|
|
@ -3,7 +3,7 @@ package metric
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPrecisionMetric_Compute(t *testing.T) {
|
func TestPrecisionMetric_Compute(t *testing.T) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package metric
|
package metric
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RecallMetric calculates recall for retrieval evaluation
|
// RecallMetric calculates recall for retrieval evaluation
|
||||||
|
|
|
@ -3,7 +3,7 @@ package metric
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRecallMetric_Compute(t *testing.T) {
|
func TestRecallMetric_Compute(t *testing.T) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package metric
|
package metric
|
||||||
|
|
||||||
import "github.com/Tencent/WeKnora/internal/types"
|
import "knowlege-lsxd/internal/types"
|
||||||
|
|
||||||
// reference: https://github.com/dd-Rebecca/rouge
|
// reference: https://github.com/dd-Rebecca/rouge
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/application/service/metric"
|
"knowlege-lsxd/internal/application/service/metric"
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MetricList stores and aggregates metric results
|
// MetricList stores and aggregates metric results
|
||||||
|
|
|
@ -4,13 +4,13 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
"knowlege-lsxd/internal/models/chat"
|
||||||
"github.com/Tencent/WeKnora/internal/models/embedding"
|
"knowlege-lsxd/internal/models/embedding"
|
||||||
"github.com/Tencent/WeKnora/internal/models/rerank"
|
"knowlege-lsxd/internal/models/rerank"
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
|
"knowlege-lsxd/internal/models/utils/ollama"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrModelNotFound is returned when a model cannot be found in the repository
|
// ErrModelNotFound is returned when a model cannot be found in the repository
|
||||||
|
|
|
@ -8,14 +8,14 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/common"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/embedding"
|
|
||||||
"github.com/Tencent/WeKnora/internal/runtime"
|
|
||||||
"github.com/Tencent/WeKnora/internal/tracing"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"knowlege-lsxd/internal/common"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/models/embedding"
|
||||||
|
"knowlege-lsxd/internal/runtime"
|
||||||
|
"knowlege-lsxd/internal/tracing"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// engineInfo holds information about a retrieve engine and its supported retriever types
|
// engineInfo holds information about a retrieve engine and its supported retriever types
|
||||||
|
|
|
@ -5,11 +5,11 @@ import (
|
||||||
"slices"
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/models/embedding"
|
"knowlege-lsxd/internal/models/embedding"
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils"
|
"knowlege-lsxd/internal/models/utils"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KeywordsVectorHybridRetrieveEngineService implements a hybrid retrieval engine
|
// KeywordsVectorHybridRetrieveEngineService implements a hybrid retrieval engine
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RetrieveEngineRegistry implements the retrieval engine registry
|
// RetrieveEngineRegistry implements the retrieval engine registry
|
||||||
|
|
|
@ -5,15 +5,15 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
chatpipline "github.com/Tencent/WeKnora/internal/application/service/chat_pipline"
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
|
||||||
"github.com/Tencent/WeKnora/internal/tracing"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/codes"
|
"go.opentelemetry.io/otel/codes"
|
||||||
|
chatpipline "knowlege-lsxd/internal/application/service/chat_pipline"
|
||||||
|
"knowlege-lsxd/internal/config"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/models/chat"
|
||||||
|
"knowlege-lsxd/internal/tracing"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sessionService implements the SessionService interface for managing conversation sessions
|
// sessionService implements the SessionService interface for managing conversation sessions
|
||||||
|
|
|
@ -5,20 +5,22 @@ import (
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"crypto/sha256"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var apiKeySecret = []byte(os.Getenv("TENANT_AES_KEY"))
|
var apiKeySecret = getApiKeySecret()
|
||||||
|
|
||||||
// ListTenantsParams defines parameters for listing tenants with filtering and pagination
|
// ListTenantsParams defines parameters for listing tenants with filtering and pagination
|
||||||
type ListTenantsParams struct {
|
type ListTenantsParams struct {
|
||||||
|
@ -287,3 +289,9 @@ func (r *tenantService) ExtractTenantIDFromAPIKey(apiKey string) (uint, error) {
|
||||||
|
|
||||||
return uint(tenantID), nil
|
return uint(tenantID), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getApiKeySecret() []byte {
|
||||||
|
secret := os.Getenv("TENANT_AES_KEY")
|
||||||
|
hashArray := sha256.Sum256([]byte(secret))
|
||||||
|
return hashArray[:]
|
||||||
|
}
|
||||||
|
|
|
@ -8,14 +8,14 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
"knowlege-lsxd/internal/config"
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
"knowlege-lsxd/internal/models/chat"
|
||||||
"github.com/Tencent/WeKnora/internal/models/embedding"
|
"knowlege-lsxd/internal/models/embedding"
|
||||||
"github.com/Tencent/WeKnora/internal/models/rerank"
|
"knowlege-lsxd/internal/models/rerank"
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
|
"knowlege-lsxd/internal/models/utils/ollama"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestDataService 测试数据服务
|
// TestDataService 测试数据服务
|
||||||
|
|
|
@ -3,8 +3,8 @@ package common
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
|
"knowlege-lsxd/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// client is the global asyncq client instance
|
// client is the global asyncq client instance
|
||||||
|
|
|
@ -2,9 +2,6 @@ package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/go-viper/mapstructure/v2"
|
|
||||||
"github.com/joho/godotenv"
|
|
||||||
"github.com/spf13/viper"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -12,6 +9,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-viper/mapstructure/v2"
|
||||||
|
"github.com/joho/godotenv"
|
||||||
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config 应用程序总配置
|
// Config 应用程序总配置
|
||||||
|
@ -193,7 +194,6 @@ func SetEnv() {
|
||||||
envSet("DB_HOST", "127.0.0.1")
|
envSet("DB_HOST", "127.0.0.1")
|
||||||
envSet("DB_PORT", "5432")
|
envSet("DB_PORT", "5432")
|
||||||
envSet("TZ", "Asia/Shanghai")
|
envSet("TZ", "Asia/Shanghai")
|
||||||
envSet("OTEL_EXPORTER_OTLP_ENDPOINT", "jaeger:4317")
|
|
||||||
envSet("OTEL_SERVICE_NAME", "WeKnora")
|
envSet("OTEL_SERVICE_NAME", "WeKnora")
|
||||||
envSet("OTEL_TRACES_EXPORTER", "otlp")
|
envSet("OTEL_TRACES_EXPORTER", "otlp")
|
||||||
envSet("OTEL_METRICS_EXPORTER", "none")
|
envSet("OTEL_METRICS_EXPORTER", "none")
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ResourceCleaner is a resource cleaner that can be used to clean up resources
|
// ResourceCleaner is a resource cleaner that can be used to clean up resources
|
||||||
|
|
|
@ -19,25 +19,25 @@ import (
|
||||||
"gorm.io/driver/postgres"
|
"gorm.io/driver/postgres"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/application/repository"
|
"knowlege-lsxd/internal/application/repository"
|
||||||
elasticsearchRepoV7 "github.com/Tencent/WeKnora/internal/application/repository/retriever/elasticsearch/v7"
|
elasticsearchRepoV7 "knowlege-lsxd/internal/application/repository/retriever/elasticsearch/v7"
|
||||||
elasticsearchRepoV8 "github.com/Tencent/WeKnora/internal/application/repository/retriever/elasticsearch/v8"
|
elasticsearchRepoV8 "knowlege-lsxd/internal/application/repository/retriever/elasticsearch/v8"
|
||||||
postgresRepo "github.com/Tencent/WeKnora/internal/application/repository/retriever/postgres"
|
postgresRepo "knowlege-lsxd/internal/application/repository/retriever/postgres"
|
||||||
"github.com/Tencent/WeKnora/internal/application/service"
|
"knowlege-lsxd/internal/application/service"
|
||||||
chatpipline "github.com/Tencent/WeKnora/internal/application/service/chat_pipline"
|
chatpipline "knowlege-lsxd/internal/application/service/chat_pipline"
|
||||||
"github.com/Tencent/WeKnora/internal/application/service/file"
|
"knowlege-lsxd/internal/application/service/file"
|
||||||
"github.com/Tencent/WeKnora/internal/application/service/retriever"
|
"knowlege-lsxd/internal/application/service/retriever"
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
"knowlege-lsxd/internal/config"
|
||||||
"github.com/Tencent/WeKnora/internal/handler"
|
"knowlege-lsxd/internal/handler"
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/models/embedding"
|
"knowlege-lsxd/internal/models/embedding"
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
|
"knowlege-lsxd/internal/models/utils/ollama"
|
||||||
"github.com/Tencent/WeKnora/internal/router"
|
"knowlege-lsxd/internal/router"
|
||||||
"github.com/Tencent/WeKnora/internal/stream"
|
"knowlege-lsxd/internal/stream"
|
||||||
"github.com/Tencent/WeKnora/internal/tracing"
|
"knowlege-lsxd/internal/tracing"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
"github.com/Tencent/WeKnora/services/docreader/src/client"
|
"knowlege-lsxd/services/docreader/src/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BuildContainer constructs the dependency injection container
|
// BuildContainer constructs the dependency injection container
|
||||||
|
|
|
@ -3,12 +3,12 @@ package handler
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/application/service"
|
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"knowlege-lsxd/internal/application/service"
|
||||||
|
"knowlege-lsxd/internal/errors"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChunkHandler defines HTTP handlers for chunk operations
|
// ChunkHandler defines HTTP handlers for chunk operations
|
||||||
|
|
|
@ -3,11 +3,11 @@ package handler
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"knowlege-lsxd/internal/errors"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EvaluationHandler handles evaluation related HTTP requests
|
// EvaluationHandler handles evaluation related HTTP requests
|
||||||
|
|
|
@ -13,18 +13,18 @@ import (
|
||||||
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/embedding"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/Tencent/WeKnora/services/docreader/src/client"
|
|
||||||
"github.com/Tencent/WeKnora/services/docreader/src/proto"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/ollama/ollama/api"
|
"github.com/ollama/ollama/api"
|
||||||
|
"knowlege-lsxd/internal/config"
|
||||||
|
"knowlege-lsxd/internal/errors"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/models/embedding"
|
||||||
|
"knowlege-lsxd/internal/models/utils/ollama"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
|
"knowlege-lsxd/services/docreader/src/client"
|
||||||
|
"knowlege-lsxd/services/docreader/src/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DownloadTask 下载任务信息
|
// DownloadTask 下载任务信息
|
||||||
|
|
|
@ -7,11 +7,11 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"knowlege-lsxd/internal/errors"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KnowledgeHandler processes HTTP requests related to knowledge resources
|
// KnowledgeHandler processes HTTP requests related to knowledge resources
|
||||||
|
|
|
@ -3,11 +3,11 @@ package handler
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"knowlege-lsxd/internal/errors"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KnowledgeBaseHandler defines the HTTP handler for knowledge base operations
|
// KnowledgeBaseHandler defines the HTTP handler for knowledge base operations
|
||||||
|
|
|
@ -7,9 +7,9 @@ import (
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
"knowlege-lsxd/internal/errors"
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MessageHandler handles HTTP requests related to messages within chat sessions
|
// MessageHandler handles HTTP requests related to messages within chat sessions
|
||||||
|
|
|
@ -3,12 +3,12 @@ package handler
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/application/service"
|
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"knowlege-lsxd/internal/application/service"
|
||||||
|
"knowlege-lsxd/internal/errors"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ModelHandler handles HTTP requests for model-related operations
|
// ModelHandler handles HTTP requests for model-related operations
|
||||||
|
|
|
@ -7,13 +7,13 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/application/service"
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"knowlege-lsxd/internal/application/service"
|
||||||
|
"knowlege-lsxd/internal/config"
|
||||||
|
"knowlege-lsxd/internal/errors"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SessionHandler handles all HTTP requests related to conversation sessions
|
// SessionHandler handles all HTTP requests related to conversation sessions
|
||||||
|
|
|
@ -6,10 +6,10 @@ import (
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
"knowlege-lsxd/internal/errors"
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TenantHandler implements HTTP request handlers for tenant management
|
// TenantHandler implements HTTP request handlers for tenant management
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
"knowlege-lsxd/internal/config"
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestDataHandler handles HTTP requests related to test data operations
|
// TestDataHandler handles HTTP requests related to test data operations
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LogLevel 日志级别类型
|
// LogLevel 日志级别类型
|
||||||
|
|
|
@ -8,10 +8,10 @@ import (
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"knowlege-lsxd/internal/config"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 无需认证的API列表
|
// 无需认证的API列表
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
"knowlege-lsxd/internal/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrorHandler 是一个处理应用错误的中间件
|
// ErrorHandler 是一个处理应用错误的中间件
|
||||||
|
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RequestID middleware adds a unique request ID to the context
|
// RequestID middleware adds a unique request ID to the context
|
||||||
|
|
|
@ -10,8 +10,8 @@ import (
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/codes"
|
"go.opentelemetry.io/otel/codes"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/tracing"
|
"knowlege-lsxd/internal/tracing"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Custom ResponseWriter to capture response content
|
// Custom ResponseWriter to capture response content
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
|
"knowlege-lsxd/internal/models/utils/ollama"
|
||||||
"github.com/Tencent/WeKnora/internal/runtime"
|
"knowlege-lsxd/internal/runtime"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChatOptions 聊天选项
|
// ChatOptions 聊天选项
|
||||||
|
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
ollamaapi "github.com/ollama/ollama/api"
|
ollamaapi "github.com/ollama/ollama/api"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/models/utils/ollama"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OllamaChat 实现了基于 Ollama 的聊天
|
// OllamaChat 实现了基于 Ollama 的聊天
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
|
||||||
"github.com/sashabaranov/go-openai"
|
"github.com/sashabaranov/go-openai"
|
||||||
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RemoteAPIChat 实现了基于的聊天
|
// RemoteAPIChat 实现了基于的聊天
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils"
|
|
||||||
"github.com/panjf2000/ants/v2"
|
"github.com/panjf2000/ants/v2"
|
||||||
|
"knowlege-lsxd/internal/models/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type batchEmbedder struct {
|
type batchEmbedder struct {
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
|
"knowlege-lsxd/internal/models/utils/ollama"
|
||||||
"github.com/Tencent/WeKnora/internal/runtime"
|
"knowlege-lsxd/internal/runtime"
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Embedder defines the interface for text vectorization
|
// Embedder defines the interface for text vectorization
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
|
|
||||||
ollamaapi "github.com/ollama/ollama/api"
|
ollamaapi "github.com/ollama/ollama/api"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
|
"knowlege-lsxd/internal/models/utils/ollama"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OllamaEmbedder implements text vectorization functionality using Ollama
|
// OllamaEmbedder implements text vectorization functionality using Ollama
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OpenAIEmbedder implements text vectorization functionality using OpenAI API
|
// OpenAIEmbedder implements text vectorization functionality using OpenAI API
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"knowlege-lsxd/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OpenAIReranker implements a reranking system based on OpenAI models
|
// OpenAIReranker implements a reranking system based on OpenAI models
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/types"
|
"knowlege-lsxd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Reranker defines the interface for document reranking
|
// Reranker defines the interface for document reranking
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
|
||||||
"github.com/ollama/ollama/api"
|
"github.com/ollama/ollama/api"
|
||||||
|
"knowlege-lsxd/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OllamaService manages Ollama service
|
// OllamaService manages Ollama service
|
||||||
|
|
|
@ -7,10 +7,10 @@ import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"go.uber.org/dig"
|
"go.uber.org/dig"
|
||||||
|
|
||||||
"github.com/Tencent/WeKnora/internal/config"
|
"knowlege-lsxd/internal/config"
|
||||||
"github.com/Tencent/WeKnora/internal/handler"
|
"knowlege-lsxd/internal/handler"
|
||||||
"github.com/Tencent/WeKnora/internal/middleware"
|
"knowlege-lsxd/internal/middleware"
|
||||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
"knowlege-lsxd/internal/types/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RouterParams 路由参数
|
// RouterParams 路由参数
|
||||||
|
@ -53,7 +53,7 @@ func NewRouter(params RouterParams) *gin.Engine {
|
||||||
r.Use(middleware.Auth(params.TenantService, params.Config))
|
r.Use(middleware.Auth(params.TenantService, params.Config))
|
||||||
|
|
||||||
// 添加OpenTelemetry追踪中间件
|
// 添加OpenTelemetry追踪中间件
|
||||||
r.Use(middleware.TracingMiddleware())
|
//r.Use(middleware.TracingMiddleware())
|
||||||
|
|
||||||
// 健康检查
|
// 健康检查
|
||||||
r.GET("/health", func(c *gin.Context) {
|
r.GET("/health", func(c *gin.Context) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue