mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-09 22:38:10 -05:00
## CHANGES - Replace deprecated generative-ai-go with google.golang.org/genai library - Add TTS model detection and audio output validation - Implement WAV file generation for TTS audio responses - Add audio format checking utilities in CLI output - Update Gemini client to support streaming with new SDK - Add "Kore" and "subchunk" to VSCode spell checker dictionary - Remove extra blank line from changelog formatting - Update dependency imports and remove unused packages
Docker Test Environment for API Configuration Fix
This directory contains a Docker-based testing setup for fixing the issue where Fabric calls Ollama and Bedrock APIs even when not configured. This addresses the problem where unconfigured services show error messages during model listing.
Quick Start
# Run all tests
./scripts/docker-test/test-runner.sh
# Interactive mode - pick which test to run
./scripts/docker-test/test-runner.sh -i
# Run specific test case
./scripts/docker-test/test-runner.sh gemini-only
# Shell into test environment
./scripts/docker-test/test-runner.sh -s gemini-only
# Build image only (for development)
./scripts/docker-test/test-runner.sh -b
# Show help
./scripts/docker-test/test-runner.sh -h
Test Cases
- no-config: No APIs configured
- gemini-only: Only Gemini configured (reproduces original issue #1195)
- openai-only: Only OpenAI configured
- ollama-only: Only Ollama configured
- bedrock-only: Only Bedrock configured
- mixed: Multiple APIs configured (Gemini + OpenAI + Ollama)
Environment Files
Each test case has a corresponding environment file in scripts/docker-test/env/:
env.no-config- Empty configurationenv.gemini-only- Only Gemini API keyenv.openai-only- Only OpenAI API keyenv.ollama-only- Only Ollama URLenv.bedrock-only- Only Bedrock configurationenv.mixed- Multiple API configurations
These files are volume-mounted into the Docker container and persist changes made with fabric -S.
Interactive Mode & Shell Access
The interactive mode (-i) provides several options:
Available test cases:
1) No APIs configured (no-config)
2) Only Gemini configured (gemini-only)
3) Only OpenAI configured (openai-only)
4) Only Ollama configured (ollama-only)
5) Only Bedrock configured (bedrock-only)
6) Mixed configuration (mixed)
7) Run all tests
0) Exit
Add '!' after number to shell into test environment (e.g., '1!' to shell into no-config)
Shell Mode
- Use
1!,2!, etc. to shell into any test environment - Run
fabric -Sto configure APIs interactively - Run
fabric --listmodelsorfabric -Lto test model listing - Changes persist in the environment files
- Type
exitto return to test runner
Expected Results
Before Fix:
no-configandgemini-onlytests show Ollama connection errors- Tests show Bedrock authentication errors when BEDROCK_AWS_REGION not set
- Error:
Ollama Get "http://localhost:11434/api/tags": dial tcp... - Error:
Bedrock failed to list foundation models...
After Fix:
- Clean output with no error messages for unconfigured services
- Only configured services appear in model listings
- Ollama only initialized when
OLLAMA_API_URLis set - Bedrock only initialized when
BEDROCK_AWS_REGIONis set
Implementation Details
- Volume-mounted configs: Environment files are mounted to
/home/testuser/.config/fabric/.env - Persistent state: Configuration changes survive between test runs
- Single Docker image: Built once from
scripts/docker-test/base/Dockerfile, reused for all tests - Isolated environments: Each test uses its own environment file
- Cross-platform: Works on macOS, Linux, and Windows with Docker
Development Workflow
- Make code changes to fix API initialization logic
- Run
./scripts/docker-test/test-runner.sh no-configto test the main issue - Use
./scripts/docker-test/test-runner.sh -ifor interactive testing - Shell into environments (
1!,2!, etc.) to debug specific configurations - Run all tests before submitting PR:
./scripts/docker-test/test-runner.sh
Architecture
The fix involves:
- Ollama: Override
IsConfigured()method to check forOLLAMA_API_URLenv var - Bedrock: Modify
hasAWSCredentials()to requireBEDROCK_AWS_REGION - Plugin Registry: Only initialize providers when properly configured
This prevents unnecessary API calls and eliminates confusing error messages for users.