Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(): fix graphNameMap not being able to retrieve environment variab… #195

Merged
merged 1 commit into from
Aug 12, 2024
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
21 changes: 2 additions & 19 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,8 @@ services:
- ./:/app
- ${LOG_PATH}:${LOG_PATH}
working_dir: /app
environment:
AGORA_APP_ID: ${AGORA_APP_ID}
AGORA_APP_CERTIFICATE: ${AGORA_APP_CERTIFICATE}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_BEDROCK_MODEL: ${AWS_BEDROCK_MODEL}
AWS_REGION: ${AWS_REGION}
AZURE_STT_KEY: ${AZURE_STT_KEY}
AZURE_STT_REGION: ${AZURE_STT_REGION}
AZURE_TTS_KEY: ${AZURE_TTS_KEY}
AZURE_TTS_REGION: ${AZURE_TTS_REGION}
COSY_TTS_KEY: ${COSY_TTS_KEY}
ELEVENLABS_TTS_KEY: ${ELEVENLABS_TTS_KEY}
LITELLM_MODEL: ${LITELLM_MODEL}
OPENAI_API_KEY: ${OPENAI_API_KEY}
OPENAI_BASE_URL: ${OPENAI_BASE_URL}
OPENAI_MODEL: ${OPENAI_MODEL}
OPENAI_PROXY_URL: ${OPENAI_PROXY_URL}
QWEN_API_KEY: ${QWEN_API_KEY}
env_file:
- .env
astra_playground:
image: ghcr.io/rte-design/astra_playground:v0.2.0-15-g38e1738
container_name: astra_playground
Expand Down
14 changes: 12 additions & 2 deletions server/internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ var (

// The corresponding graph name based on the language
graphNameMap = map[string]string{
languageChinese: os.Getenv("GRAPH_NAME_ZH"),
languageEnglish: os.Getenv("GRAPH_NAME_EN"),
languageChinese: "va.openai.azure",
languageEnglish: "va.openai.azure",
}

// Retrieve parameters from the request and map them to the property.json file
Expand Down Expand Up @@ -190,3 +190,13 @@ var (
},
}
)

func SetGraphNameMap() {
if graphNameZH := os.Getenv("GRAPH_NAME_ZH"); graphNameZH != "" {
graphNameMap[languageChinese] = graphNameZH
}

if graphNameEN := os.Getenv("GRAPH_NAME_EN"); graphNameEN != "" {
graphNameMap[languageEnglish] = graphNameEN
}
}
3 changes: 3 additions & 0 deletions server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ func main() {
os.Exit(1)
}

// Set graph name map
internal.SetGraphNameMap()

// Process property.json
if err = processProperty(internal.PropertyJsonFile); err != nil {
slog.Error("process property.json failed", "err", err)
Expand Down