Skip to content

littlewhite2024/LineBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LINE Bot – Yukino (小雪)

An experimental LINE Bot project focused on role-playing and emotional companionship.

Status: V1 Completed (Development Paused)
Next Step: V2 in Planning (Cloud Deployment + Larger Models + Feature & Experience Optimization)


Project Overview

Yukino (小雪) is a LINE Bot designed with the goals of "gentleness, sisterly warmth, and emotional understanding."
The focus of this project is not just chatting, but attempting to maintain consistent personality and tone throughout long conversations.

This is also an experimental project exploring the following question:

Can local LLMs adequately support long-term, stable character-based dialogue systems?


Tech Stack (V1)

  • Python / FastAPI
  • LINE Messaging API
  • Local LLM (CPU Inference)
  • OpenAI API (Optional, Fallback Mechanism)
  • Discord Webhook (Notifications / Logging)
  • Cloudflare Tunnel (Local Testing)

Project Structure (V1)

linebot/
├── app/
│   ├── line/
│   │   ├── __init__.py
│   │   └── line_webhook.py    # LINE Webhook handler
│   ├── services/
│   │   ├── __init__.py
│   │   ├── ai_service.py            # OpenAI API
│   │   ├── discord_service.py       # Discord Webhook notification service
│   │   ├── local_ai_service.py      # Local AI model service
│   │   └── memory_service.py        # Conversation memory management (reserved)
│   ├── utils/
│   │   ├── __init__.py
│   │   ├── kaomoji.py               # Kaomoji loading and selection tools
│   │   └── system_prompt.py         # System Prompt loader
│   ├── __init__.py
│   ├── config.py             # Environment variables and global settings
│   └── main.py               # FastAPI main entry point
├── data/
│   ├── kaomoji.txt           # Kaomoji collection
│   └── system_prompt.md      # System prompt
├── .gitignore
├── README.md
├── requirements.txt         # Dependencies
└── start.bat           # Project launcher
This structure may undergo modularization adjustments in V2

Usage (V1)

This project is for local testing and experimentation, requiring a basic Python environment.

Clone the Project

git clone https://github.com/littlewhite2024/LineBot.git
cd LineBot

Install Dependencies

pip install -r requirements.txt

Prepare Local Model

Method 1: Fixed Path (Default)

D:/AI_Models/1/

Method 2: Use Environment Variable (Recommended)

Variable name: AI_MODEL_PATH


Configure Environment Variables

Please set the following required parameters (using .env file or system environment variables):

LINE_ACCESS_TOKEN=YOUR_LINE_ACCESS_TOKEN
LINE_CHANNEL_SECRET=YOUR_LINE_CHANNEL_SECRET
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
DISCORD_WEBHOOK_URL=YOUR_DISCORD_WEBHOOK_URL
default_kaomoji=data/kaomoji.txt
system_prompt_file=data/system_prompt.md
local_ai_model_path=YOUR_local_ai_model_path
local_ai_enabled=true   # Default is true, can be set to false

Start Server

  • Run start.bat
  • Add the generated HTTPS URL to your LINE Webhook configuration page

V1 Completed Features

  • LINE Bot Webhook (FastAPI)
  • Local LLM Inference (CPU)
  • OpenAI / Local Model Fallback Switching
  • System Prompt Injection and Character Testing
  • Kaomoji Database Support
  • Discord Webhook Notifications
  • Real User Conversation Testing

Why V1 Development Was Paused

After actual usage and long-term testing, the following limitations were confirmed to be difficult to resolve within the V1 architecture:

  • Model Capacity Limitations (1.5B Parameters)
    Small models struggle to fully understand and consistently follow complex System Prompts.

  • Language Bias Issues (Simplified Chinese)
    Pre-training data is primarily in Simplified Chinese, so even when specifying Traditional Chinese or other languages, drift easily occurs.

  • Insufficient Character Consistency
    Character focus and tone drift easily occur during long conversations.

  • V1 Validated the Following Important Conclusions

    • System Prompts are not a silver bullet; model capacity is key
    • Local LLMs have obvious limitations in character stability
    • Prompt Engineering needs to match the model's capability level

However, these issues are essentially model capability-level limitations rather than programming errors. Therefore, after evaluating the cost investment and actual results, I decided to temporarily halt V1 feature expansion and shift focus toward V2 architecture design, which is better suited for these goals.


V2 Planning Direction (Preview)

  • Cloud Deployment (Render / Railway)
  • Use Larger LLMs
  • Modular Skills System
  • Custom Commands and Behavior Extensions
  • Short-term / Long-term Memory Mechanisms
  • Language Control and Character Stability Optimization

Project Status

  • V1: Features completed, but can still be optimized or expanded with new ideas
  • V2: Design and planning in progress

Contributing

Pull requests, improvements, and suggestions are welcome.


License

This project is licensed under the MIT License - see the LICENSE file for details.


About

A LINE Bot built with FastAPI and Cloudflare Tunnel Integrates OpenAI responses, Discord notifications, local AI response, and a kaomoji library, with future support for memory management.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors