feat: Add Azure OpenAI support with configuration and fetch wrapper

- Introduced Azure OpenAI provider configuration in `azure-openai-provider.ts`.
- Implemented global fetch wrapper to handle Azure API versioning.
- Added new session files for Azure OpenAI interactions.
- Created initial configuration files for cron jobs and device management.
- Established Docker Compose setup for Azure OpenAI deployment.
- Updated main session management with new skills and context handling.
- Added environment variable resolution for Azure OpenAI configuration.
This commit is contained in:
xuhaodev 2026-01-29 12:39:24 +08:00
parent a0c62d96c2
commit bb575c400e

View File

@ -66,14 +66,14 @@ az cognitiveservices account create \
--sku S0 --sku S0
``` ```
Deploy a model (e.g., gpt-4o-mini): Deploy a model (e.g., gpt-5.2):
```bash ```bash
az cognitiveservices account deployment create \ az cognitiveservices account deployment create \
--name $OPENAI_NAME \ --name $OPENAI_NAME \
--resource-group $RESOURCE_GROUP \ --resource-group $RESOURCE_GROUP \
--deployment-name "gpt-4o-mini" \ --deployment-name "gpt-5.2" \
--model-name "gpt-4o-mini" \ --model-name "gpt-5.2" \
--model-version "2024-07-18" \ --model-version "2024-07-18" \
--model-format OpenAI \ --model-format OpenAI \
--sku-capacity 10 \ --sku-capacity 10 \
@ -154,7 +154,7 @@ ENV NODE_ENV=production
# Create config directory and bake in Azure-specific config # Create config directory and bake in Azure-specific config
# IMPORTANT: trustedProxies is required for Azure's internal proxy # IMPORTANT: trustedProxies is required for Azure's internal proxy
RUN mkdir -p /home/node/.moltbot && \ RUN mkdir -p /home/node/.moltbot && \
echo '{"gateway":{"controlUi":{"allowInsecureAuth":true},"trustedProxies":["169.254.0.0/16"]},"agents":{"defaults":{"model":{"primary":"azure-openai/gpt-4o-mini"}}}}' > /home/node/.moltbot/moltbot.json && \ echo '{"gateway":{"controlUi":{"allowInsecureAuth":true},"trustedProxies":["169.254.0.0/16"]},"agents":{"defaults":{"model":{"primary":"azure-openai/gpt-5.2"}}}}' > /home/node/.moltbot/moltbot.json && \
chown -R node:node /home/node/.moltbot chown -R node:node /home/node/.moltbot
USER node USER node
@ -232,6 +232,7 @@ az webapp config appsettings set \
MOLTBOT_CONFIG_PATH=/home/node/.moltbot/moltbot.json \ MOLTBOT_CONFIG_PATH=/home/node/.moltbot/moltbot.json \
CLAWDBOT_GATEWAY_TOKEN=$GATEWAY_TOKEN \ CLAWDBOT_GATEWAY_TOKEN=$GATEWAY_TOKEN \
AZURE_OPENAI_API_KEY="<your-azure-openai-key>" \ AZURE_OPENAI_API_KEY="<your-azure-openai-key>" \
AZURE_OPENAI_DEPLOYMENT_NAME="gpt-5.2" \
AZURE_OPENAI_ENDPOINT="https://<your-resource>.openai.azure.com/" \ AZURE_OPENAI_ENDPOINT="https://<your-resource>.openai.azure.com/" \
AZURE_OPENAI_API_VERSION="2024-08-01-preview" AZURE_OPENAI_API_VERSION="2024-08-01-preview"
@ -283,7 +284,7 @@ az webapp log download \
Look for these indicators in the logs: Look for these indicators in the logs:
``` ```
[gateway] agent model: azure-openai/gpt-4o-mini [gateway] agent model: azure-openai/gpt-5.2
[gateway] listening on 0.0.0.0:18789 [gateway] listening on 0.0.0.0:18789
``` ```
@ -337,7 +338,7 @@ az webapp config set -g $RESOURCE_GROUP -n $WEB_APP_NAME \
### Problem: Azure OpenAI Not Working ### Problem: Azure OpenAI Not Working
**Verify**: **Verify**:
1. Model deployment name matches config (e.g., `gpt-4o-mini`) 1. Model deployment name matches config (e.g., `gpt-5.2`)
2. API key is correct 2. API key is correct
3. Endpoint URL format: `https://<resource>.openai.azure.com/` 3. Endpoint URL format: `https://<resource>.openai.azure.com/`
4. API version is supported (e.g., `2024-08-01-preview`) 4. API version is supported (e.g., `2024-08-01-preview`)