Chat app built with NativeScript, integrating:
- @github/copilot-sdk - GitHub's Copilot SDK for AI interactions
- @nstudio/nstreamdown - Beautiful markdown rendering with real-time streaming support
ns-iosaccessory-output.mp4
The app includes several custom tools that GitHub Copilot can intelligently call:
- 🌤️ Weather Lookup - Get weather for any city
- 🧮 Calculator - Perform mathematical calculations
- ⏰ Time Checker - Get current date and time
- Quick Action Prompts - Pre-configured prompts for common tasks
- Streaming Responses - See AI responses appear in real-time
- Syntax Highlighting - Beautiful code blocks with proper highlighting
- Math Support - LaTeX equations rendered natively
- Interactive UI - Smooth scrolling and typing experience
Before running the app, make sure you have:
-
GitHub Copilot CLI installed and authenticated:
# Check if installed copilot --version # If not installed, follow: https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli
-
NativeScript environment set up:
# Install NativeScript CLI globally npm install -g nativescript # Verify setup ns doctor
-
Node.js 22+ installed
# Run on iOS
npm run dev:ios:copilot
# Run on Android
npm run dev:android:copilot- Launch the app - Opens directly to the AI chat interface
- Try Quick Actions - Tap any of the suggested prompts
- Ask Questions - Type anything and watch the AI respond in real-time
- Explore Tools - Ask about weather, time, or calculations
- See Markdown - Request code examples or formatted content
Try these to see the app in action:
- "What's the weather in Tokyo?"
- "Calculate 123 * 456"
- "Show me a NativeScript Angular component example"
- "What time is it?"
- "Explain async/await with code examples"
- AiChatComponent - Main chat interface with message display
- CopilotService - Wraps GitHub Copilot SDK for easy Angular integration
/src/app/ai-chat/- Chat component and template/src/app/services/copilot.service.ts- GitHub Copilot integration/src/main.ts- App bootstrap with nstreamdown registration
Edit /src/app/services/copilot.service.ts to add new tools:
defineTool('my_tool', {
description: 'What your tool does',
parameters: {
type: 'object',
properties: {
param: { type: 'string', description: 'Parameter description' }
},
required: ['param']
},
handler: async (args) => {
// Your tool logic here
return { result: 'something' };
}
})In copilot.service.ts, modify the systemMessage:
systemMessage: {
content: 'Your custom AI personality and instructions...'
}In ai-chat.component.ts, modify streamdownConfig:
streamdownConfig: StreamdownConfig = {
mode: 'streaming',
codeTheme: 'github-dark', // or 'github-light', etc.
// Add more config options
};- Verify Copilot CLI is installed:
copilot --version - Check authentication:
copilot --status - Ensure internet connection
- Verify streamdown elements are registered in
main.ts - Check that
@nstudio/nstreamdownis properly installed
# Clean build
ns clean
# Remove node_modules and reinstall
rm -rf node_modules package-lock.json
npm installFeel free to experiment and share your improvements!
Built with ❤️ using NativeScript, GitHub Copilot SDK, and @nstudio/nstreamdown