8000 GitHub - qiuhuachuan/PsyCLIENT: [EMNLP 2026 main] 基于对话轨迹建模的来访者模拟 · GitHub
[go: up one dir, main page]

Skip to content
qiuhuachuanPublic

About

[EMNLP 2026 main] 基于对话轨迹建模的来访者模拟

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

PsyCLIENT

Client Simulation via Conversational Trajectory Modeling for Trainee Practice and Model Evaluation in Mental Health Counseling

EMNLP 2026 · Main Conference

https://aclanthology.org/2026.emnlp-main.45.pdf

简体中文[Chinese Version]

PsyCLIENT is a framework for simulating mental health counseling clients through conversational trajectory modeling. It combines client profiles, dialogue histories, per-turn target behaviors, and reference content to generate Chinese-language counseling interactions with consistent backgrounds and diverse behaviors. It supports counseling skills practice, counseling-dialogue synthesis, and interactive evaluation of automated counseling systems.

This project provides PsyCLIENT-CP, a collection of Chinese client profiles, and a Virtual Client Counseling Practice Room built with FastAPI + Vue 3. Users take the role of a counselor and engage in multi-turn conversations with simulated clients.

The current web application is intended for local, single-user practice. The simulated clients and their conversations are for training and research purposes; they do not constitute psychological diagnoses, treatment recommendations, or assessments of real clients.

Virtual Client Counseling Practice Room

The application features a three-column workspace in warm white and sage green, with a responsive layout for desktop and mobile devices. FastAPI serves the frontend from the same origin, and Vue 3.5.13 is bundled in the local static directory. No Node.js, frontend build step, or online CDN is required.

  • Profile browsing: Search 120 client profiles and view their presenting concerns, occupations, and full backgrounds.
  • Trajectory selection: Select a conversational behavior trajectory and start a demo or model-powered session.
  • Multi-turn practice: Supports Chinese input method composition; press Enter to send and Shift + Enter to insert a line break.
  • Session management: View conversation history, end sessions, and resume practice.
  • Practice notes: Save notes manually, with automatic saving before switching sessions or exporting and a warning about unsaved changes before leaving the page.
  • Data export: Export notes, session mode, conversations, and behavior labels as JSON.
  • Target behavior display: Optionally show predefined target behaviors to better understand the practice setup.

Quick Start

1. Clone the Repository and Install Dependencies

Requires Python 3.10 or later. On macOS / Linux:

git clone https://github.com/qiuhuachuan/PsyCLIENT.git
cd PsyCLIENT

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

On Windows PowerShell, use:

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt

2. Start the Server

python -m uvicorn app:app --reload --host 127.0.0.1 --port 8000

3. Enable Model Mode (Optional)

Set your API key in the terminal used to start the server:

export DEEPSEEK_API_KEY='your-api-key'
python -m uvicorn app:app --reload --host 127.0.0.1 --port 8000

On Windows PowerShell:

$env:DEEPSEEK_API_KEY = 'your-api-key'
python -m uvicorn app:app --reload --host 127.0.0.1 --port 8000

Model mode currently uses deepseek-flash as configured in llm_api.py; availability depends on the configured API endpoint and your account's model access. Requests time out after 45 seconds, with no automatic retries. If a request fails, the frontend retains your input and no incomplete conversation turn is saved.

Docker Deployment (Port 7007)

Install and start Docker with the Docker Compose plugin supporting --wait-timeout. On Ubuntu, other Linux systems, or macOS, ensure your configured DEEPSEEK_API_KEY is exported into the current terminal environment, then run from the project directory:

./deploy.sh

The script reads the inherited host environment and injects the key into the running container. It does not read the project's .env file or write the key into the image, files, or command-line arguments. A missing or empty key stops deployment before building. For demo mode without a key, run ./deploy.sh --demo.

After changing ~/.bashrc, run source ~/.bashrc in your terminal (the setting must use export DEEPSEEK_API_KEY=...); after changing /etc/environment, log in again. The script does not automatically source system configuration files. If deployment requires sudo, use sudo --preserve-env=DEEPSEEK_API_KEY ./deploy.sh when permitted by your sudo policy, since ordinary sudo may discard the variable. Scheduled tasks and systemd deployments must also pass the variable to the deployment process.

Open http://localhost:7007 or API documentation. For a remote deployment, replace localhost with the server address. Both host and container use port 7007.

The script checks Docker, builds the image, starts the service in the background, and waits for its health check. Run ./deploy.sh again after updating code or credentials. The container restarts automatically, and the database persists at out/sessions.sqlite3 on the host across container replacements. Run the script as the same host user to keep data directory permissions consistent.

# Run these commands from the project directory
docker compose -p psyclient logs -f psyclient  # View logs
docker compose -p psyclient ps                # Check status
docker compose -p psyclient down              # Remove containers; keep out/ data

Usage

  1. Browse or search profiles and select a simulated client to practice with.
  2. Choose a behavior trajectory and session mode, then create a practice session.
  3. Send messages as the counselor and converse with the simulated client.
  4. Display target behaviors as needed and take practice notes.
  5. End the session or resume it later; export JSON for personal review or appropriately designed research analysis.

Configuration and Data Storage

Setting Default Description
DEEPSEEK_API_KEY Not set Server-side API key required for model mode; not needed for demo mode
PSYCLIENT_DB out/sessions.sqlite3 Path to the SQLite database

Conversations, trajectory labels, session states, and notes are stored in a server-side SQLite database. Browser localStorage stores only the ID of the most recently opened session. The database file is included in .gitignore.

Project Structure

app.py                      # FastAPI routes, display-field preparation, SQLite, and role conversion
index.htm                   # Vue single-page template
static/
    app.js                  # Frontend state, interactions, and API calls
    style.css               # Responsive page styles
    vue.global.prod.js      # Bundled Vue 3.5.13
PsyCLIENT.py                # Profile/trajectory loading, behavior selection, prompts, and response generation
llm_api.py                  # DeepSeek model interface
client_profile/             # Client profiles
conv_trajectory/            # Conversational behavior trajectories
out/
    sessions.sqlite3        # Session database, automatically created at runtime
requirements.txt            # Python dependencies
deploy.sh                   # Deploy on port 7007 using the host environment
Dockerfile                  # Application image definition
compose.yaml                # Container, port, and persistent storage settings
tests/test_app.py           # API and adapter-layer tests

Citation

If this project is useful for your research, please cite:

@inproceedings{qiu-etal-2026-client,
    title = "Client Simulation via Conversational Trajectory Modeling for Both Trainee Practice and Model Evaluation in Mental Health Counseling",
    author = "Qiu, Huachuan  and
      Chen, Zhaoming  and
      Chen, Yuqian  and
      Xie, Yuan  and
      Lu, Yu  and
      Lan, Zhenzhong",
    editor = "Lee, Hung-Yi  and
      Dev, Sunipa  and
      Li, Junyi Jessy  and
      Elliott, Desmond",
    booktitle = "Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing",
    month = oct,
    year = "2026",
    address = "Budapest, Hungary",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2026.emnlp-main.45/",
    doi = "10.18653/2026.emnlp-main.45",
    pages = "975--1016",
    ISBN = "979-8-89176-459-0",
    abstract = "LLM-based client simulation provides a scalable approach to novice counselor training, counseling-dialogue synthesis, and interactive evaluation of automated counseling systems. However, existing approaches are limited by insufficient profile diversity, weak behavioral grounding, and the lack of open Chinese-language resources for simulated counseling clients. We propose PsyCLIENT, a framework that conditions simulated-client responses on client profiles, dialogue histories, and conversational trajectories specifying target behaviors and content constraints at each client turn. We also construct PsyCLIENT-CP, a dataset of 120 Chinese client profiles spanning 60 counseling topics. Evaluations involving 24 professional counselors show that PsyCLIENT receives higher ratings of perceived authenticity and training utility than the comparison methods. In a separate source-identification study, PsyCLIENT dialogues were more frequently misclassified as human-client interactions than those generated by the baselines. These results suggest that conversational trajectory modeling can transform static client profiles into behavior-guided, dynamically unfolding counseling interactions."
}

Contact

Please submit bug reports and feature requests through GitHub Issues.

For questions about the paper, contact Huachuan Qiu at qiuhuachuan@westlake.edu.cn.

About

[EMNLP 2026 main] 基于对话轨迹建模的来访者模拟

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0