Skip to content

Commit

Permalink
[feature] 删除多余代码逻辑
Browse files Browse the repository at this point in the history
**Phenomenon and reproduction steps**

**Root cause and solution**

**Impactions**

**Test method**

**Affected branch(es)**

* main

**Checklist**

- [ ] Dependencies update required
- [ ] Common bug (similar problem in other repo)
  • Loading branch information
congxi committed May 30, 2024
1 parent 4eb104d commit 60eb663
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 580 deletions.
22 changes: 7 additions & 15 deletions deploy/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: df-llm-agent
name: df-llm-agent-ce
namespace: deepflow
data:
df-llm-agent.yaml: |-
Expand All @@ -12,26 +12,18 @@ data:
log_file: /var/log/df-llm-agent.log
log_level: info
instance_path: /root/df-llm-agent
redis:
host:
- redis
cluster_enabled: False # True,False
port: 6379
db: 6
password: "password123"
mysql:
user_name: root
user_password: password123
host: mysql
port: 30130
database: deepflow_llm
ai:
enable: False # True,False
enable: False
platforms:
-
enable: False
platform: "azure"
enable: False
model: "gpt"
api_type: "azure"
api_key: ""
Expand All @@ -40,25 +32,25 @@ data:
engine_name:
- ""
-
enable: False
platform: "aliyun"
enable: False
model: "dashscope"
api_key: ""
engine_name:
- "qwen-turbo"
- "qwen-plus"
-
enable: False
platform: "baidu"
enable: False
model: "qianfan"
api_key: ""
api_secre: ""
api_secret: ""
engine_name:
- "ERNIE-Bot"
- "ERNIE-Bot-turbo"
-
enable: False
platform: "zhipu"
enable: False
model: "zhipuai"
api_key: ""
engine_name:
Expand Down
18 changes: 9 additions & 9 deletions deploy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: df-llm-agent-deployment
name: df-llm-agent-deployment-ce
namespace: deepflow
labels:
component: df-llm-agent
component: df-llm-agent-ce
spec:
replicas: 1
selector:
matchLabels:
component: df-llm-agent
component: df-llm-agent-ce
template:
metadata:
labels:
component: df-llm-agent
component: df-llm-agent-ce
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: df-llm-agent
image: "hub.deepflow.yunshan.net/dev/df-llm-agent:latest"
- name: df-llm-agent-ce
image: "ghcr.io/deepflowio/deepflow-ce/deepflowio-stella-agent-ce:latest-5"
imagePullPolicy: Always
volumeMounts:
- name: debug-path
mountPath: /root/debug
- mountPath: /etc/web/df-llm-agent.yaml
name: web-volumes-df-llm-agent
name: web-volumes-df-llm-agent-ce
subPath: df-llm-agent.yaml
volumes:
- name: debug-path
hostPath:
type: DirectoryOrCreate
path: /usr/local/deepflow/debug/
- name: web-volumes-df-llm-agent
- name: web-volumes-df-llm-agent-ce
configMap:
name: df-llm-agent
name: df-llm-agent-ce
items:
- key: df-llm-agent.yaml
path: df-llm-agent.yaml
30 changes: 0 additions & 30 deletions deploy/templates/deployment_mysql.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions deploy/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v1
kind: Service
metadata:
name: df-llm-agent
name: df-llm-agent-ce
namespace: deepflow
spec:
ports:
Expand All @@ -13,5 +13,5 @@ spec:
protocol: TCP
name: http
selector:
component: df-llm-agent
component: df-llm-agent-ce
type: NodePort
17 changes: 0 additions & 17 deletions deploy/templates/service_mysql.yaml

This file was deleted.

44 changes: 1 addition & 43 deletions df-llm-agent/database/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,46 +50,4 @@ CREATE TABLE IF NOT EXISTS score(
updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX `user_id` (`user_id`)
)ENGINE=innodb DEFAULT CHARSET=utf8 COMMENT='评分';
TRUNCATE TABLE score;


CREATE TABLE IF NOT EXISTS llm_config(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
user_id INTEGER NOT NULL DEFAULT 0,
`platform` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '平台: azure、aliyun、baidu、tencent',
`model` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '模型统称,例如 azure: openai, 阿里: dashscope, 百度: qianfan, 腾讯: hyllm',
`model_info` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '模型相关具体细节',
`key` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '模型需要的配置项',
`value` VARCHAR(256) NOT NULL DEFAULT '' COMMENT '模型需要的配置项的值',
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX `user_id` (`user_id`),
UNIQUE KEY `unique_engine` (`user_id`,`platform`,`model`,`key`,`value`)
)ENGINE=innodb DEFAULT CHARSET=utf8 COMMENT='llm 配置';
TRUNCATE TABLE llm_config;

INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'azure','gpt','enable',0);
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'azure','gpt','api_key','');
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'azure','gpt','api_type','azure');
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'azure','gpt','api_base','');
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'azure','gpt','api_version','');
-- INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'azure','gpt','engine_name','');

-- INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'openai','gpt','enable',0);
-- INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'openai','gpt','api_key','');

INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'aliyun','dashscope','enable',0);
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'aliyun','dashscope','api_key','');
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'aliyun','dashscope','engine_name','qwen-turbo');
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'aliyun','dashscope','engine_name','qwen-plus');


INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'baidu','qianfan','enable',0);
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'baidu','qianfan','api_key','');
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'baidu','qianfan','api_secre','');
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'baidu','qianfan','engine_name','ERNIE-Bot');
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'baidu','qianfan','engine_name','ERNIE-Bot-turbo');

INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'zhipu','zhipuai','enable',0);
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'zhipu','zhipuai','api_key','');
INSERT INTO llm_config (`user_id`,`platform`,`model`,`key`,`value`) VALUES (1,'zhipu','zhipuai','engine_name','chatglm_turbo');
TRUNCATE TABLE score;
34 changes: 0 additions & 34 deletions df-llm-agent/llm_agent_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
# 配置必须属于一个用户


@llm_agent_app.route("/llm_agent_config", methods=["POST"])
@wrap_resp
async def llm_agent_config_add(request):
worker = app_worker(request)
res = await worker.llm_agent_config_add()
return res


@llm_agent_app.route("/llm_agent_config/<platform:str>", name="by_platform")
@llm_agent_app.route("/llm_agent_config")
@wrap_resp
Expand All @@ -27,22 +19,6 @@ async def llm_agent_config_list(request, platform=""):
return res


@llm_agent_app.route("/llm_agent_config/<platform:str>/<key_name:str>", methods=["PATCH"])
@wrap_resp
async def llm_agent_config_update(request, platform="", key_name=""):
worker = app_worker(request)
res = await worker.llm_agent_config_update(platform, key_name)
return res


@llm_agent_app.route("/llm_agent_config/<platform:str>/<engine_name:str>", methods=["DELETE"])
@wrap_resp
async def llm_agent_config_delete(request, platform="", engine_name=""):
worker = app_worker(request)
res = await worker.llm_agent_config_delete(platform, engine_name)
return res


# 流返回
@llm_agent_app.route("/ai/stream/<platform:str>", methods=["POST"])
@wrap_resp_stream
Expand All @@ -51,13 +27,3 @@ async def llm_agent_stream_system(request, platform=""):
# 流数据
res = await worker.llm_agent_stream(platform)
return res

# 组件


@llm_agent_app.route("/ai/azure/deepflow/modules", methods=["POST"])
@wrap_resp
async def llm_agent_module(request):
worker = app_worker(request)
res = await worker.llm_agent_module(platform='azure')
return res
Loading

0 comments on commit 60eb663

Please sign in to comment.