# 论文生成-java **Repository Path**: kayCancer/paper-generation--java ## Basic Information - **Project Name**: 论文生成-java - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-17 - **Last Updated**: 2026-07-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Paper Generation Java Java 17 / Spring Boot implementation of the paper generation service. It supports paper categories `106`, `119`, and `120`, 11 output languages, SQLite persistence, DOCX export, Aliyun OSS, RabbitMQ reference lookup, and the batch console at `/batch`. ## Requirements - JDK 17 - Docker Desktop or Docker Engine for Compose and Testcontainers verification - Maven is provided by `mvnw` Use the project JDK explicitly when the system default is not Java 17: ```bash export JAVA_HOME=/Users/carlkay/Library/Java/JavaVirtualMachines/ms-17.0.17/Contents/Home ``` ## Configuration Create an untracked `.env.local` from `.env.example` and restrict its permissions: ```bash cp .env.example .env.local chmod 600 .env.local ``` Do not commit `.env.local`. Required production settings include: - `PAPER_API_FIXED_SIGN` - `PAPER_SECRET_ENCRYPTION_KEY` - `OSS_ENDPOINT`, `OSS_PUBLIC_ENDPOINT`, `OSS_BUCKET_NAME`, `OSS_ACCESS_KEY_ID`, `OSS_ACCESS_KEY_SECRET` - `REFERENCE_RPC_*` when reference lookup is enabled - `PAPER_CREDENTIAL_IDS` - `PAPER_CREDENTIAL__BASE_URL` - `PAPER_CREDENTIAL__MODEL` - `PAPER_CREDENTIAL__API_KEYS_JSON` - `PAPER_CREDENTIAL__MAX_CONCURRENCY` `API_KEYS_JSON` must be a JSON array. The batch API returns only credential alias, model, key count, and concurrency metadata. It never returns actual keys. The standalone service listens on `127.0.0.1` by default. The batch console has no independent login, so protect `/batch` and `/api/batch/*` with an authenticated reverse proxy before exposing the service outside a trusted host. ## Build And Test ```bash ./mvnw clean verify ``` This runs unit/API tests and the RabbitMQ Testcontainers integration test. Docker must be running for the complete verification chain. ## Run Service mode: ```bash ./mvnw spring-boot:run ``` Or run the executable JAR: ```bash ./mvnw -DskipTests package java -jar target/paper-generation-java-1.0.0.jar ``` Generate an existing SQLite order and return a process exit code: ```bash java -jar target/paper-generation-java-1.0.0.jar \ --app.mode=order \ --app.order-id=123 ``` Run a batch configuration. Batch mode starts its local HTTP API for the duration of the job and exits `0` only when every task succeeds: ```bash java -jar target/paper-generation-java-1.0.0.jar \ --app.mode=batch \ --app.batch-config=/absolute/path/to/batch-config.json ``` ## Docker ```bash docker compose build docker compose up -d docker compose ps ``` The container listens on `8001` and Compose publishes it only on the host loopback interface. To publish another local host port, export it before Compose evaluation: ```bash PAPER_SERVER_PORT=18001 docker compose up -d ``` Compose mounts `.env.local` read-only instead of copying its values into the container environment. Updating model credential entries in that file is therefore picked up by the periodic credential reload without rebuilding the image. The Dockerfile defaults to the DaoCloud mirror for its Maven and JRE base images. Override `MAVEN_IMAGE` and `JRE_IMAGE` build arguments when another registry is required. SQLite and generated files persist in `./data`, `./generated_docs`, and `./generated_batch_docs`. Stop the service with: ```bash docker compose down ``` ## HTTP API - `GET /api/paper/health` - `POST /api/agent/ai/start/creater/v1` - `GET /api/agent/ai/start/status/v1?ai_orderid=` - `GET /batch` - `GET /api/batch/config` - `POST /api/batch/start` - `GET /api/batch/status` The create endpoint accepts form, multipart, and JSON requests. Prefer a credential alias instead of sending legacy model fields: ```bash curl -sS -X POST http://127.0.0.1:8001/api/agent/ai/start/creater/v1 \ -H 'Content-Type: application/json' \ -d "{\"sign\":\"${PAPER_API_FIXED_SIGN}\",\"proid\":119,\"title\":\"论文题目\",\"wordCount\":5000,\"language\":\"中文\",\"references_number\":1,\"credential_id\":\"DEEPSEEK_V4_PRO\"}" ``` Responses retain `code`, `msg`, and `data`, and include `trace_id`. Asynchronous status responses also include `generation_trace_id` for log correlation. ## Storage And Resume No external database is required. SQLite is initialized automatically with WAL, busy timeout, foreign keys, and indexes. Queued or processing orders resume after restart from persisted generation checkpoints. Batch execution retains `batch_run.jsonl`, `batch_summary.csv`, SQLite task state, and the existing output directory hierarchy.