forked from infinilabs/coco-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoco.yml
More file actions
431 lines (418 loc) · 12.7 KB
/
coco.yml
File metadata and controls
431 lines (418 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
env:
ES_ENDPOINT: https://localhost:9200
ES_USERNAME: admin
ES_PASSWORD: $[[keystore.ES_PASSWORD]]
WEB_BINDING: 0.0.0.0:9000
API_BINDING: 0.0.0.0:2900
coco:
server:
public: false
name: "My Coco Server"
encode_icon_to_base64: false # enable this if coco-server is using self-signed certs
# #[START] for managed mode only, need to configured by coco-server operator
# endpoint: "http://localhost:9001/"
# auth_provider: #config for app to use
# sso:
# url: "http://localhost:9001/#/login"
# #[END] for managed mode only
minimal_client_version:
number: "0.3"
provider:
name: "INFINI Labs"
description: "Coco AI Server - Search, Connect, Collaborate, AI-powered enterprise search, all in one space."
icon: "https://coco.rs/favicon.ico"
website: "https://coco.rs/"
eula: "https://coco.rs/#/terms"
privacy_policy: "https://coco.rs/privacy"
banner: "https://coco.rs/svg/connect.svg"
#[START] for managed mode only, config for coco-server to use
auth_provider:
sso:
url: "/sso/login/cloud?provider=coco-cloud&product=coco"
#[END] for managed mode only
## Cleanup exists data:
# curl -u admin:45ff432a5428ade77c7b -k -XDELETE https://localhost:9200/_template/coco-search
# curl -u admin:45ff432a5428ade77c7b -k -XDELETE https://localhost:9200/_template/coco
# curl -u admin:45ff432a5428ade77c7b -k -XDELETE https://localhost:9200/_scripts/coco-query-string
# curl -u admin:45ff432a5428ade77c7b -k -XDELETE https://localhost:9200/_scripts/coco-query-string-extra-should
# curl -u admin:45ff432a5428ade77c7b -k -XDELETE https://localhost:9200/coco_*
elastic:
elasticsearch: prod
enabled: true
store:
enabled: false
orm:
enabled: true
index_prefix: "coco_"
override_exists_template: true
index_templates:
"coco-search": |
{
"order": 10,
"index_patterns": [
"coco_*"
],
"settings": {
"index": {
"analysis": {
"char_filter": {
"tsconvert" : {
"type" : "stconvert",
"delimiter" : ",",
"keep_both" : false,
"convert_type" : "t2s"
}
},
"tokenizer": {
"my_pinyin": {
"type": "pinyin",
"keep_first_letter": true,
"keep_separate_first_letter": true,
"keep_full_pinyin": true,
"keep_original": false,
"limit_first_letter_length": 16,
"lowercase": true
}
},
"analyzer": {
"pinyin_analyzer": {
"tokenizer": "my_pinyin"
},
"combined_text_analyzer": {
"char_filter": ["tsconvert"],
"filter": [
"lowercase",
"asciifolding",
"word_delimiter",
"unique"
],
"tokenizer": "classic"
}
}
}
}
},
"mappings": {}
}
search_templates:
"coco-query-string": |
{
"from": "{{from}}",
"size": "{{size}}",
"_source": {
"includes": [ "{{#source}}","{{.}}","{{/source}}"],
"excludes": [ "payload.*","content" ]
},
"query": {
"bool": {
"must": {{#toJson}}must_clauses{{/toJson}},
"must_not": [],
"should": [
{{#query}}
{
"prefix": {
"{{field}}.keyword": {
"value": "{{query}}",
"boost": 100
}
}
},
{
"match_phrase_prefix": {
"{{field}}": {
"query": "{{query}}",
"boost": 50
}
}
},
{
"match_phrase": {
"{{field}}": {
"query": "{{query}}",
"boost": 30
}
}
},
{
"match": {
"{{field}}": {
"query": "{{query}}",
"fuzziness": "AUTO",
"max_expansions": 10,
"boost": 5,
"prefix_length": 2,
"operator": "and",
"fuzzy_transpositions": true
}
}
},
{
"query_string": {
"fields": ["{{field}}","{{field}}.keyword^10","combined_fulltext"],
"query": "{{query}}",
"fuzziness": "AUTO",
"fuzzy_prefix_length": 2,
"fuzzy_max_expansions": 10,
"boost": 3,
"default_operator": "AND",
"fuzzy_transpositions": true,
"allow_leading_wildcard": false
}
},{"match": {
"{{field}}.pinyin": {
"query": "{{query}}",
"boost": 4
}
}}
{{/query}}
]
}
}
}
"coco-query-string-extra-should": |
{
"from": "{{from}}",
"size": "{{size}}",
"_source": {
"includes": [ "{{#source}}","{{.}}","{{/source}}"],
"excludes": [ "payload.*","content" ]
},
"query": {
"bool": {
"must": {{#toJson}}must_clauses{{/toJson}},
"must_not": [],
"should": [
{{#query}}
{
"prefix": {
"{{field}}.keyword": {
"value": "{{query}}",
"boost": 100
}
}
},
{
"match_phrase_prefix": {
"{{field}}": {
"query": "{{query}}",
"boost": 50
}
}
},
{
"match_phrase": {
"{{field}}": {
"query": "{{query}}",
"boost": 30
}
}
},
{
"match": {
"{{field}}": {
"query": "{{query}}",
"fuzziness": "AUTO",
"max_expansions": 10,
"prefix_length": 2,
"boost": 5,
"fuzzy_transpositions": true
}
}
},
{
"query_string": {
"fields": ["{{field}}","{{field}}.keyword^10","combined_fulltext"],
"query": "{{query}}",
"fuzziness": "AUTO",
"fuzzy_prefix_length": 2,
"default_operator": "AND",
"boost": 3,
"fuzzy_max_expansions": 10,
"fuzzy_transpositions": true,
"allow_leading_wildcard": false
}
},{"match": {
"{{field}}.pinyin": {
"query": "{{query}}",
"boost": 4
}
}}
{{/query}}
,{{#toJson}}extra_should_clauses{{/toJson}}
]
}
}
}
elasticsearch:
- name: prod
enabled: true
endpoints:
- $[[env.ES_ENDPOINT]]
discovery:
enabled: false
basic_auth:
username: $[[env.ES_USERNAME]]
password: $[[env.ES_PASSWORD]]
api:
enabled: true
websocket:
enabled: false
network:
binding: $[[env.API_BINDING]]
web:
enabled: true
embedding_api: false
network:
binding: $[[env.WEB_BINDING]]
tls:
enabled: false
skip_insecure_verify: true
default_domain: "localhost:2900"
# default_domain: "api.coco.rs"
auto_issue:
enabled: false
email: "hello@infinilabs.com"
include_default_domain: true
domains:
- "www.coco.rs"
provider:
tencent_dns:
secret_id: $[[keystore.TENCENT_DNS_ID]] #./bin/coco keystore add TENCENT_DNS_ID
secret_key: $[[keystore.TENCENT_DNS_KEY]] #./bin/coco keystore add TENCENT_DNS_KEY
security:
enabled: true
managed: false #remote managed instance
authentication:
oauth:
cloud:
enabled: true
client_secret: "999999"
authorize_url: "http://localhost:9000/oauth/authorize"
token_url: "http://localhost:9000/oauth/token"
profile_url: "http://localhost:9000/account/profile"
redirect_url: "http://localhost:9001/sso/callback/cloud"
success_page: "/#/home"
# failed_page: "/#/user/sso/failed"
scopes: [ "openid","email","profile"]
connector:
google_drive: # get your token here: https://developers.google.com/drive/api/quickstart/go
enabled: true
queue:
name: indexing_documents
interval: 10s
skip_invalid_token: true
yuque:
enabled: true
queue:
name: indexing_documents
interval: 10s
hugo_site:
enabled: true
interval: 10s
queue:
name: indexing_documents
notion:
enabled: true
interval: 10s
queue:
name: indexing_documents
rss:
enabled: true
interval: 10s
queue:
name: indexing_documents
local_fs:
enabled: true
interval: 10s
queue:
name: indexing_documents
s3:
enabled: true
interval: 30s
queue:
name: indexing_documents
confluence:
enabled: true
interval: 5m
queue:
name: indexing_documents
network_drive:
enabled: true
interval: 30s
queue:
name: indexing_documents
##background jobs
pipeline:
- name: enrich_documents
auto_start: false
keep_running: true
processor:
- consumer:
auto_commit_offset: true
queue_selector:
keys:
- indexing_documents
consumer:
group: enriched_documents
fetch_max_messages: 10
processor:
- document_enrichment:
model: $[[env.ENRICHMENT_MODEL]]
input_queue: "indexing_documents"
min_input_document_length: 500
output_queue:
name: "enriched_documents"
label:
tag: "enriched"
- name: merge_documents
auto_start: true
keep_running: true
processor:
- indexing_merge:
input_queue: "indexing_documents"
# input_queue: "enriched_documents"
idle_timeout_in_seconds: 1
elasticsearch: "prod"
index_name: "coco_document-v2"
key_field: "id"
output_queue:
name: "merged_documents"
label:
tag: "merged"
worker_size: 1
bulk_size_in_kb: 10240
- name: ingest_documents
auto_start: true
keep_running: true
processor:
- bulk_indexing:
bulk:
compress: true
batch_size_in_mb: 10
batch_size_in_docs: 10240
consumer:
fetch_max_messages: 100
queues:
type: indexing_merge
tag: "merged"
http_client:
default:
proxy:
enabled: false
default_config:
http_proxy: http://127.0.0.1:7890
socket5_proxy: socks5://127.0.0.1:7890
override_system_proxy_env: true #override system proxy's environment settings with this proxy settings
permitted:
- "google.com"
denied:
- "localhost"
- "www.yuque.com"
- "yuque.com"
- "infinilabs.com"
- "api.coco.rs"
- "dashscope.aliyuncs.com"
domains:
"github.com":
http_proxy: http://127.0.0.1:7890
socket5_proxy: socks5://127.0.0.1:7890