π Showcase
Congratulations! You have successfully run your first AI inference call. Now, letβs demonstrate how to build a real AI chat application through a complete project example.π Project Overview
APUS Chat Attestation Example is a complete full-stack application example that demonstrates how to:- Deploy AI chat agents on the AO network
- Integrate APUS AI inference services
- Build frontend interfaces to interact with AO agents
- Implement message attestation and verification mechanisms
ποΈ Project Architecture
π§ Core Components Analysis
1. AO Agent (ao_agent.lua)
This is a smart contract deployed on the AO network, responsible for:
- Receiving user messages
- Calling APUS AI inference services
- Generating AI responses
- Handling message attestation
- Uses APUS AI library for inference
- Implements message queue management
- Supports message attestation and verification
- Error handling and retry mechanisms
2. Frontend Application
User interface built with React, providing:- Chat interface
- AO Connect integration
- Message sending and receiving
- Real-time status updates
π― Developer Learning Guide
Phase 1: Understanding AO Agent Architecture
Learning Objective: Master the basic structure of AO Agent and APUS AI integration methods Key Code Snippets:- Message Processing Flow: Understand how AO Agent receives, processes, and responds to messages
- AI Integration Pattern: Learn how to elegantly integrate APUS AI services
- State Management: Master AO Agentβs state management mechanisms
- Error Handling: Understand error handling and retry strategies
Phase 2: Frontend Integration Patterns
Learning Objective: Master how frontend interacts with AO Agent Key Concepts:- AO Connect: Learn how to connect to AO network
- Message Sending: Learn how to send messages to AO Agent
- Response Handling: Master how to handle AI responses
- State Synchronization: Understand frontend state synchronization with AO Agent
Phase 3: Project Customization Development
Development Steps:-
Project Initialization
-
AO Agent Customization
- Modify business logic in
ao_agent.lua - Adjust AI prompts and parameters
- Add custom functionality modules
- Modify business logic in
-
Frontend Interface Customization
- Modify UI components and styles
- Add new interactive features
- Integrate other services or APIs
-
Testing and Deployment
- Local testing of AO Agent
- Deploy to AO network
- Frontend deployment and configuration
π‘ Development Tips and Suggestions
For Development
You can fully leverage the AI assistant:-
Code Learning Mode
- Let AI learn the code structure of
ao_agent.lua - Understand APUS AI integration patterns
- Master AO Agent best practices
- Let AI learn the code structure of
-
Frontend Code Migration
- Let AI learn frontend interaction patterns with AO Agent
- Understand AO Connect usage methods
- Master state management and error handling
-
Project Customization Guidance
- Let AI customize new features based on the example project
- Provide code refactoring suggestions
- Optimize performance and user experience
Development Best Practices
-
Modular Design
- Modularize AO Agent functionality
- Use clear function naming and comments
- Implement reusable components
-
Error Handling
- Implement comprehensive error handling mechanisms
- Add logging functionality
- Provide user-friendly error messages
-
Performance Optimization
- Optimize AI call frequency
- Implement message caching mechanisms
- Reduce unnecessary network requests
-
User Experience
- Add loading state indicators
- Implement real-time message updates
- Provide responsive design
π Next Steps
- Explore Example Project: Carefully read and understand the example code
- Local Testing: Run and test the project in local environment
- Custom Development: Develop your own AI applications based on the example
- Community Engagement: Join APUS Discord for support and feedback