mirror of
https://github.com/mii443/ncb-tts-r2.git
synced 2025-08-22 16:15:29 +00:00
add kubernetes manifest, add code block regex
This commit is contained in:
56
manifest/ncb-tts.yaml
Normal file
56
manifest/ncb-tts.yaml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: ncb-tts-deployment
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: ncb-tts
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: ncb-tts
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: redis
|
||||||
|
image: redis:7.0.4-alpine
|
||||||
|
ports:
|
||||||
|
- containerPort: 6379
|
||||||
|
name: ncb-redis
|
||||||
|
volumeMounts:
|
||||||
|
- name: ncb-redis-pvc
|
||||||
|
mountPath: /data
|
||||||
|
- name: tts
|
||||||
|
image: ghcr.io/morioka22/ncb-tts-r2
|
||||||
|
volumeMounts:
|
||||||
|
- name: gcp-credentials
|
||||||
|
mountPath: /ncb-tts-r2/credentials.json
|
||||||
|
subPath: credentials.json
|
||||||
|
env:
|
||||||
|
- name: NCB_REDIS_URL
|
||||||
|
value: "redis://localhost:6379/"
|
||||||
|
- name: NCB_PREFIX
|
||||||
|
value: "t2!"
|
||||||
|
- name: NCB_TOKEN
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: ncb-secret
|
||||||
|
key: BOT_TOKEN
|
||||||
|
- name: NCB_VOICEVOX_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: ncb-secret
|
||||||
|
key: VOICEVOX_KEY
|
||||||
|
- name: NCB_APP_ID
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: ncb-secret
|
||||||
|
key: APP_ID
|
||||||
|
volumes:
|
||||||
|
- name: ncb-redis-pvc
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: ncb-redis-pvc
|
||||||
|
- name: gcp-credentials
|
||||||
|
secret:
|
||||||
|
secretName: gcp-credentials
|
12
manifest/pvc.yaml
Normal file
12
manifest/pvc.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: ncb-redis-pvc
|
||||||
|
labels:
|
||||||
|
app: ncb-redis
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 3Gi
|
@ -2,5 +2,7 @@ use regex::Regex;
|
|||||||
|
|
||||||
pub fn remove_url(text: String) -> String {
|
pub fn remove_url(text: String) -> String {
|
||||||
let url_regex = Regex::new(r"(http://|https://){1}[\w\.\-/:\#\?=\&;%\~\+]+").unwrap();
|
let url_regex = Regex::new(r"(http://|https://){1}[\w\.\-/:\#\?=\&;%\~\+]+").unwrap();
|
||||||
url_regex.replace_all(&text, " URL ").to_string()
|
let code_regex = Regex::new(r"```(.*)```").unwrap();
|
||||||
|
let text = url_regex.replace_all(&text, " URL ").to_string();
|
||||||
|
code_regex.replace_all(&text, "code").to_string()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user