# 設置手順

デジタルヒューマンのプロジェクトは難しくありません。最高のプラットフォーム、AIバックエンド、ウェブフレンドリーで柔軟なフロントエンド、そして強力なインテグレーションにより、簡単に構築し、効率的に立ち上げ、価値を見出すことができます。

デジタルヒューマンが表示ができたら、ウェブサイト上でデジタルヒューマンの表示方法、ユーザーとの対話方法、表示したいコンテンツをカスタマイズできるようになります。

## 準備

最低限、下記を準備してください。

| 情報             | DIP(Digital Humans Identity Portal）にアクセスして、デジタルヒューマンの`personaId`と`personaIdentifier` を確認します。                                           |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| 環境             | httpsでアクセスできるWebサイトやWEBサーバー（S3でも可）。開発環境として例外的に [http://localhost:3000](http://localhost:3000/) や<http://127.0.0.1:8001/> などでアクセスできる環境。 |
| 会話AI / チャットボット | [接続実績のある会話AI・チャットボット](/ops/chatbot-integration/compatible-chatbot-ai-list.md)で対応済と表示されているサービスならびに環境                                    |
| HTMLエディタ       | [Visual Studio Code](https://code.visualstudio.com/)などのエディタ                                                                            |

## 設置作業

DIPにアクセスして下記を設定します。

| **許可ドメイン**   | <p><a href="/pages/QsJSzd3rR9FmfPYtca0Z">セキュリティ保護</a>に関する設定です。<br>httpsでアクセスできるWebサイトやWEBサーバーを設定します。登録するURLの末尾にスラッシュ（/）は不要です。</p> |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------- |
| **NLPアカウント** | `Parrot`                                                                                                                          |

### フロントエンド表示用のファイルを作成

VSCODE等をひらいてHTMLファイルを作成します。下記のindex.html サンプルをコピーして張りつけます。

その後、下記の2ヶ所を修正します。修正箇所は`personaId`と`personaIdentifier`の2ヶ所だけです。

```jsx
tml
<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ホステッドエクスペリエンス2.0 HTMLテンプレート</title>
    <script src="https://cdn.uneeq.io/hosted-experience/deploy/index.js"></script>
    <link rel="stylesheet" href="https://hosted-experience.jp/css/dhx.css">
    <script>
        let uneeqOptions = {
            "connectionUrl": "https://api.uneeq.io",
            "personaId": "デジタルヒューマン株式会社から提供",
            "displayCallToAction": true,
            "renderContent": true,
            "welcomePrompt": "こんにちは。自己紹介してください。",
            "mobileViewWidthBreakpoint": 900,
            "layoutMode": "fullScreen",
            "cameraAnchorHorizontal": "center",
            "cameraAnchorDistance": "loose_close_up",
            "logLevel": "info",
            "enableMicrophone": true,
            "showUserInputInterface": true,
            "enableVad": true,
            "enableInterruptBySpeech": true,
            "autoStart": false,
            "containedAutoLayout": true,
            "showClosedCaptions": false,
            "captionsPosition": "top-left",
            "languageStrings": {
                "ja": {
                    "callToActionText": "👋 こんにちは！P2デジタルヒューマンです",
                    "errorText": "エラーが発生しました。",
                    "textInputPlaceholder": "こちらにメッセージを入力...",
                    "showContentToolTip": "コンテンツを表示",
                    "sendQuestionButtonToolTip": "メッセージを送信",
                    "startRecordingButtonToolTip": "録音開始",
                    "unmuteMicrophoneToolTip": "ミュート解除",
                    "muteMicrophoneToolTip": "ミュート",
                    "microphonePermissionNotAllowedButtonToolTip": "マイクの使用が許可されていません",
                    "microphoneEnabledHintTitle": "マイクが有効です",
                    "microphoneEnabledHintText": "お話しください。お聞きしております。",
                    "microphoneEnabledHintTitleOverlay": "マイク ON",
                    "microphoneNotAllowedMessage": "マイクの使用が許可されていません。ブラウザの設定でマイクへのアクセスを許可してから、もう一度お試しください。",
                    "recordingTapToStart": "タップして録音開始、もう一度タップして送信",
                    "recordingSpeakNowPrompt": "お話しください",
                    "recordingTapStopWhenDone": "終了したらタップして停止",
                    "recordingStopButtonToolTip": "録音停止",
                    "recordingRequestingMicrophonePrompt": "マイクにアクセス中",
                    "settingsExitButton": "終了",
                    "confirmExitDescription": "本当に終了しますか？",
                    "confirmExitStayButton": "続ける",
                    "confirmExitEndButton": "終了する",
                    "hideContentButton": "コンテンツを非表示",
                    "hideDigitalHumanButton": "デジタルヒューマンを非表示",
                    "sessionEndedDueToInactivity": "デジタルヒューマンとの会話が非アクティブのため終了しました。",
                    "sessionEndedByUser": "デジタルヒューマンとの会話が終了しました。",
                    "sessionEndedDueToConnectionLoss": "接続の問題により、デジタルヒューマンとの会話が終了しました。",
                    "sessionEndedUnexpectedly": "予期せぬ理由により、デジタルヒューマンとの会話が終了しました。",
                    "sessionTransferred": "デジタルヒューマンとの会話が引き継がれました。",
                    "reconnectingText": "再接続中..."
                },
                "default": {
                    "callToActionText": "Hi! Click here to start a conversation.",
                    "textInputPlaceholder": "Type here..."
                }
            },
            "customMetadata": {
                "company": "デジタルヒューマン株式会社",
                "customerId": "ABC-123",
                "name": "田中太郎"
            },
            "speechRecognitionLocales": "ja-JP:en-US:ko-KR:th-TH",
            "speechRecognitionHintPhrases": "決定事項, 議題, 課題, 宿題, 持ち帰り, 確認事項, 参加者, 欠席者, 開始時間, 終了時間",
            "speechRecognitionHintPhrasesBoost": 0
        }
        
        const uneeq = new Uneeq(uneeqOptions);

        window.dhxOptions = {
            "personaIdentifier": 'デジタルヒューマン株式会社から提供',
            "uneeq": uneeq,
            "connectionBaseUrl": "https://ai-orch-001.digitalhumans.ne.jp",
            "cameraAnchorDuration": 2000,
            "dhxCustomStyles": "",
            "showCaption": true,
            "showEndSession": true,
            "showMute": true,
            "showStartupSpinner": false,
            "showStopSpeaking": true,
            "showWaitingMessage": true,
            "showWaitingSpinner": true,
            "timeDetail": true,
            "useDhxCustomEvent": true,
            "waitingMessageText": "順番に接続しますので、お待ちください。<br>ただ今、他の方の対応をしております。{position}番目にお繋ぎいたします。"
        }
    </script>
</head>
<body>
    <h1>ホステッドエクスペリエンス2.0 HTMLテンプレート</h1>
    <script src="https://hosted-experience.jp/js/dhx.js"></script>
</body>
</html>
```

### ファイルのアップロード

index.htmlをWEBサーバー等にファイルをアップロードし、アップロードしたWEBサーバーにブラウザからアクセスします。

アップロード先はホスティング企業やWEB担当に確認してください。AWS上のS3などのサービスでも利用可能です。

![ScreenShot 20250409 \_ 11.45.06.png](/files/3lmjfzJ53DpXPDg2TGZs)

右下にCTAが表示されたら成功です！🙌 おめでとうございます！

![ScreenShot 20250409 \_ 11.54.38.png](/files/SR5XZN9tMeiSAFQDME7h)

下記の表示はデジタルヒューマンプラットフォーム上でドメインが許可されていない事が原因です。

```html
Error creating session: Domain not allowed (https://digitalhumans-demo.jp)
```

![ScreenShot 20250409 \_ 11.41.17.png](/files/MGizxfZgB0SexH6iCFgj)

右下にCTAも何も表示されない場合は、JavaScriptコンソールを確認してください。

下記の表示はindex.html サンプルをそのままコピペされたことが原因です。`personaId` を正しい値に修正してください。

```html
UneeQ Hosted Experience could not be loaded, personaId not valid:  DPIからpersonaIdコピー&ペーストする
```

![ScreenShot 20250409 \_ 11.45.16.png](/files/EYn5AobdbhtWGrsELEfh)

下記の表示はindex.html サンプルをそのままコピペされたことが原因です。`Personaldentifier` を正しい値に修正してください。

```html
Personaldentifier: DPIからpersonaldentifierをコピー＆ペーストする is not found
```

![ScreenShot 20250409 \_ 11.52.49.png](/files/uM9PkgnJltX4t1YjUHhc)

下記の表示はDIP上で`許可ドメイン`に`設置ドメイン`が登録されていないことが原因です。DIPにアクセスして許可ドメインに登録してください。

正

```jsx
https://digitalhumans-demo.jp
```

誤

```jsx
https://digitalhumans-demo.jp/ # 最後の"/"が不要です。
https://digitalhumans-demo.jp/○○.html # ファイルパスは不要です。
http://digitalhumans-demo.jp/ # https でアクセス出来るようにしてください。
```

### 話しかけてみる

マイクとスピーカの設定が適切であれば、あなたが話しかけたことを認識してオウム返ししてくると思います。下記のような現象が出た場合は原因を特定してみましょう。

| 現象                                    | 原因の可能性                                                                                          |
| ------------------------------------- | ----------------------------------------------------------------------------------------------- |
| 話しかけたが応答がない                           | マイクを認識していない可能性があります。　[こちら](/users/troubleshooting/digitalhuman-not-hearing-voice.md)を参考にしてください。 |
| テキストインプットにメッセージを入れると応答するが、話しかけても応答がない | マイクを認識していません。[こちら](/users/troubleshooting/digitalhuman-not-hearing-voice.md)を参考にしてください。         |
| デジタルヒューマンが喋っているように見えるが声がしない           | スピーカの設定が誤っているかミュートになっていると思われます。                                                                 |

### 会話AIの設定を行う

ご準備いただいた会話AIの設定を行いましょう。下記のページを参考にして設定を行ってください。

[会話AIやチャットボットとの接続を変更する](/ops/chatbot-integration/change-chatbot-connection.md)

### カスタマイズする

下記のページを参考にしてindex.htmlを修正するだけで機能のOFF/ONや表示のカスタマイズが可能です。

[カスタマイズ](/quickstart/production/quickstart-custom-domain.md)

### マニュアル オーバーライド

デフォルトでは、提供されるJavaScriptのコードスニペットを追加するだけで、所有および管理する任意のウェブサイトにデジタルヒューマンを埋め込むことができます。ユーザーが特定のアクションを起こすまでinit()関数の実行を遅延させるなど、JavaScriptの実行を手動で制御したい場合は、コード内でこの関数（例: `window.uneeqInstance.init()` またはUneqクラスをインスタンス化する方法）を呼び出すだけで済みます。

init()\` を手動で呼び出す場合、関数が呼び出される**順序**に特に注意してください。イベントリスナーは初期化の前に作成する必要があります。 {% endhint %}

```jsx
console.log('Setting up UneeQ Event Listeners');
    eventManager.addHandler('UneeqMessage', async (event) => {
      await handleUneeqMessage(event); // 特定のイベントにリスナーをバインドする
    });

    await initializeUneeq(); // デジタルヒューマンを起動する
    console.log('UneeQ initialized');
```

### 既存サイトに組み込む

既存サイトにコードスニペットを挿入してください。この時、ドメインを許可ドメインにいれることを忘れないでください。

オーバーレイモードやコンテインドレイアウトモードなどを活用すると導入がスムーズです。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalhumans.jp/dev/hosted-experience/installation-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
