Skip to content

Commit

Permalink
fix(): fix graphNameMap not being able to retrieve environment variab…
Browse files Browse the repository at this point in the history
…le values (#195)
  • Loading branch information
sunshinexcode authored Aug 12, 2024
1 parent 18d967c commit da165ee
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
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

0 comments on commit da165ee

Please sign in to comment.