diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 0000000..02b915b --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/docs/api/curl.json b/docs/api/curl.json new file mode 100644 index 0000000..f9b0b61 --- /dev/null +++ b/docs/api/curl.json @@ -0,0 +1,128 @@ +[ + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": "1", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": " +", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": " ", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": "1", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": " equals", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": "2", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "STOP" + }, + "content": null, + "media": [] + }, + "metadata": { + "finishReason": "STOP", + "contentFilterMetadata": null + } + } + } +] \ No newline at end of file diff --git a/docs/api/curl.sh b/docs/api/curl.sh new file mode 100644 index 0000000..fb77f30 --- /dev/null +++ b/docs/api/curl.sh @@ -0,0 +1,7 @@ +curl http://117.72.115.188:11434/api/generate \ + -H "Content-Type: application/json" \ + -d '{ + "model": "deepseek-r1:1.5b", + "prompt": "1+1", + "stream": false + }' \ No newline at end of file diff --git a/docs/dev-ops/api/curl.json b/docs/dev-ops/api/curl.json new file mode 100644 index 0000000..f9b0b61 --- /dev/null +++ b/docs/dev-ops/api/curl.json @@ -0,0 +1,128 @@ +[ + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": "1", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": " +", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": " ", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": "1", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": " equals", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "" + }, + "content": "2", + "media": [] + }, + "metadata": { + "finishReason": null, + "contentFilterMetadata": null + } + } + }, + { + "result": { + "output": { + "messageType": "ASSISTANT", + "properties": { + "id": "chatcmpl-B3HPw95SsqmhoWeJ8azGLxK1Vf4At", + "role": "ASSISTANT", + "finishReason": "STOP" + }, + "content": null, + "media": [] + }, + "metadata": { + "finishReason": "STOP", + "contentFilterMetadata": null + } + } + } +] \ No newline at end of file diff --git a/docs/dev-ops/api/curl.sh b/docs/dev-ops/api/curl.sh new file mode 100644 index 0000000..fb77f30 --- /dev/null +++ b/docs/dev-ops/api/curl.sh @@ -0,0 +1,7 @@ +curl http://117.72.115.188:11434/api/generate \ + -H "Content-Type: application/json" \ + -d '{ + "model": "deepseek-r1:1.5b", + "prompt": "1+1", + "stream": false + }' \ No newline at end of file diff --git a/docs/dev-ops/docker-compose-environment-aliyun.yml b/docs/dev-ops/docker-compose-environment-aliyun.yml new file mode 100644 index 0000000..f2383c6 --- /dev/null +++ b/docs/dev-ops/docker-compose-environment-aliyun.yml @@ -0,0 +1,83 @@ +# docker-compose -f docker-compose-environment-aliyun.yml up -d +version: '3' +services: + # 对话模型 + # ollama pull deepseek-r1:1.5b + # 运行模型 + # ollama run deepseek-r1:1.5b + # 联网模型 + # ollama pull nomic-embed-text + ollama: + image: registry.cn-hangzhou.aliyuncs.com/xfg-studio/ollama:0.5.10 + container_name: ollama + restart: unless-stopped + ports: + - "11434:11434" + redis: + image: registry.cn-hangzhou.aliyuncs.com/xfg-studio/redis:6.2 + container_name: redis + restart: always + hostname: redis + privileged: true + ports: + - 16379:6379 + volumes: + - ./redis/redis.conf:/usr/local/etc/redis/redis.conf + command: redis-server /usr/local/etc/redis/redis.conf + networks: + - my-network + healthcheck: + test: [ "CMD", "redis-cli", "ping" ] + interval: 10s + timeout: 5s + retries: 3 + # RedisAdmin https://github.com/joeferner/redis-commander + # 账密 admin/admin + redis-admin: + image: registry.cn-hangzhou.aliyuncs.com/xfg-studio/redis-commander:0.8.0 + container_name: redis-admin + hostname: redis-commander + restart: always + ports: + - 8081:8081 + environment: + - REDIS_HOSTS=local:redis:6379 + - HTTP_USER=admin + - HTTP_PASSWORD=admin + - LANG=C.UTF-8 + - LANGUAGE=C.UTF-8 + - LC_ALL=C.UTF-8 + networks: + - my-network + depends_on: + redis: + condition: service_healthy + + vector_db: + image: registry.cn-hangzhou.aliyuncs.com/xfg-studio/pgvector:v0.5.0 + container_name: vector_db + restart: always + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=ai-rag-knowledge + - PGPASSWORD=postgres + volumes: + - ./pgvector/sql/init.sql:/docker-entrypoint-initdb.d/init.sql + logging: + options: + max-size: 10m + max-file: "3" + ports: + - '15432:5432' + healthcheck: + test: "pg_isready -U postgres -d ai-rag-knowledge" + interval: 2s + timeout: 20s + retries: 10 + networks: + - my-network + +networks: + my-network: + driver: bridge diff --git a/docs/dev-ops/docker-compose-environment.yml b/docs/dev-ops/docker-compose-environment.yml new file mode 100644 index 0000000..d3457da --- /dev/null +++ b/docs/dev-ops/docker-compose-environment.yml @@ -0,0 +1,83 @@ +# docker-comopse -f docker-compose-environment.yml up -d +version: '3' +services: + # 对话模型 + # ollama pull deepseek-r1:1.5b + # 运行模型 + # ollama run deepseek-r1:1.5b + # 联网模型 + # ollama pull nomic-embed-text + ollama: + image: ollama/ollama:0.5.10 + container_name: ollama + restart: unless-stopped + ports: + - "11434:11434" + redis: + image: redis:6.2 + container_name: redis + restart: always + hostname: redis + privileged: true + ports: + - 16379:6379 + volumes: + - ./redis/redis.conf:/usr/local/etc/redis/redis.conf + command: redis-server /usr/local/etc/redis/redis.conf + networks: + - my-network + healthcheck: + test: [ "CMD", "redis-cli", "ping" ] + interval: 10s + timeout: 5s + retries: 3 + # RedisAdmin https://github.com/joeferner/redis-commander + # 账密 admin/admin + redis-admin: + image: spryker/redis-commander:0.8.0 + container_name: redis-admin + hostname: redis-commander + restart: always + ports: + - 8081:8081 + environment: + - REDIS_HOSTS=local:redis:6379 + - HTTP_USER=admin + - HTTP_PASSWORD=admin + - LANG=C.UTF-8 + - LANGUAGE=C.UTF-8 + - LC_ALL=C.UTF-8 + networks: + - my-network + depends_on: + redis: + condition: service_healthy + + vector_db: + image: pgvector/pgvector:v0.5.0 + container_name: vector_db + restart: always + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=springai + - PGPASSWORD=postgres + volumes: + - ./pgvector/sql/init.sql:/docker-entrypoint-initdb.d/init.sql + logging: + options: + max-size: 10m + max-file: "3" + ports: + - '5432:5432' + healthcheck: + test: "pg_isready -U postgres -d vector_store" + interval: 2s + timeout: 20s + retries: 10 + networks: + - my-network + +networks: + my-network: + driver: bridge diff --git a/docs/dev-ops/pgvector/sql/init.sql b/docs/dev-ops/pgvector/sql/init.sql new file mode 100644 index 0000000..64f04f6 --- /dev/null +++ b/docs/dev-ops/pgvector/sql/init.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS vector; \ No newline at end of file diff --git a/docs/dev-ops/redis/redis.conf b/docs/dev-ops/redis/redis.conf new file mode 100644 index 0000000..f6f3781 --- /dev/null +++ b/docs/dev-ops/redis/redis.conf @@ -0,0 +1,2 @@ +bind 0.0.0.0 +port 6379 \ No newline at end of file diff --git a/docs/docker-compose-environment-aliyun.yml b/docs/docker-compose-environment-aliyun.yml new file mode 100644 index 0000000..f2383c6 --- /dev/null +++ b/docs/docker-compose-environment-aliyun.yml @@ -0,0 +1,83 @@ +# docker-compose -f docker-compose-environment-aliyun.yml up -d +version: '3' +services: + # 对话模型 + # ollama pull deepseek-r1:1.5b + # 运行模型 + # ollama run deepseek-r1:1.5b + # 联网模型 + # ollama pull nomic-embed-text + ollama: + image: registry.cn-hangzhou.aliyuncs.com/xfg-studio/ollama:0.5.10 + container_name: ollama + restart: unless-stopped + ports: + - "11434:11434" + redis: + image: registry.cn-hangzhou.aliyuncs.com/xfg-studio/redis:6.2 + container_name: redis + restart: always + hostname: redis + privileged: true + ports: + - 16379:6379 + volumes: + - ./redis/redis.conf:/usr/local/etc/redis/redis.conf + command: redis-server /usr/local/etc/redis/redis.conf + networks: + - my-network + healthcheck: + test: [ "CMD", "redis-cli", "ping" ] + interval: 10s + timeout: 5s + retries: 3 + # RedisAdmin https://github.com/joeferner/redis-commander + # 账密 admin/admin + redis-admin: + image: registry.cn-hangzhou.aliyuncs.com/xfg-studio/redis-commander:0.8.0 + container_name: redis-admin + hostname: redis-commander + restart: always + ports: + - 8081:8081 + environment: + - REDIS_HOSTS=local:redis:6379 + - HTTP_USER=admin + - HTTP_PASSWORD=admin + - LANG=C.UTF-8 + - LANGUAGE=C.UTF-8 + - LC_ALL=C.UTF-8 + networks: + - my-network + depends_on: + redis: + condition: service_healthy + + vector_db: + image: registry.cn-hangzhou.aliyuncs.com/xfg-studio/pgvector:v0.5.0 + container_name: vector_db + restart: always + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=ai-rag-knowledge + - PGPASSWORD=postgres + volumes: + - ./pgvector/sql/init.sql:/docker-entrypoint-initdb.d/init.sql + logging: + options: + max-size: 10m + max-file: "3" + ports: + - '15432:5432' + healthcheck: + test: "pg_isready -U postgres -d ai-rag-knowledge" + interval: 2s + timeout: 20s + retries: 10 + networks: + - my-network + +networks: + my-network: + driver: bridge diff --git a/docs/docker-compose-environment.yml b/docs/docker-compose-environment.yml new file mode 100644 index 0000000..d3457da --- /dev/null +++ b/docs/docker-compose-environment.yml @@ -0,0 +1,83 @@ +# docker-comopse -f docker-compose-environment.yml up -d +version: '3' +services: + # 对话模型 + # ollama pull deepseek-r1:1.5b + # 运行模型 + # ollama run deepseek-r1:1.5b + # 联网模型 + # ollama pull nomic-embed-text + ollama: + image: ollama/ollama:0.5.10 + container_name: ollama + restart: unless-stopped + ports: + - "11434:11434" + redis: + image: redis:6.2 + container_name: redis + restart: always + hostname: redis + privileged: true + ports: + - 16379:6379 + volumes: + - ./redis/redis.conf:/usr/local/etc/redis/redis.conf + command: redis-server /usr/local/etc/redis/redis.conf + networks: + - my-network + healthcheck: + test: [ "CMD", "redis-cli", "ping" ] + interval: 10s + timeout: 5s + retries: 3 + # RedisAdmin https://github.com/joeferner/redis-commander + # 账密 admin/admin + redis-admin: + image: spryker/redis-commander:0.8.0 + container_name: redis-admin + hostname: redis-commander + restart: always + ports: + - 8081:8081 + environment: + - REDIS_HOSTS=local:redis:6379 + - HTTP_USER=admin + - HTTP_PASSWORD=admin + - LANG=C.UTF-8 + - LANGUAGE=C.UTF-8 + - LC_ALL=C.UTF-8 + networks: + - my-network + depends_on: + redis: + condition: service_healthy + + vector_db: + image: pgvector/pgvector:v0.5.0 + container_name: vector_db + restart: always + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=springai + - PGPASSWORD=postgres + volumes: + - ./pgvector/sql/init.sql:/docker-entrypoint-initdb.d/init.sql + logging: + options: + max-size: 10m + max-file: "3" + ports: + - '5432:5432' + healthcheck: + test: "pg_isready -U postgres -d vector_store" + interval: 2s + timeout: 20s + retries: 10 + networks: + - my-network + +networks: + my-network: + driver: bridge diff --git a/docs/pgvector/sql/init.sql b/docs/pgvector/sql/init.sql new file mode 100644 index 0000000..64f04f6 --- /dev/null +++ b/docs/pgvector/sql/init.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS vector; \ No newline at end of file diff --git a/docs/redis/redis.conf b/docs/redis/redis.conf new file mode 100644 index 0000000..f6f3781 --- /dev/null +++ b/docs/redis/redis.conf @@ -0,0 +1,2 @@ +bind 0.0.0.0 +port 6379 \ No newline at end of file