Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
[fix] fix frontend and backend bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jiashu1024 committed Oct 16, 2023
1 parent 192b94a commit 0166481
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class InitProjectListener implements ApplicationListener<ContextRefreshed

@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
log.info("version : v2.0.3");
log.info("version : v2.0.4");
List<Account> accounts = accountService.getAllAccountCheck();
// List<Account> availableAccounts = accountService.getAvailableAccounts();
int plusCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,11 @@ public void queryAccountLevel(Account account) {

JSONArray objects = JSONUtil.parseArray(models);


List<Model> list = JSONUtil.toList(objects, Model.class);
boolean plus = false;
for (Model model : list) {
Models.modelMap.put(model.getTitle(), model);
redissonClient.getSet(KeyGenerateConfig.MODEL_SET_KEY).addAsync(model.getTitle());
if (model.getSlug().startsWith("gpt-4")) {
Models.plusModelTitle.add(model.getTitle());
plus = true;
Expand Down
Binary file added docs/assets/image-20231016162358709.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/image-20231016162506059.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/image-20231016162554257.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/image-20231016164436817.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/image-20231016164613538.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 37 additions & 12 deletions docs/feishu.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,29 @@

<img src="./assets/image-20230623033948491.png" alt="image-20230623033948491" style="zoom:25%;" />

配置Encrypt Key,自定义个密码输进去就ok了,后面配置文件要用
配置Encrypt Key,自定义个密码或者随机输进去就ok了,后面配置文件需要填

<img src="./assets/image-20230623034003565.png" alt="image-20230623034003565" style="zoom:25%;" />

所有的权限都开通
同时将通讯录下所有权限都开通

将通讯录下以应用身份权限开通

![image-20231016162358709](./assets/image-20231016162358709.png)

同时还需要登录到飞书管理后台(浏览器搜索飞书管理后台,一般第一个点进去就跟我差不多的界面),找到你的应用

![image-20231016162506059](./assets/image-20231016162506059.png)

将可用成员配置成全部成员,否则会报获取用户列表失败错误。需要读取用户列表权限的作用是添加账号时配置账号对哪些用户开放需要以及统计每个用户的使用情况时需要使用。

![image-20231016162554257](./assets/image-20231016162554257.png)

开通消息与群组列表下的权限,开通第一页内所有的即可。作用是应用可以发消息(如果程序启动,日志上并未打印你与机器人发送的私聊消息则检查此处的权限和后续事件订阅里的权限)

<img src="./assets/image-20230623034018518.png" alt="image-20230623034018518" style="zoom:25%;" />



填写application-sample.yaml配置文件,其中 redis 相关的如果用 docker 方式启动可以保持默认

```shell
Expand All @@ -38,7 +52,9 @@ my-config:



配置文件的代理可选择默认用我的代理(已经挂掉),或者自建,相关项目链接: [教程](https://github.com/linweiyuan/go-chatgpt-api)
配置文件的代理可选择自建,相关项目链接: [教程](https://github.com/linweiyuan/go-chatgpt-api)

或者进群找我要代理地址

前端配置.env文件

Expand All @@ -59,20 +75,30 @@ sudo docker-compose logs -f

保证服务器防火墙端口9001打开,前端需要放开 9002 端口

浏览器打开输入http://ip:9001/ping,如果响应pong则9001端口打开了
浏览器打开输入http://ip:9001/ping

如果响应pong则9001端口打开了

配置事件订阅地址,地址为 http://ip:9001/chatEvent

配置事件订阅地址
如果提示添加失败等错误,检查程序是否成功启动,端口是否开放,飞书填写的 url 是否正确,配置文件中 encryptKey 等参数是否配置正确

<img src="./assets/image-20230623034053296.png" alt="image-20230623034053296" style="zoom:25%;" />

配置卡片事件地址
添加订阅的事件,见下图。目的是让程序能订阅到你发给机器人的消息事件

<img src="./assets/image-20230623034110515.png" alt="image-20230623034110515" style="zoom:25%;" />



<img src="./assets/image-20230623034121825.png" alt="image-20230623034121825" style="zoom:25%;" />

添加消息卡片的请求地址

地址为http://ip+9001/cardEvent

![image-20231016164436817](./assets/image-20231016164436817.png)

发布应用

<img src="./assets/image-20230623034141206.png" alt="image-20230623034141206" style="zoom:33%;" />
Expand All @@ -85,11 +111,10 @@ sudo docker-compose logs -f

<img src="./assets/image-20230623034154112.png" alt="image-20230623034154112" style="zoom:25%;" />

搜索你的应用名称

<img src="./assets/image-20230623034214490.png" alt="image-20230623034214490" style="zoom:25%;" />
在前端项目的账号管理页面添加账号即可

私聊即可使用
搜索你的应用名称,私聊即可使用

在前端项目的账号管理页面添加账号即可
![image-20231016164613538](./assets/image-20231016164613538.png)

如果觉得部署太麻烦,也可以进群私聊群主申请加入企业,直接使用我部署好的机器人。
4 changes: 2 additions & 2 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## 概述

前端用 vue 实现(前端菜鸡,写的能用就行)通过前端页面的账号管理页面进行账号的管理和账号权限的配置,同时前端也会展示系统的使用详情,数据统计。通过 ip+默认端口 9002 访问前端页面。
前端用 vue 实现(前端菜鸡,写的能用就行)通过前端页面的账号管理页面进行账号的管理和账号权限的配置,同时前端也会展示系统的使用详情,数据统计。通过 ip+默认端口 9002 访问前端页面(用域名不行,至于为什么我也没来及看)

后端由 springboot 项目,用 redis 存储。默认监听 9001 端口(必须保证防火墙打开)

### 关于账号

账号分为 plus 账号和 free 账号。前端页面中支持对任何一个账号设置权限,例如通过设置账号的创建人,同时默认账号的 plus 模型和 free 模型对飞书企业中所有用户开放,当然也支持配置 plus 能力或者 free 能力对某用户或者某些用户开放。
账号分为 plus 账号和 free 账号。前端页面中支持对任何一个账号设置权限,例如通过设置账号的创建人,同时默认账号的 plus 模型和 free 模型对飞书企业中所有用户开放,当然也支持配置 plus 能力或者 free 能力对某些用户开放

服务方式分为fast模式和keep模式

Expand Down
3 changes: 2 additions & 1 deletion frontend/chatgpt/src/components/AccountManage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,15 @@ export default {
delete this.ruleForm.creator;
addAccount(this.ruleForm)
.then((res) => {
console.log(res);
// console.log(res);
if (res.status == 200) {
let data = res.data;
if (data.success) {
this.$message({
message: data.message,
type: "success",
});
this.clickAddAccountBottonLoading = false;
this.addAccountVisible = false;
this.ruleForm = {};
this.plusTransferData = [];
Expand Down

0 comments on commit 0166481

Please sign in to comment.