================================================================
  SG 2 P Wiz Desktop  --  Style Guide to Prompt Wizard
  README & User Guide
================================================================


WHAT IS THIS?
-------------
SG 2 P Wiz Desktop is a self-contained offline tool that converts
a translation style guide (PDF, DOCX, or TXT) into a ready-to-use
AI prompt for your CAT (Computer-Assisted Translation) tool.

It runs entirely on your own computer. No account needed, no
subscription, no data sent to any server operated by this tool.

There are two ways to use it:

  TIER 1 -- BYOK (Bring Your Own Key)
    You provide your own API key from an AI provider (OpenAI,
    Anthropic, OpenRouter, Azure, etc.) and upload your style
    guide file. The tool extracts the rules automatically and
    formats them into a prompt for your chosen CAT tool.
    Requires: an API key from a supported provider.

  TIER 2 -- Free (No API Key)
    No file upload, no API key. You pick your CAT tool,
    language pair, and domain, and the app gives you a
    "meta-prompt" -- a ready-made instruction you paste into
    ChatGPT, Claude.ai, or Gemini with your style guide file
    attached. They do the work; you just follow the steps.
    Requires: nothing. Free forever.


SYSTEM REQUIREMENTS
-------------------
  - Windows 10 or Windows 11 (64-bit)
  - That is all.

No need to install Python, no need to install anything.
Everything the app needs is already bundled inside the
SG2PWizDesktop folder you extracted this file from.


HOW TO START THE APP
--------------------
1. Open the SG2PWizDesktop folder (the one that contains this file).
2. Double-click "start.bat".
3. A small black console window will appear briefly -- this is
   normal. It starts the app in the background.
4. Your default web browser will open automatically at:
   http://localhost:5001
5. Use the app in the browser.

HOW TO STOP THE APP
--------------------
Click the "✕ Close App" button in the top-right corner of the
app's header bar. This shuts down the background process cleanly.

If the Close App button does not respond for any reason, you can
also close the console window titled "SG 2 P Wiz Desktop" as a
fallback.


USING TIER 1 (WITH API KEY)
----------------------------
Step 1 -- Fill in your API credentials:

  Base URL:   The endpoint of your AI provider.
              Leave blank if you are using standard OpenAI.
              Examples:
                OpenAI:    (leave blank)
                Anthropic: https://api.anthropic.com/v1
                OpenRouter: https://openrouter.ai/api/v1
                Azure:     https://YOUR-RESOURCE.openai.azure.com/...

  Model Name: The exact model ID your provider uses.
              Examples:
                OpenAI:     gpt-4o
                Anthropic:  claude-sonnet-4-6
                OpenRouter: openai/gpt-4o (check their model list)

  API Key:    Your secret key from the provider.
              It is used only for the duration of this request.
              It is never stored, logged, or transmitted anywhere
              other than directly to the AI provider you specified.

Step 2 -- Choose your output language.
  This is the language the extracted rules will be written in,
  NOT the language you are translating into.

Step 3 -- Select your Target CAT Tool.
  Pick the CAT tool you intend to paste the final prompt into.
  The generated prompt will be formatted for that tool's prompt
  field. If your tool is not listed, choose "Other / Generic"
  for a plain system prompt that works with any tool that
  accepts custom AI instructions.

Step 4 -- Upload your style guide file.
  Supported formats: PDF, DOCX, TXT. Maximum size: 5 MB.

Step 5 -- Click "Extract Rules".
  The AI reads your file and returns a structured list of rules
  organised into five categories:
    1. Terminology Bindings
    2. Tone & Register
    3. Formatting Conventions
    4. Brand & Style Rules
    5. Other Rules

  Escalation and human-workflow instructions (e.g. "if unsure,
  ask your project manager") are automatically removed -- an AI
  cannot escalate, so those rules are irrelevant in a prompt.

Step 6 -- Review and edit the extracted rules.
  Read through the output. Add, remove, or correct anything
  before moving on.

Step 7 -- Click "Generate Prompt".
  The AI formats your reviewed rules into a finished, ready-to-
  use prompt for the CAT tool you selected.

Step 8 -- Copy the prompt into your CAT tool.
  Paste it into the system prompt / custom instruction field
  of the CAT tool you selected. Consult your CAT tool's
  documentation for where this field is located.

If you want the same rules formatted for a different CAT tool,
use the "Re-generate for a Different CAT Tool" section at the
bottom of the results page -- no need to re-upload the file.


USING TIER 2 (FREE, NO API KEY)
---------------------------------
1. Click the "Tier 2 -- Free (no API key)" tab.
2. Select your CAT tool, source language, target language,
   and domain.
3. Click "Get Meta-Prompt".
4. Copy the text that appears.
5. Go to ChatGPT (chat.openai.com), Claude (claude.ai), or
   Gemini (gemini.google.com).
6. Start a new conversation.
7. Attach your style guide file to the message.
8. Paste the meta-prompt as your message and send.
9. The AI will extract the rules AND format the prompt for you.
10. Copy the result back into your CAT tool.


PRIVACY & SECURITY
------------------
- The app runs 100% on your local machine. It has no connection
  to any server other than the AI provider you configure.
- Your API key is sent only to the provider's URL you specify,
  over HTTPS, in the same way a browser would.
- Your API key is never written to disk, never logged, and
  never included in any response back to the browser.
- Your style guide file is read into memory, sent to the AI
  provider for processing, and then discarded. It is not saved
  anywhere.


TROUBLESHOOTING
---------------
"The website refused to connect" / ERR_CONNECTION_REFUSED
  The app server is not running. Click "✕ Close App" (or close
  any existing "SG 2 P Wiz Desktop" console windows) and
  double-click start.bat again.

Browser opens but shows a blank page or error
  Wait a few seconds and refresh (F5). The server may still be
  starting up.

"LLM call failed" error after clicking Extract or Generate
  - Check that your API key is correct and has credit/quota.
  - Check that the Base URL matches your provider exactly.
  - Check that the Model Name is spelled correctly (it is
    case-sensitive for some providers).

Port 5001 is already in use
  Another copy of the app is already running. Either use that
  one, or close the old instance and restart.

File upload fails with "unsupported file type"
  Only PDF, DOCX, and TXT are supported. If your style guide
  is in another format, convert it to one of these first.

Still stuck?
  Contact support@sg2pwiz.app


================================================================
  SG 2 P Wiz Desktop is part of the I'M TranslAID family of tools.

  License: PolyForm Perimeter License 1.0.1
  https://polyformproject.org/licenses/perimeter/1.0.1

  Required Notice: Copyright Viktor M. Takacs 2026

  Free to use for individuals and businesses.
  Not for building competing products.
================================================================
