Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

文思 Wensi

Wensi is a lightweight starting point for Chinese writing. Enter a topic, keywords, and a few writing requirements to get an editable draft, an outline, and a character count. The current release is v0.1.0 Alpha/MVP: it defaults to a browser-local demo generator and does not require an account, backend, or network request.

简体中文 · 日本語 · Español

Wensi interface

What it is

Wensi is a writing starting point, not a replacement for the author or a finished-paper service. Use it to sketch a structure, try an expression, and get a draft you can revise. Add your own experiences, facts, and thinking so the final piece is genuinely yours.

Features

  • Generate a Chinese essay draft from a topic.
  • Choose primary, middle-school, or high-school level, plus narrative, argumentative, expository, or prose genre.
  • Adjust the target length (currently 300–1200 characters), keywords, tone, real-life material, and expression style.
  • Switch among the editable draft, structure outline, and concrete revision suggestions.
  • Copy the result, download it as TXT or Markdown, clear it, or generate another version while keeping the current settings.
  • Keep up to six recent drafts in the current browser's localStorage; there is no account or cross-device sync.
  • Responsive UI for desktop, tablet, and mobile screens.

Technology

  • React 19 and TypeScript
  • Next.js API / App Router compatibility
  • vinext and Vite
  • A build target for Cloudflare Workers
  • Browser localStorage for local history only

Run locally

Node.js 22.13 or newer is required.

npm install
npm run dev

Open the local URL printed by the development server. Useful checks are:

npm run lint
npm run typecheck
npm test
npm run build
npm run start

Environment variables

The local demo mode needs no environment variables. You can copy .env.example for local configuration; do not commit the real .env file. The optional online mode is implemented server-side and requires the provider settings below.

Variable Example Purpose
WENSI_PROVIDER demo demo uses the local generator; openai-compatible enables the server-side model provider.
WENSI_API_BASE_URL https://model.example/v1 Base URL for an OpenAI-compatible model service.
WENSI_API_KEY replace-me Model-service secret; keep it on the server and never expose it to the browser.
WENSI_MODEL your-model-name Model identifier used by the provider.
WENSI_REQUEST_TIMEOUT_MS 30000 Server request timeout in milliseconds.

v0.1.0 defaults to the local demo; set WENSI_PROVIDER=openai-compatible and provide the required server-side settings to use a model service. Never put a real key in the repository, client code, or a variable prefixed with NEXT_PUBLIC_.

Model integration

The online provider is available through the server-side /api/generate route. The flow is:

  1. The server reads WENSI_PROVIDER, WENSI_API_BASE_URL, WENSI_API_KEY, WENSI_MODEL, and WENSI_REQUEST_TIMEOUT_MS.
  2. The client submits the topic, keywords, and writing options to /api/generate.
  3. The server calls the configured model service and returns the result to the client.

This checkout still uses the local demo engine by default. When online mode is enabled, the server calls the configured provider's OpenAI-compatible /chat/completions endpoint. The topic, keywords, writing options, and any real experiences you enter are sent to the model service you configure. Review that service's privacy policy, logging, and retention rules first.

The route validates the request, applies a timeout, maps common provider failures (including rate limits and invalid keys), and cleans the model output before returning it.

Build and deploy

Verify the local build first:

npm run build

vinext/Vite produces output aimed at Cloudflare Workers. Before deploying to your Cloudflare account, prepare Wrangler configuration for your account, domain, and bindings, then run the appropriate Wrangler deployment command, for example:

npx wrangler deploy

The repository does not include account-specific secrets, domains, or production bindings. Confirm that Worker environment variables and model credentials exist only in server-side configuration.

Privacy

  • The default demo mode generates in the browser and does not upload writing content to a Wensi service.
  • Recent drafts are stored only in the current browser's localStorage; clearing site data or changing devices removes access to that history.
  • Wensi does not collect writing content by default. In online mode, the topic, keywords, and real experiences leave the browser through /api/generate and are sent to your configured model service; you are responsible for checking that provider's handling rules.
  • Do not put API keys, passwords, or other secrets in writing fields or debug logs.

Current limitations

  • This is an Alpha/MVP. The local generator combines templates deterministically, so results can be repetitive and do not replace fact checking, editing, or professional judgment.
  • The product currently targets Chinese writing; level, genre, and tone choices are limited to the existing interface.
  • Local history is browser-specific; there is no login, cloud sync, or recovery service.
  • Online generation requires WENSI_PROVIDER=openai-compatible, a reachable OpenAI-compatible endpoint, a model name, and a valid server-side key; it is not enabled by default.
  • Production Cloudflare deployment requires your own account configuration, domain, and bindings; the repository does not provide those external resources.

Roadmap

  • Improve provider observability and deployment guidance without exposing user content or secrets.
  • Expand input/output validation and user-facing recovery for provider failures.
  • Document reproducible Cloudflare Workers deployment and configuration examples.
  • Continue improving local templates, accessibility, and multilingual documentation.

Contributing

Issues and pull requests are welcome. Please read CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md before getting started.

License

Released under the MIT License.

About

Open-source AI Chinese writing assistant for organizing ideas, structuring essays, and improving writing skills.

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages