Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ This feature is hidden by default and can be enabled using the following schema:
A `default` list of variables can be provided as an example for the user.

### aiAssistant.json
This schema is used to inject the configuration of an AI Assistant into your service.
This schema is used to inject the configuration of an AI Assistant into your service.
```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
Expand Down
2 changes: 1 addition & 1 deletion charts/library-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v2
name: library-chart
version: 2.0.4
version: 2.0.5
type: library
42 changes: 42 additions & 0 deletions charts/library-chart/templates/_secret_ia.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{/* vim: set filetype=mustache: */}}

{{/* Return the IA assistant config, preferring top-level aiAssistant over legacy userPreferences.aiAssistant */}}
{{- define "library-chart.aiAssistant" -}}
{{- $userPreferences := get .Values "userPreferences" | default dict -}}
{{- $legacyAiAssistant := get $userPreferences "aiAssistant" | default dict -}}
{{- $aiAssistant := get .Values "aiAssistant" | default dict -}}
{{- mergeOverwrite (dict) $legacyAiAssistant $aiAssistant | toJson -}}
{{- end }}

{{/* Create the name of the generic IA secret to use */}}
{{- define "library-chart.secretNameIa" -}}
{{- $aiAssistant := include "library-chart.aiAssistant" . | fromJson -}}
{{- if $aiAssistant.enabled }}
{{- $name := printf "%s-secretia" (include "library-chart.fullname" .) }}
{{- default $name $aiAssistant.secretName }}
{{- else }}
{{- default "default" $aiAssistant.secretName }}
{{- end }}
{{- end }}

{{/* Template to generate a generic IA secret */}}
{{- define "library-chart.secretIa" -}}
{{- $aiAssistant := include "library-chart.aiAssistant" . | fromJson -}}
{{- if $aiAssistant.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "library-chart.secretNameIa" . }}
labels:
{{- include "library-chart.labels" . | nindent 4 }}
type: Opaque
stringData:
AI_ASSISTANT_MODEL: {{ $aiAssistant.model | default "" | quote }}
AI_ASSISTANT_PROVIDER: {{ $aiAssistant.provider | default "" | quote }}
AI_ASSISTANT_MODEL_PROVIDER: {{ $aiAssistant.modelProvider | default "" | quote }}
AI_ASSISTANT_EMBEDDINGS_PROVIDER: {{ $aiAssistant.embeddingsProvider | default "" | quote }}
AI_ASSISTANT_API_BASE: {{ $aiAssistant.apiBase | default "" | quote }}
AI_ASSISTANT_API_KEY: {{ $aiAssistant.apiKey | default "" | quote }}
AI_ASSISTANT_USE_LEGACY_COMPLETIONS_ENDPOINT: {{ $aiAssistant.useLegacyCompletionsEndpoint | default false | quote }}
{{- end }}
{{- end }}
Loading