﻿(Japanese/English)

# AIヘルパーの使い方

クロスワード ギバーの「AIヘルパー」は、たわいない会話やカギの再生成ができる、あなたの相棒です。

## セットアップ手順

1. Pythonをインストールする
   - [python.org](https://www.python.org/downloads/) から最新版をダウンロードしてインストールします。
   - インストーラーの最初の画面で 「Add python.exe to PATH」にチェックを入れる のを忘れないでください（後から設定するより簡単です）。

2. 依存パッケージをインストールする
   - スタートメニューから「コマンドプロンプト」を 右クリック→「管理者として実行」 で開きます。
   - `cd`コマンドでアプリのフォルダに移動します。
   - 以下を実行します。
     ```
     pip install -r requirements.txt
     ```
   - ※管理者権限が必要なのは、パッケージをシステム全体（全ユーザー）にインストールするためです。エラーが出る場合は、管理者権限なしでも `pip install --user -r requirements.txt` で個人用にインストールできます。

3. お使いの生成AIのAPIキーを取得する
   - 各プロバイダーの管理画面からAPIキーを発行してください。

4. システムの環境変数を設定する
   - スタートメニューで「環境変数」と検索し、「システム環境変数の編集」を開きます。
   - 「環境変数」ボタン→「ユーザー環境変数」の「新規」をクリックします。
   - 変数名に以下のいずれかを、変数値に取得したAPIキーを入力します。
     `GOOGLE_API_KEY` / `OPENAI_API_KEY` / `XAI_API_KEY` / `DEEPSEEK_API_KEY` / `SAKANA_API_KEY` / `DASHSCOPE_API_KEY` / `MOONSHOT_API_KEY` / `MISTRAL_API_KEY` / `LLAMA_API_KEY`

5. XWordGiverを再起動する

6. 「ファイル」メニュー→「設定」→「AIヘルパー」タブを開く

7. 「AIプロバイダー」と「AIモデル」を選択する

8. 「適用」ボタンをクリックする

## 注意事項

- 生成AIは間違いをすることがあります。結果は必ずご確認ください。
- AIヘルパーはインターネットを通じて外部と通信します。ネット接続のない環境では動作しません。
- APIキーの取り扱いにご注意ください。
  - 環境変数はご自身のPC上でのみ有効です。他人とファイルを共有する際、APIキーが書かれた設定ファイルやスクリーンショットを一緒に送らないようご注意ください。
  - APIキーが漏洩した疑いがある場合は、発行元の管理画面からすぐに無効化・再発行してください。

## よくある質問

- Pythonって何？ → AI(人工知能)などを動かすためのプログラム言語です。
- pipって何？ → Pythonにパッケージ(機能)を導入するためのプログラムです。
- APIキーって何？ → AIを使うための秘密の文字列です。パスワードと同じように、他人に見せないようにしてください。
- AIプロバイダーって何？ → AIサービスを提供する事業者です。
- AIモデルって何？ → AIの種類です。
- 動作が遅いんだけど？
  → 原因はいくつか考えられます。
  1. 無料プランのAIは利用制限（レート制限）が厳しく、応答が遅くなることがあります → 有料プランへの切り替えで改善する場合があります。
  2. モデル自体の推論速度がプロバイダーやモデルの種類によって異なります → より軽量・高速なモデルを選ぶと改善する場合があります。
  3. ご利用中のインターネット回線の速度も影響します。
- 「ライブラリ未インストール」というエラーが出た → `requirements.txt` に記載されたパッケージのうち、使いたいプロバイダーに対応するものがインストールされていません。手順2を再度実行してください。
- 環境変数を設定したのに反映されない → 開いているXWordGiverを一度すべて閉じてから起動し直してください。

---

# How to Use AI Helper

XWordGiver's "AI Helper" is your partner, capable of casual conversation and regenerating clues.

## Setup Steps

1. Install Python
   - Download the latest version from [python.org](https://www.python.org/downloads/).
   - On the installer's first screen, be sure to check "Add python.exe to PATH" (this is easier than setting it manually afterward).

2. Install the dependent packages
   - From the Start menu, right-click "Command Prompt" and select "Run as administrator".
   - Use the `cd` command to navigate to the app's folder.
   - Run the following:
     ```
     pip install -r requirements.txt
     ```
   - Administrator privileges are required because this installs the packages system-wide (for all users). If you get an error, you can instead install them for your user only, without administrator privileges, using `pip install --user -r requirements.txt`.

3. Obtain the API key for the generative AI you plan to use
   - Get an API key from your chosen provider's dashboard.

4. Set a system environment variable
   - Search "environment variables" in the Start menu and open "Edit the system environment variables."
   - Click "Environment Variables," then "New" under "User variables."
   - Enter one of the following as the variable name, and your API key as the value:
     `GOOGLE_API_KEY`, `OPENAI_API_KEY`, `XAI_API_KEY`, `DEEPSEEK_API_KEY`, `SAKANA_API_KEY`, `DASHSCOPE_API_KEY`, `MOONSHOT_API_KEY`, `MISTRAL_API_KEY`, `LLAMA_API_KEY`

5. Restart XWordGiver

6. Go to the "File" menu → "Settings" → "AI Helper" tab

7. Set the "AI Provider" and "AI Model"

8. Click "Apply"

## Notes

- Generative AI may make mistakes. Please be sure to verify the results.
- AI Helper communicates with external systems via the Internet. It does not function in environments without an Internet connection.
- Handle your API key carefully.
  - Environment variables are only set on your own PC. When sharing files with others, make sure not to include configuration files or screenshots that expose your API key.
  - If you suspect your API key has been leaked, revoke and reissue it immediately from your provider's dashboard.

## FAQ

- What is Python? → A programming language used to run AI (artificial intelligence) and other applications.
- What is pip? → A program used to install packages (features) for Python.
- What is an API key? → A secret string of characters used to access AI services. Treat it like a password — never share it with others.
- What is an AI provider? → A company that offers AI services.
- What is an AI model? → A specific type of AI.
- Why is it running slowly?
  → A few possible causes:
  1. Free-tier plans often have strict rate limits, which can slow down responses — upgrading to a paid plan may help.
  2. Inference speed varies by provider and model — a lighter/faster model may respond quicker.
  3. Your internet connection speed also affects response time.
- I got a "library not installed" error → The package required for the provider you're trying to use isn't installed. Re-run step 2 above.
- My environment variable isn't being picked up → Close and reopen XWordGiver completely; the changes only apply to newly opened windows.
