- .NET 7.0 or higher (Download)
- Git for version control
- Optional: OpenAI API key for enhanced AI features
- Optional: Ollama for local AI processing
git clone https://github.com/Mostafa-SAID7/bloggingAgent.git
cd bloggingAgentCopy the example environment file and update with your settings:
cp .env.example .envEdit .env and add your API keys if desired. The app works without them (uses demo mode).
cd bloggingAgent
dotnet runThe application will:
- Build the project
- Initialize the SQLite database
- Seed sample data
- Start the server on
http://localhost:5000
- Web UI: Open http://localhost:5000 in your browser
- API Docs: Visit http://localhost:5000/swagger
- Generate Post: Navigate to
/blog/generate
- Get your API key from OpenAI Platform
- Update
bloggingAgent/appsettings.json:
{
"OpenAISettings": {
"ApiKey": "sk-your-key-here",
"Model": "gpt-3.5-turbo",
"Temperature": 0.7
}
}Or set via environment variable:
OPENAI_API_KEY=sk-your-key-here- Install Ollama
- Start Ollama:
ollama serve - Pull a model:
ollama pull llama2 - Update
bloggingAgent/appsettings.json:
{
"LlmSettings": {
"OllamaEndpoint": "http://localhost:11434",
"OllamaModel": "llama2"
}
}# All tests
dotnet test
# Specific test project
dotnet test bloggingAgent.Tests/bloggingAgent.Tests.csproj
# With verbose output
dotnet test --verbosity detailed# Build release version
dotnet publish -c Release -o ./publish
# Run published version
cd publish
./bloggingAgent.exe # or dotnet bloggingAgent.dll on Linux/Mac# Build image
docker build -t blogging-agent:latest .
# Run container
docker run -p 5000:5000 blogging-agent:latest# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down{
"ConnectionStrings": {
"DefaultConnection": "Server=your-server.databaseasp.net; Database=your-db; User Id=your-user; Password=your-password; Encrypt=True; TrustServerCertificate=True; MultipleActiveResultSets=True;"
}
}Connection String Parameters:
Server- Your SQL Server host/endpointDatabase- Database nameUser Id- Username for authenticationPassword- Password for authenticationEncrypt=True- Enable connection encryptionTrustServerCertificate=True- Trust self-signed certificates (production: False)MultipleActiveResultSets=True- Allow multiple queries
If port 5000 is already in use:
# Specify different port
dotnet run -- --urls "http://localhost:6000"- Check if
bloggingagent.dbexists in the project root - Verify file permissions allow read/write
- Clear SQLite cache: Delete
.db-shmand.db-walfiles
- Verify your API key is correctly set in
appsettings.jsonor.env - Check API key hasn't expired or been revoked
- Ensure OPENAI_API_KEY environment variable is set correctly
# Clean previous builds
dotnet clean
# Restore packages
dotnet restore
# Rebuild
dotnet buildbloggingAgent/
├── bloggingAgent/ # Main application
│ ├── Agents/ # AI agents & prompts
│ ├── Controllers/ # API endpoints
│ ├── Services/ # Business logic
│ ├── Data/ # Database & repositories
│ ├── Models/ # Domain models
│ ├── Views/ # UI pages
│ ├── wwwroot/ # Static assets
│ └── Program.cs # App configuration
├── bloggingAgent.Tests/ # Unit & integration tests
├── docs/ # Documentation
└── README.md # Project overview
- Read the API Documentation
- Check Configuration Guide
- Review Architecture Overview
- Explore example requests in
/examples