Skip to content

AaronWander/HT-SmartSales

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6,044 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

SmartSales AI

๐Ÿฆฆ SmartSales AI

AI-Powered Presales Automation System | 10x Sales Efficiency

Why SmartSales โ€ข Features โ€ข Quick Start โ€ข Use Cases โ€ข Documentation

AI Powered Sales Automation 10x Efficiency Python


๐ŸŽฏ Why SmartSales AI?

Traditional Presales Pain Points

  • โŒ Repetitive Work - Asking the same questions to every customer
  • โŒ Low Efficiency - One sales rep can only handle 3-5 customers per day
  • โŒ Inconsistent Quality - Depends on individual experience
  • โŒ Scattered Knowledge - Product info, pricing, and cases spread everywhere
  • โŒ Slow Response - Customers wait hours for proposals

SmartSales AI Solution

  • โœ… Intelligent Dialogue - AI guides customers to provide key information
  • โœ… 10x Efficiency - One rep can serve 30+ customers simultaneously
  • โœ… Standardized Output - Template-based consistent quality
  • โœ… Knowledge Base Integration - Auto-retrieve product info, pricing, cases
  • โœ… Instant Response - Generate proposals within 1 minute

๐Ÿš€ Core Advantages

1๏ธโƒฃ Intelligent Requirement Mining

Not just a chatbot, but a business-savvy presales consultant

Core Technologies:

  • ๐Ÿง  Context Understanding - Remembers conversation history
  • ๐ŸŽฏ Smart Follow-up - Dynamically generates questions based on missing info
  • ๐Ÿ“Š Slot Management - Auto-identifies and fills business-critical information
  • ๐Ÿ” Intent Recognition - Distinguishes inquiry, confirmation, modification

2๏ธโƒฃ Three-Stage Standardized Workflow

Ensures every customer receives complete and professional service

Stage 1: Information Collection (info_collection)
โ”œโ”€ Auto-identify customer industry, scale, pain points
โ”œโ”€ Smart follow-up on missing key information
โ””โ”€ Real-time calculation of information completeness

Stage 2: Information Summarization (info_summarization)
โ”œโ”€ Generate structured requirement summary
โ”œโ”€ Present to customer for confirmation
โ””โ”€ Support natural language modifications

Stage 3: Proposal Generation (proposal)
โ”œโ”€ Auto-generate proposal based on template
โ”œโ”€ Retrieve relevant info from knowledge base
โ”œโ”€ AI generates personalized recommendations
โ””โ”€ Output complete presales proposal document

3๏ธโƒฃ Flexible Template System

Configure once, benefit forever

# Proposal Template Example

## Customer Information
- Company: {{slot:company_name}}
- Industry: {{slot:industry}}
- Scale: {{slot:company_size}}

## Requirement Analysis
Customer's core pain point: {{slot:pain_point}}

Based on our experience, {{slot:industry}} industry typically needs:
{{ai:Generate targeted analysis based on industry and pain points}}

## Solution
{{rag:Query product database, match most suitable products}}

## Pricing
{{rag:Query pricing table based on customer scale}}

## Success Cases
{{rag:Query success cases in same industry}}

## Implementation Plan
Estimated timeline: {{ai:Estimate based on customer scale and requirement complexity}}

Supported Placeholders:

  • {{slot:xxx}} - Customer information slots
  • {{sys:xxx}} - System information (time, session ID, etc.)
  • {{rag:xxx}} - Knowledge base retrieval (products, pricing, cases)
  • {{ai:xxx}} - AI-generated content (analysis, recommendations, estimates)
  • {{ext:xxx}} - External tool calls (CRM, ERP, etc.)

4๏ธโƒฃ Deep Knowledge Base Integration

Make AI your product expert

Based on RAGFlow Retrieval-Augmented Generation:

  • ๐Ÿ“š Product Knowledge Base - Auto-retrieve product features, specs, advantages
  • ๐Ÿ’ฐ Pricing Database - Auto-match pricing plans based on customer scale
  • ๐Ÿ“– Case Library - Retrieve industry success cases for persuasion
  • ๐Ÿ“‹ Policy Library - Auto-reference company policies, service terms
  • ๐ŸŽ“ FAQ Library - Quick answers to common questions

