Kevin Hu commited on
Commit
587bed3
·
1 Parent(s): de9090d

mv service_conf.yaml to conf/ and fix: add 'answer' as a parameter to 'generate' (#3379)

Browse files

### What problem does this PR solve?
#3373

### Type of change

- [x] Refactoring
- [x] Bug fix

agent/component/base.py CHANGED
@@ -399,7 +399,7 @@ class ComponentBase(ABC):
399
  self._param.check()
400
 
401
  def get_dependent_components(self):
402
- cpnts = [para["component_id"] for para in self._param.query]
403
  return cpnts
404
 
405
  def run(self, history, **kwargs):
 
399
  self._param.check()
400
 
401
  def get_dependent_components(self):
402
+ cpnts = [para["component_id"] for para in self._param.query if para["component_id"].lower().find("answer") < 0]
403
  return cpnts
404
 
405
  def run(self, history, **kwargs):
agent/component/generate.py CHANGED
@@ -63,7 +63,7 @@ class Generate(ComponentBase):
63
  component_name = "Generate"
64
 
65
  def get_dependent_components(self):
66
- cpnts = [para["component_id"] for para in self._param.parameters]
67
  return cpnts
68
 
69
  def set_cite(self, retrieval_res, answer):
 
63
  component_name = "Generate"
64
 
65
  def get_dependent_components(self):
66
+ cpnts = [para["component_id"] for para in self._param.parameters if para["component_id"].lower().find("answer") < 0]
67
  return cpnts
68
 
69
  def set_cite(self, retrieval_res, answer):
api/apps/sdk/doc.py CHANGED
@@ -1082,7 +1082,7 @@ def rm_chunk(tenant_id, dataset_id, document_id):
1082
  if chunk_number != 0:
1083
  DocumentService.decrement_chunk_num(document_id, dataset_id, 1, chunk_number, 0)
1084
  if "chunk_ids" in req and chunk_number != len(req["chunk_ids"]):
1085
- return get_error_data_result(message=f"rm_chunk deleted chunks {chunk_number}, expect {len(req["chunk_ids"])}")
1086
  return get_result(message=f"deleted {chunk_number} chunks")
1087
 
1088
 
 
1082
  if chunk_number != 0:
1083
  DocumentService.decrement_chunk_num(document_id, dataset_id, 1, chunk_number, 0)
1084
  if "chunk_ids" in req and chunk_number != len(req["chunk_ids"]):
1085
+ return get_error_data_result(message=f"rm_chunk deleted chunks {chunk_number}, expect {len(req['chunk_ids'])}")
1086
  return get_result(message=f"deleted {chunk_number} chunks")
1087
 
1088
 
api/settings.py CHANGED
@@ -191,7 +191,7 @@ AUTHENTICATION_DEFAULT_TIMEOUT = 7 * 24 * 60 * 60 # s
191
  PRIVILEGE_COMMAND_WHITELIST = []
192
  CHECK_NODES_IDENTITY = False
193
 
194
- if 'username' in get_base_config("es", {}):
195
  docStoreConn = rag.utils.es_conn.ESConnection()
196
  else:
197
  docStoreConn = rag.utils.infinity_conn.InfinityConnection()
 
191
  PRIVILEGE_COMMAND_WHITELIST = []
192
  CHECK_NODES_IDENTITY = False
193
 
194
+ if 'hosts' in get_base_config("es", {}):
195
  docStoreConn = rag.utils.es_conn.ESConnection()
196
  else:
197
  docStoreConn = rag.utils.infinity_conn.InfinityConnection()
conf/service_conf.yaml DELETED
@@ -1 +0,0 @@
1
- ../docker/service_conf.yaml
 
 
conf/service_conf.yaml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ragflow:
2
+ host: 0.0.0.0
3
+ http_port: 9380
4
+ mysql:
5
+ name: 'rag_flow'
6
+ user: 'root'
7
+ password: 'infini_rag_flow'
8
+ host: 'mysql'
9
+ port: 3306
10
+ max_connections: 100
11
+ stale_timeout: 30
12
+ minio:
13
+ user: 'rag_flow'
14
+ password: 'infini_rag_flow'
15
+ host: 'minio:9000'
16
+ es:
17
+ hosts: 'http://es01:9200'
18
+ username: 'elastic'
19
+ password: 'infini_rag_flow'
20
+ redis:
21
+ db: 1
22
+ password: 'infini_rag_flow'
23
+ host: 'redis:6379'
24
+
25
+ # postgres:
26
+ # name: 'rag_flow'
27
+ # user: 'rag_flow'
28
+ # password: 'infini_rag_flow'
29
+ # host: 'postgres'
30
+ # port: 5432
31
+ # max_connections: 100
32
+ # stale_timeout: 30
33
+ # s3:
34
+ # endpoint: 'endpoint'
35
+ # access_key: 'access_key'
36
+ # secret_key: 'secret_key'
37
+ # region: 'region'
38
+ # azure:
39
+ # auth_type: 'sas'
40
+ # container_url: 'container_url'
41
+ # sas_token: 'sas_token'
42
+ # azure:
43
+ # auth_type: 'spn'
44
+ # account_url: 'account_url'
45
+ # client_id: 'client_id'
46
+ # secret: 'secret'
47
+ # tenant_id: 'tenant_id'
48
+ # container_name: 'container_name'
49
+ # user_default_llm:
50
+ # factory: 'Tongyi-Qianwen'
51
+ # api_key: 'sk-xxxxxxxxxxxxx'
52
+ # base_url: ''
53
+ # oauth:
54
+ # github:
55
+ # client_id: xxxxxxxxxxxxxxxxxxxxxxxxx
56
+ # secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
57
+ # url: https://github.com/login/oauth/access_token
58
+ # feishu:
59
+ # app_id: cli_xxxxxxxxxxxxxxxxxxx
60
+ # app_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
61
+ # app_access_token_url: https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal
62
+ # user_access_token_url: https://open.feishu.cn/open-apis/authen/v1/oidc/access_token
63
+ # grant_type: 'authorization_code'
64
+ # authentication:
65
+ # client:
66
+ # switch: false
67
+ # http_app_key:
68
+ # http_secret_key:
69
+ # site:
70
+ # switch: false
71
+ # permission:
72
+ # switch: false
73
+ # component: false
74
+ # dataset: false
docker/docker-compose.yml CHANGED
@@ -15,7 +15,6 @@ services:
15
  - 80:80
16
  - 443:443
17
  volumes:
18
- - ./service_conf.yaml:/ragflow/conf/service_conf.yaml
19
  - ./ragflow-logs:/ragflow/logs
20
  - ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf
21
  - ./nginx/proxy.conf:/etc/nginx/proxy.conf
 
15
  - 80:80
16
  - 443:443
17
  volumes:
 
18
  - ./ragflow-logs:/ragflow/logs
19
  - ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf
20
  - ./nginx/proxy.conf:/etc/nginx/proxy.conf
docker/service_conf.yaml DELETED
@@ -1,74 +0,0 @@
1
- ragflow:
2
- host: 0.0.0.0
3
- http_port: 9380
4
- mysql:
5
- name: 'rag_flow'
6
- user: 'root'
7
- password: 'infini_rag_flow'
8
- host: 'mysql'
9
- port: 3306
10
- max_connections: 100
11
- stale_timeout: 30
12
- minio:
13
- user: 'rag_flow'
14
- password: 'infini_rag_flow'
15
- host: 'minio:9000'
16
- es:
17
- hosts: 'http://es01:9200'
18
- username: 'elastic'
19
- password: 'infini_rag_flow'
20
- redis:
21
- db: 1
22
- password: 'infini_rag_flow'
23
- host: 'redis:6379'
24
-
25
- # postgres:
26
- # name: 'rag_flow'
27
- # user: 'rag_flow'
28
- # password: 'infini_rag_flow'
29
- # host: 'postgres'
30
- # port: 5432
31
- # max_connections: 100
32
- # stale_timeout: 30
33
- # s3:
34
- # endpoint: 'endpoint'
35
- # access_key: 'access_key'
36
- # secret_key: 'secret_key'
37
- # region: 'region'
38
- # azure:
39
- # auth_type: 'sas'
40
- # container_url: 'container_url'
41
- # sas_token: 'sas_token'
42
- # azure:
43
- # auth_type: 'spn'
44
- # account_url: 'account_url'
45
- # client_id: 'client_id'
46
- # secret: 'secret'
47
- # tenant_id: 'tenant_id'
48
- # container_name: 'container_name'
49
- # user_default_llm:
50
- # factory: 'Tongyi-Qianwen'
51
- # api_key: 'sk-xxxxxxxxxxxxx'
52
- # base_url: ''
53
- # oauth:
54
- # github:
55
- # client_id: xxxxxxxxxxxxxxxxxxxxxxxxx
56
- # secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
57
- # url: https://github.com/login/oauth/access_token
58
- # feishu:
59
- # app_id: cli_xxxxxxxxxxxxxxxxxxx
60
- # app_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
61
- # app_access_token_url: https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal
62
- # user_access_token_url: https://open.feishu.cn/open-apis/authen/v1/oidc/access_token
63
- # grant_type: 'authorization_code'
64
- # authentication:
65
- # client:
66
- # switch: false
67
- # http_app_key:
68
- # http_secret_key:
69
- # site:
70
- # switch: false
71
- # permission:
72
- # switch: false
73
- # component: false
74
- # dataset: false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rag/benchmark.py CHANGED
@@ -33,6 +33,7 @@ from tqdm import tqdm
33
  global max_docs
34
  max_docs = sys.maxsize
35
 
 
36
  class Benchmark:
37
  def __init__(self, kb_id):
38
  self.kb_id = kb_id
 
33
  global max_docs
34
  max_docs = sys.maxsize
35
 
36
+
37
  class Benchmark:
38
  def __init__(self, kb_id):
39
  self.kb_id = kb_id
rag/utils/infinity_conn.py CHANGED
@@ -312,7 +312,7 @@ class InfinityConnection(DocStoreConnection):
312
  for k, v in d.items():
313
  if k.endswith("_kwd") and isinstance(v, list):
314
  d[k] = " ".join(v)
315
- ids = [f"'{d["id"]}'" for d in documents]
316
  str_ids = ", ".join(ids)
317
  str_filter = f"id IN ({str_ids})"
318
  table_instance.delete(str_filter)
 
312
  for k, v in d.items():
313
  if k.endswith("_kwd") and isinstance(v, list):
314
  d[k] = " ".join(v)
315
+ ids = [f"{d['id']}" for d in documents]
316
  str_ids = ", ".join(ids)
317
  str_filter = f"id IN ({str_ids})"
318
  table_instance.delete(str_filter)