chore(server): enable copilot in doc service (#10850)

This commit is contained in:
darkskygit
2025-03-14 07:07:28 +00:00
parent d1c10f5401
commit 95cbdc7900
4 changed files with 34 additions and 3 deletions
+6 -2
View File
@@ -35,7 +35,6 @@ const {
STATIC_IP_NAME, STATIC_IP_NAME,
} = process.env; } = process.env;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const buildType = BUILD_TYPE || 'canary'; const buildType = BUILD_TYPE || 'canary';
const isProduction = buildType === 'stable'; const isProduction = buildType === 'stable';
@@ -136,7 +135,7 @@ const createHelmCommand = ({ isDryRun }) => {
: isInternal : isInternal
? 'internal' ? 'internal'
: 'dev'; : 'dev';
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const host = DEPLOY_HOST || CANARY_DEPLOY_HOST; const host = DEPLOY_HOST || CANARY_DEPLOY_HOST;
const deployCommand = [ const deployCommand = [
`helm upgrade --install affine .github/helm/affine`, `helm upgrade --install affine .github/helm/affine`,
@@ -183,6 +182,11 @@ const createHelmCommand = ({ isDryRun }) => {
`--set renderer.replicaCount=${replica.renderer}`, `--set renderer.replicaCount=${replica.renderer}`,
`--set-string doc.image.tag="${imageTag}"`, `--set-string doc.image.tag="${imageTag}"`,
`--set doc.app.host=${host}`, `--set doc.app.host=${host}`,
`--set doc.app.copilot.enabled=true`,
`--set-string doc.app.copilot.openai.key="${COPILOT_OPENAI_API_KEY}"`,
`--set-string doc.app.copilot.fal.key="${COPILOT_FAL_API_KEY}"`,
`--set-string doc.app.copilot.perplexity.key="${COPILOT_PERPLEXITY_API_KEY}"`,
`--set-string doc.app.copilot.unsplash.key="${COPILOT_UNSPLASH_API_KEY}"`,
`--set doc.replicaCount=${replica.doc}`, `--set doc.replicaCount=${replica.doc}`,
...serviceAnnotations, ...serviceAnnotations,
...resources, ...resources,
@@ -75,6 +75,28 @@ spec:
value: "{{ .Values.app.host }}" value: "{{ .Values.app.host }}"
- name: AFFINE_SERVER_HTTPS - name: AFFINE_SERVER_HTTPS
value: "{{ .Values.app.https }}" value: "{{ .Values.app.https }}"
{{ if .Values.app.copilot.enabled }}
- name: COPILOT_OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: "{{ .Values.app.copilot.secretName }}"
key: openaiSecret
- name: COPILOT_FAL_API_KEY
valueFrom:
secretKeyRef:
name: "{{ .Values.app.copilot.secretName }}"
key: falSecret
- name: COPILOT_PERPLEXITY_API_KEY
valueFrom:
secretKeyRef:
name: "{{ .Values.app.copilot.secretName }}"
key: perplexitySecret
- name: COPILOT_UNSPLASH_API_KEY
valueFrom:
secretKeyRef:
name: "{{ .Values.app.copilot.secretName }}"
key: unsplashSecret
{{ end }}
ports: ports:
- name: http - name: http
containerPort: {{ .Values.global.docService.port }} containerPort: {{ .Values.global.docService.port }}
@@ -15,6 +15,11 @@ app:
# AFFINE_SERVER_HOST # AFFINE_SERVER_HOST
host: '0.0.0.0' host: '0.0.0.0'
https: true https: true
copilot:
enabled: false
secretName: copilot
openai:
key: ''
serviceAccount: serviceAccount:
create: true create: true
annotations: {} annotations: {}
@@ -60,7 +60,7 @@ registerCopilotProvider(PerplexityProvider);
controllers: [CopilotController], controllers: [CopilotController],
contributesTo: ServerFeature.Copilot, contributesTo: ServerFeature.Copilot,
if: config => { if: config => {
if (config.flavor.graphql) { if (config.flavor.graphql || config.flavor.doc) {
return assertProvidersConfigs(config); return assertProvidersConfigs(config);
} }
return false; return false;