Smart Retrieval Features:

  • โœ… Semantic understanding (not just keyword matching)
  • โœ… Context-aware (adjusts retrieval strategy based on conversation history)
  • โœ… Deduplication caching (avoids repeated retrieval)
  • โœ… Source attribution (marks information sources in proposals)

5๏ธโƒฃ Multi-Platform Seamless Integration

Service wherever customers are

  • ๐Ÿ’ฌ Instant Messaging - Telegram, Discord, Slack, WhatsApp
  • ๐ŸŒ Web Interface - Embed in website, customer service system
  • ๐Ÿ“ฑ Mobile - WeChat Official Account, Mini Program (planned)
  • ๐Ÿ–ฅ๏ธ CLI - Command-line interface (internal testing)
  • ๐Ÿ”Œ API - RESTful API (system integration)

๐Ÿ’ผ Use Cases

Case 1: SaaS Software Presales

Customer: A CRM software company
Pain Point: 50+ daily inquiries, only 3 presales staff, can't keep up
Results:

  • โฑ๏ธ Response time reduced from 2 hours to 5 minutes
  • ๐Ÿ“ˆ Inquiry conversion rate increased from 15% to 28%
  • ๐Ÿ‘ฅ Presales team efficiency improved 12x

Case 2: Customized Service Presales

Customer: An enterprise digital transformation consulting company
Pain Point: Each customer has different needs, proposal writing takes 2-3 days
Results:

  • โšก Proposal generation time reduced from 3 days to 30 minutes
  • ๐Ÿ“Š More standardized proposal quality, customer satisfaction up 40%
  • ๐Ÿ’ฐ Presales cost reduced 60%

Case 3: E-commerce Platform Customer Service

Customer: A cross-border e-commerce platform
Pain Point: Customer inquiries for product recommendations, manual service can't match quickly
Results:

  • ๐ŸŽฏ Product recommendation accuracy 85%
  • ๐Ÿ›’ Inquiry conversion rate increased 35%
  • ๐Ÿ’ฌ Customer service pressure reduced 70%

โœจ Features

๐ŸŽฏ Intelligent Dialogue Engine

  • Natural Language Understanding (NLU)
  • Context Memory (multi-turn dialogue)
  • Intent Recognition (inquiry/confirmation/modification)
  • Sentiment Analysis (identify customer emotions)
  • Multi-language Support (Chinese/English)

๐Ÿ“‹ Business Process Management

  • Three-stage state machine
  • Auto slot filling
  • Information completeness check
  • Natural language confirmation
  • Process visualization (planned)

๐ŸŽจ Template & Configuration

  • Service catalog management
  • Five-type placeholder system
  • Template hot reload
  • Multi-service parallel
  • Version management (planned)

๐Ÿ” Knowledge Base Integration

  • RAGFlow deep integration
  • Semantic retrieval
  • Context-aware
  • Source attribution
  • Real-time updates

๐Ÿ“Š Data Analytics

  • Dialogue quality assessment
  • Slot coverage statistics
  • Conversion rate analysis (planned)
  • Customer profiling (planned)
  • A/B testing (planned)

๐Ÿ” Enterprise Features

  • Multi-tenant isolation
  • Permission management
  • Audit logs
  • Data encryption
  • Private deployment

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.9+
  • LLM API (OpenAI / Claude / Local models)
  • RAGFlow (optional, for knowledge base retrieval)

Installation

# 1. Clone the repository
git clone https://github.com/AaronWander/HT-SmartSales.git
cd HT-SmartSales

# 2. Install dependencies
pip install -r requirements.txt

# 3. Configure environment variables
cp .env.example .env
# Edit .env and configure your API keys

Configure Your First Service

# Create service directory
mkdir -p presales_services/my-service

# Create proposal template
cat > presales_services/my-service/proposal.md << 'EOF'
# {{slot:company_name}} Custom Solution

## Customer Information
- Company: {{slot:company_name}}
- Industry: {{slot:industry}}
- Requirement: {{slot:requirement}}

## Solution
{{rag:Query product solution based on industry}}

