Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(web): fix installation #224

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,49 @@ web 版本前后端源码,效果同 https://openxlab.org.cn/apps/detail/tpoiso

## 启动

1. 设置环境变量,启动 redis-server(修改 `/etc/redis/redis.conf` 中的 `requirepass` 配置密码)。必须
1. 先安装 Redis,如果你已经安装 Redis 服务,并且配置好了 Redis 密码,启动了 Redis 服务,直接跳过这一步即可。

```bash
# 以 Ubuntu 系统为例
# 安装 Redis 服务和客户端
sudo apt install redis-server redis-tools

# 设置 Redis 密码(默认配置文件在/etc/redis/redis.conf),比如设置为:redis123
sudo vim /etc/redis/redis.conf
# 将 requirepass your_password_here 注释打开并修改为如下内容,保存即可
requirepass redis123

# 启动redis
sudo redis-server /etc/redis/redis.conf
# 查看redis是否启动成功
netstat -nlpt | grep redis
```

2. 设置环境变量,需要配置的环境变量如下(你可以将这些环境变量添加到~/.bashrc文件的末尾,然后 `source ~/.bashrc` 刷新配置)

```bash
$ cat env.sh

export PYTHONUNBUFFERED=1
# Redis 的 IP 地址
export REDIS_HOST=10.1.52.22
# Redis 的密码
export REDIS_PASSWORD=${REDIS_PASSWORD}
# Redis 的端口,默认为 6379
export REDIS_PORT=6380
# JWT_SECRET 是指用于签名 JSON Web Token (JWT) 的密钥或密钥对,可以使用 `openssl rand -base64 32` 命令生成
export JWT_SECRET=${JWT_SEC}
# 茴香豆的后台服务端口,可以自定义
export SERVER_PORT=7860
# 飞书的 LARK_ENCRYPT_KEY,参考地址:https://open.larksuite.com/document/server-docs/event-subscription/event-subscription-configure-/request-url-configuration-case
# 如果不需要接通飞书忽略即可
export HUIXIANGDOU_LARK_ENCRYPT_KEY=thisiskey
export HUIXIANGDOU_LARK_VERIFY_TOKEN=sMzyjKi9vMlEhKCZOVtBMhhl8x23z0AG

# set your service endpoint(open to Internet callback from lark and wechat)
# 回调地址端口,建议填写 127.0.0.1:7860,然后将 7860 端口通过公网 IP 代理出去,例如 http://10.1.52.36:18443
export HUIXIANGDOU_MESSAGE_ENDPOINT=http://10.1.52.36:18443
# 如果使用 https 安全连接就把 COOKIE_SECURE 设置为 1;如果不是,则将 `export COOKIE_SECURE=1` 替换为 `unset COOKIE_SECURE`
export COOKIE_SECURE=1
```
⚠️ 重要事项: 如果不用 https 安全链接,需要 `unset COOKIE_SECURE`(不是设成 0)。否则知识库登录会异常
Expand All @@ -35,10 +62,9 @@ export COOKIE_SECURE=1
> https://10.1.2.22 不是,取消 cookie
>
> http://101.204.1.5 不是
>


2. 编译前端 & 运行后端服务
3. 编译前端 & 运行后端服务

安装 Node.js `npm` (需要版本为 20.x , 安装时, 可根据用户权限需要自行添加 sudo + 命令)

Expand Down
2 changes: 1 addition & 1 deletion web/service/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_query_info(cls, query_id: str,
@classmethod
def mget_query_info(
cls, query_id_list: List[str],
feature_store_id: str) -> Union[list[ChatQueryInfo], None]:
feature_store_id: str) -> Union[List[ChatQueryInfo], None]:
key = biz_constant.RDS_KEY_QUERY_INFO + ':' + feature_store_id
o = r.hmget(key, query_id_list)
if not o or len(o) == 0:
Expand Down
Loading