Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

支持redis user + bug fixs

meizi60642260bc441
diff --git a/docker/Dockerfile.sandbox b/docker/Dockerfile.sandbox
index 65ca078188..92e5987bf0 100644
--- a/docker/Dockerfile.sandbox
+++ b/docker/Dockerfile.sandbox
@@ -20,8 +20,10 @@ RUN uv pip install --system --break-system-packages \
${PIP_EXTRA_ARGS} \
-e .
-COPY docker/sandbox-entrypoint.sh /usr/local/bin/sandbox-entrypoint.sh
-RUN chmod +x /usr/local/bin/sandbox-entrypoint.sh
+# entrypoint 从仓库原路径运行:dev 模式下 hp-code 将仓库挂载到 /app/jiuwenswarm,
+# 直接生效仓库内脚本(便于联调);生产镜像内置同路径副本
+COPY docker/sandbox-entrypoint.sh /app/jiuwenswarm/docker/sandbox-entrypoint.sh
+RUN chmod +x /app/jiuwenswarm/docker/sandbox-entrypoint.sh
RUN if [ -z "$PIP_INDEX_URL" ]; then echo "PIP_INDEX_URL is empty" >&2; exit 1; fi && \
TRUSTED_HOST=${PIP_INDEX_URL#*//} && \
@@ -35,5 +37,5 @@ EXPOSE 8321
EXPOSE 8322
ENV JIUWENBOX_LISTEN=http://0.0.0.0:8321
-ENTRYPOINT ["/usr/local/bin/sandbox-entrypoint.sh"]
+ENTRYPOINT ["/app/jiuwenswarm/docker/sandbox-entrypoint.sh"]
CMD ["python3", "-m", "jiuwenbox.server.launcher"]
diff --git a/jiuwenswarm/extensions/redis/redis_client.py b/jiuwenswarm/extensions/redis/redis_client.py
index a2b1069fa4..b0cb8655d5 100644
--- a/jiuwenswarm/extensions/redis/redis_client.py
+++ b/jiuwenswarm/extensions/redis/redis_client.py
@@ -50,6 +50,7 @@ class RedisConfig:
host: str = "localhost"
port: int = 6379
password: str | None = None
+ username: str | None = None
db: int = 0
key_prefix: str = "jiuwenswarm:"
pool_size: int = 10
@@ -85,6 +86,7 @@ class RedisConfig:
if kp and not kp.endswith(":"):
kp = f"{kp}:"
pw = cls._normalize_password(m.get("password"))
+ username = cls._normalize_password(m.get("username"))
mode = str(m.get("mode") or "standalone").strip().lower()
if mode not in ("standalone", "cluster"):
mode = "standalone"
@@ -105,6 +107,7 @@ class RedisConfig:
host=host,
port=port,
password=pw,
+ username=username,
db=_coerce_int(m.get("db"), 0),
key_prefix=kp,
pool_size=max(1, _coerce_int(m.get("pool_size"), 10)),
@@ -157,6 +160,7 @@ class RedisClient:
or [ClusterNode(self._cfg.host, self._cfg.port)]
self._redis = RedisCluster(
startup_nodes=nodes,
+ username=self._cfg.username,
password=self._cfg.password,
decode_responses=True,
socket_connect_timeout=self._cfg.connect_timeout,
@@ -168,7 +172,7 @@ class RedisClient:
self._pool = redis.ConnectionPool(
host=self._cfg.host,
port=self._cfg.port,
- username=None,
+ username=self._cfg.username,
password=self._cfg.password,
db=self._cfg.db,
decode_responses=True,
diff --git a/jiuwenswarm/resources/config.yaml b/jiuwenswarm/resources/config.yaml
index 3f22eb5745..0c14099703 100644
--- a/jiuwenswarm/resources/config.yaml
+++ b/jiuwenswarm/resources/config.yaml
@@ -803,6 +803,7 @@ redis:
host: ${REDIS_HOST:-localhost}
port: ${REDIS_PORT:-6379}
password: ${REDIS_PASSWORD:-}
+ username: ${REDIS_USER:-}
db: ${REDIS_DB:-0}
# Session 数据过期时间(秒)
session_ttl: ${REDIS_SESSION_TTL:-604800}