## Pricing
{{rag:Query pricing based on scale}}
EOF

# Create slot configuration
cat > presales_services/my-service/slots.yaml << 'EOF'
id: my-service
required_base:
  - company_name
  - industry
  - requirement
meta:
  company_name:
    label: Company Name
    desc: Customer's company name
  industry:
    label: Industry
    desc: Customer's industry sector
  requirement:
    label: Core Requirement
    desc: Customer's main needs or pain points
EOF

Start Service

# Method 1: CLI mode (testing)
python cli.py

# Method 2: Telegram Bot
python gateway/run.py --platform telegram

# Method 3: Web API
python gateway/run.py --platform api

Test Conversation

User: Hello, I'd like to learn about your products
AI: Hello! I'm SmartSales AI assistant. To provide you with the most 
    suitable solution, may I know your company name first?

User: We are ABC Tech Company
AI: Got it, ABC Tech Company. What industry is your company in?

User: We're in e-commerce
AI: Understood, e-commerce industry. What problems are you facing or 
    what needs do you have?

User: Our order volume has grown, inventory management is chaotic
AI: Received! Let me summarize the information:
    - Company: ABC Tech Company
    - Industry: E-commerce
    - Requirement: Order volume growth, chaotic inventory management
    
    Is this information correct?

User: Yes
AI: Great, generating your custom proposal...
    
    [Generates complete presales proposal document]

๐Ÿ“ Project Structure

HT-SmartSales/
โ”œโ”€โ”€ agent/                          # ๐Ÿง  Core business logic
โ”‚   โ”œโ”€โ”€ presales_policy.py         # Slot policy and config parsing
โ”‚   โ”œโ”€โ”€ presales_state_machine.py  # Three-stage state machine
โ”‚   โ”œโ”€โ”€ presales_answer_gate.py    # Answer quality gate
โ”‚   โ”œโ”€โ”€ presales_summarizer.py     # Information summary generation
โ”‚   โ””โ”€โ”€ presales_proposal.py       # Proposal template rendering engine
โ”‚
โ”œโ”€โ”€ presales_services/              # ๐Ÿ“‹ Service configuration directory
โ”‚   โ””โ”€โ”€ example-service/           # Example service
โ”‚       โ”œโ”€โ”€ proposal.md            # Proposal template
โ”‚       โ””โ”€โ”€ slots.yaml             # Slot configuration
โ”‚
โ”œโ”€โ”€ tools/                          # ๐Ÿ”ง Tool integration
โ”‚   โ”œโ”€โ”€ ragflow_tool.py            # RAGFlow knowledge base tool
โ”‚   โ””โ”€โ”€ ...                        # Other tools
โ”‚
โ”œโ”€โ”€ gateway/                        # ๐ŸŒ Multi-platform access
โ”‚   โ”œโ”€โ”€ run.py                     # Gateway main program
โ”‚   โ”œโ”€โ”€ telegram_gateway.py        # Telegram integration
โ”‚   โ”œโ”€โ”€ discord_gateway.py         # Discord integration
โ”‚   โ””โ”€โ”€ ...                        # Other platforms
โ”‚
โ”œโ”€โ”€ docs/                           # ๐Ÿ“š Documentation
โ”‚   โ””โ”€โ”€ presales-rag/
โ”‚       โ”œโ”€โ”€ design-decision-record.md  # Design documentation
โ”‚       โ”œโ”€โ”€ runtime-config.md          # Configuration guide
โ”‚       โ””โ”€โ”€ TEMPLATE_GUIDE.md          # Template writing guide
โ”‚
โ”œโ”€โ”€ tests/                          # ๐Ÿงช Tests
โ”‚   โ”œโ”€โ”€ agent/test_presales_*.py   # Business logic tests
โ”‚   โ””โ”€โ”€ tools/test_ragflow_tool.py # Tool tests
โ”‚
โ”œโ”€โ”€ LICENSES/                       # ๐Ÿ“„ Open source declarations
โ”‚   โ”œโ”€โ”€ HERMES-MIT.txt             # Hermes Agent license
โ”‚   โ”œโ”€โ”€ RAGFLOW-APACHE2.txt        # RAGFlow license
โ”‚   โ””โ”€โ”€ README.md                  # License description
โ”‚
โ””โ”€โ”€ README.md                       # ๐Ÿ“– This document

๐Ÿ“š Documentation

Quick Start

Core Concepts

Integration Guides

Best Practices


๐Ÿ”ง Configuration

Environment Variables

# ===== LLM Configuration =====
# Choose one LLM provider
OPENROUTER_API_KEY=sk-or-xxx        # OpenRouter (recommended, multi-model)
# or
OPENAI_API_KEY=sk-xxx               # OpenAI
# or
ANTHROPIC_API_KEY=sk-ant-xxx        # Claude

# ===== RAGFlow Configuration (optional) =====
RAGFLOW_API_KEY=ragflow-xxx
RAGFLOW_BASE_URL=http://localhost:9380

# ===== Messaging Platform Configuration (optional) =====
TELEGRAM_BOT_TOKEN=123456:ABC-xxx
DISCORD_BOT_TOKEN=xxx
SLACK_BOT_TOKEN=xoxb-xxx

Business Configuration (config.yaml)

agent:
  # Enable presales features
  presales_enabled: true
  
  # State machine configuration
  presales_state_machine_enabled: true
  presales_answer_gate_enabled: true
  
  # Slot assessment mode
  presales_slot_assessment_mode: "llm_structured"  # llm_structured | heuristic
  
  # Knowledge base configuration
  ragflow_hybrid_mode: "on"  # on | off | always
  ragflow_single_retrieval_mode: true
  ragflow_max_calls_per_turn: 1
  
  # Quality gate
  confidence_thresholds:
    high_slot_coverage: 0.8
    medium_slot_coverage: 0.5

๐Ÿ“Š Performance Metrics

Response Speed

  • Information collection: < 2 seconds
  • Summary generation: < 3 seconds
  • Proposal generation: < 30 seconds (including knowledge base retrieval)

Accuracy

  • Slot identification accuracy: > 90%
  • Intent recognition accuracy: > 85%
  • Knowledge retrieval relevance: > 80%

Concurrency

  • Single instance supports: 100+ concurrent sessions
  • Horizontal scaling: unlimited

๐Ÿงช Testing

# Run all tests
./scripts/run_tests.sh

# Run presales business tests
./scripts/run_tests.sh tests/agent/test_presales_*.py

# Run state machine tests
./scripts/run_tests.sh tests/agent/test_presales_state_machine.py

# Run knowledge base tool tests
./scripts/run_tests.sh tests/tools/test_ragflow_tool.py

Test Coverage:

  • State machine: 100%
  • Slot management: 95%
  • Template rendering: 90%
  • Overall: 85%+

๐Ÿ“ Open Source Acknowledgments

This project is built upon the following open source projects:

Hermes Agent

RAGFlow

Full open source licenses can be found in the LICENSES/ directory.


๐Ÿ“„ License

The business logic code (presales module and related configurations) of SmartSales AI is under proprietary license.

The base framework components follow the original projects' open source licenses (MIT and Apache 2.0).

For commercial use, please contact us for licensing.


๐Ÿค Commercial Cooperation

๐Ÿ’ผ Enterprise Edition

  • โœ… Private deployment
  • โœ… Custom development
  • โœ… Technical support (7x24)
  • โœ… Training services
  • โœ… SLA guarantee

๐ŸŽ“ Training Services

  • AI presales system setup training
  • Template design best practices
  • Knowledge base management training

๐Ÿ”ง Custom Development

  • Industry-specific solutions
  • System integration (CRM/ERP)
  • Special feature development

๐Ÿ“ง Contact Us


๐ŸŒŸ Star History

If this project helps you, please give us a โญ๏ธ Star!

Star History Chart


SmartSales AI - Smarter Presales ๐Ÿฆฆ
Built with โค๏ธ by AaronWander

Back to Top โฌ†๏ธ

About

Production-ready AI presales automation with stable, intelligent dialogue system. Systematically extracts customer requirements and intelligently presents services. RAG-powered knowledge base, automated proposal generation.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors