### Project Setup and Execution Source: https://github.com/team-mirai/kouchou-ai/blob/main/client/README.md Instructions for installing dependencies, building the project, and starting the application. ```bash npm install npm run build npm start ``` -------------------------------- ### Install Client Dependencies Source: https://github.com/team-mirai/kouchou-ai/blob/main/experimental/direct_win/README.md Installs the necessary Node.js dependencies for the client application by running `npm install` within the client directory. ```bash cd client npm install cd .. ``` -------------------------------- ### Project Setup and Execution Source: https://github.com/team-mirai/kouchou-ai/blob/main/client-admin/README.md Standard npm commands to install dependencies, build the project, and start the application. ```bash npm install npm run build npm start ``` -------------------------------- ### Install Client-Admin Dependencies Source: https://github.com/team-mirai/kouchou-ai/blob/main/experimental/direct_win/README.md Installs the necessary Node.js dependencies for the client-admin application by running `npm install` within the client-admin directory. ```bash cd client-admin npm install cd .. ``` -------------------------------- ### Execute Windows Startup Script Source: https://github.com/team-mirai/kouchou-ai/blob/main/experimental/direct_win/README.md Copies the Windows-specific startup batch script to the project root and then executes it to start the application. ```batch copy experimental\direct_win\direct_start_win.bat .\ direct_start_win.bat ``` -------------------------------- ### Install Server Dependencies with PDM Source: https://github.com/team-mirai/kouchou-ai/blob/main/experimental/direct_win/README.md Installs PDM (Python Development Master) and then installs the Python server dependencies using PDM within the server directory. ```bash cd server pip install pdm pdm install cd .. ``` -------------------------------- ### Create .env File Source: https://github.com/team-mirai/kouchou-ai/blob/main/experimental/direct_win/README.md Copies the example environment file to create a new .env file for configuring environment variables, including the OpenAI API key. ```batch copy .env.example .env ``` -------------------------------- ### Environment Setup Source: https://github.com/team-mirai/kouchou-ai/blob/main/test/e2e/README.md Copies the example environment file and instructs to edit it for test credentials. ```bash cp .env.example .env # Edit .env file to add test credentials. ``` -------------------------------- ### Check Node.js and npm Versions Source: https://github.com/team-mirai/kouchou-ai/blob/main/experimental/direct_win/README.md Verifies the installed versions of Node.js and npm, which are required for the client and client-admin components. If not installed, users are directed to install Node.js LTS. ```bash node -v npm -v ``` -------------------------------- ### Clone Repository Source: https://github.com/team-mirai/kouchou-ai/blob/main/experimental/direct_win/README.md Clones the Kouchou AI project repository from GitHub and navigates into the project directory. ```git git clone https://github.com/digitaldemocracy2030/kouchou-ai.git cd kouchou-ai ``` -------------------------------- ### Local Development Setup Source: https://github.com/team-mirai/kouchou-ai/blob/main/CLAUDE.md Commands to set up the local development environment for Kouchou-AI, including copying environment variables and starting all services using Docker Compose. It also provides instructions for client development and accessing the applications. ```bash cp .env.example .env docker compose up make client-setup make client-dev -j 3 # Access applications # - Main app: http://localhost:3000 # - Admin panel: http://localhost:4000 # - API: http://localhost:8000 ``` -------------------------------- ### Start the application using start_win.bat Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/windows-setup.md Starts the 広聴AI application using the provided batch script. This script initiates the Docker containers required for the application to run. ```BATCH start_win.bat ``` -------------------------------- ### Setup and Environment Configuration Source: https://github.com/team-mirai/kouchou-ai/blob/main/server/README.md Instructions for setting up the development environment, including copying the .env.example file and configuring API keys for OpenAI and OpenRouter. It highlights the importance of API keys for certain functionalities and potential costs associated with their use. ```bash cp .env.example .env ``` -------------------------------- ### Run setup_win.bat to configure OpenAI API key Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/windows-setup.md Executes the setup script to configure the OpenAI API key. This script handles API key validation and Docker container startup. It overwrites the existing .env file. ```BATCH setup_win.bat ``` -------------------------------- ### OpenRouter Usage Guide Source: https://github.com/team-mirai/kouchou-ai/blob/main/server/README.md Instructions for integrating with OpenRouter, including account creation, API key setup in .env, and specifying desired models. It outlines the benefits of using OpenRouter, such as access to various models and flexible selection, while also noting potential differences in pricing, model availability, and response times compared to direct API usage. ```APIDOC OpenRouter Integration: 1. Account Creation: Sign up at https://openrouter.ai/. 2. API Key Configuration: Set OPENROUTER_API_KEY in your .env file. 3. Model Selection: Specify the desired model (e.g., "openai/gpt-4", "google/gemini-pro"). Benefits: - Access to OpenAI, Google Gemini, and other models. - Flexible model selection. - Potentially different pricing structures. Considerations: - OpenRouter pricing differs from direct OpenAI/Google pricing. - Model availability and features may vary. - Response times might be slightly longer than direct API calls. ``` -------------------------------- ### Local LLM Setup with GPU Source: https://github.com/team-mirai/kouchou-ai/blob/main/README.md Guide for setting up and using local Large Language Models (LLMs) with GPU acceleration in kouchou-ai. This involves configuring the .env file and starting the Ollama service. ```bash WITH_GPU=true docker compose up -d --profile ollama ``` -------------------------------- ### Check Python Version Source: https://github.com/team-mirai/kouchou-ai/blob/main/experimental/direct_win/README.md Checks the installed Python version, recommending version 3.12. It also provides a link to the Python website for installation if needed. ```bash python --version ``` -------------------------------- ### Client Development Environment Setup Source: https://github.com/team-mirai/kouchou-ai/blob/main/README.md This command sets up the development environment for the client and client-admin applications, including the dummy-server. ```sh make client-setup ``` -------------------------------- ### Starting the kouchou-ai Server Source: https://github.com/team-mirai/kouchou-ai/blob/main/server/README.md Command to start the kouchou-ai API server using Docker Compose. It also mentions accessing the Swagger UI at http://localhost:8000/docs for API interaction and verification. ```bash docker compose up api ``` -------------------------------- ### Developer Setup and Launch Source: https://github.com/team-mirai/kouchou-ai/blob/main/README.md Instructions for developers to set up and launch the kouchou-ai application using Docker Compose. This includes cloning the repository, configuring environment variables, and running the application. ```bash cp .env.example .env docker compose up # If environment variables are changed: docker compose down docker compose up --build # To start specific services: docker compose up --no-deps client api ``` -------------------------------- ### Azure Operations Setup Source: https://github.com/team-mirai/kouchou-ai/blob/main/CLAUDE.md Provides commands for setting up and managing Azure services for the project. Includes building images, pushing to ACR, deploying containers, and retrieving service information. ```makefile azure-setup-all: Build images, push to ACR, and deploy containers. azure-build: Build Docker images. azure-push: Push Docker images to Azure Container Registry (ACR). azure-deploy: Deploy containers to Azure. azure-info: Get service URLs and other information. ``` -------------------------------- ### Start Development Server Source: https://github.com/team-mirai/kouchou-ai/blob/main/README.md This command starts the development server for the client applications with parallel execution using 3 jobs. ```sh make client-dev -j 3 ``` -------------------------------- ### Install Dependencies Source: https://github.com/team-mirai/kouchou-ai/blob/main/test/e2e/README.md Installs the necessary Node.js dependencies for the project. ```bash npm install ``` -------------------------------- ### GitHub App Permissions Configuration Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/github-actions-status-update.md Specifies the necessary permissions for a GitHub App to interact with GitHub Projects and repositories. This includes read/write access to Projects and read-only access to Metadata and Actions. ```APIDOC Permissions > Organization permissions > Projects > Read and write Permissions > Repository permissions > Metadata > Read only Permissions > Repository permissions > Actions > Read only ``` -------------------------------- ### Organization Secrets Configuration Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/github-actions-status-update.md Details the configuration of organization secrets required for the GitHub App. This involves setting `PJ_APP_ID` to the App ID and `PJ_APP_PEM` to the content of the downloaded private key file. ```APIDOC PJ_APP_ID : App ID from the App's General tab PJ_APP_PEM : Content of the downloaded pem file (entire text) ``` -------------------------------- ### GraphQL Query for Project and Field IDs Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/github-actions-status-update.md A GraphQL query to retrieve the Project ID and Status Field ID for a given organization and project. This is useful for configuring the GitHub App's specific project details. ```graphql { organization(login: "digitaldemocracy2030") { projectV2(number: 3) { id fields(first: 20) { nodes { ... on ProjectV2SingleSelectField { id name } } } } } } ``` -------------------------------- ### Dockerのインストールと設定 Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/linux-setup.md Ubuntu環境にDockerとDocker Composeをインストールし、ユーザーをdockerグループに追加して権限を付与する手順。 ```bash sudo apt-get update sudo apt-get install -y docker.io docker-compose sudo systemctl enable docker sudo systemctl start docker sudo usermod -aG docker $USER ``` -------------------------------- ### Mac環境での広聴AIセットアップと実行 Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/mac-setup.md Mac環境で広聴AIをセットアップし、起動・停止するための基本的なシェルコマンドです。これには、セットアップスクリプトの実行、アプリケーションの起動、停止、およびAPIキーの再設定が含まれます。 ```bash chmod +x setup_mac.sh ./setup_mac.sh ``` ```bash ./start_mac.sh ``` ```bash ./stop_mac.sh ``` ```bash # OpenAI APIキーを変更する場合 ./stop_mac.sh ./setup_mac.sh ``` -------------------------------- ### Install Playwright Browsers Source: https://github.com/team-mirai/kouchou-ai/blob/main/test/e2e/README.md Downloads and installs the browsers required by Playwright for testing. ```bash npx playwright install ``` -------------------------------- ### Clone GitHub Repository Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/github-pages-hosting.md Clones the GitHub repository to your local machine. This is the first step in setting up the hosting environment. ```bash git clone https://github.com/ユーザー名/kouchou-ai-reports.git cd kouchou-ai-reports ``` -------------------------------- ### 広聴AIセットアップスクリプトの実行 Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/linux-setup.md 広聴AIのセットアップスクリプトに実行権限を付与し、OpenAI APIキーを入力してセットアップを開始する手順。 ```bash cd 展開したフォルダのパス chmod +x setup_linux.sh ./setup_linux.sh ``` -------------------------------- ### OpenAI APIキー設定 Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/mac-setup.md 広聴AIアプリケーションのセットアップ中に、OpenAI APIキーを入力するプロンプトが表示されます。このキーは、OpenAIのサービスを利用するために必要です。 ```APIDOC OpenAI API Key: - Type: string - Description: Your OpenAI API key obtained from the OpenAI platform. - Example: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` -------------------------------- ### Restart Containers Source: https://github.com/team-mirai/kouchou-ai/blob/main/Azure.md A sequence of make commands to stop and then start containers, with a 10-second delay in between. This is a common troubleshooting step for resolving issues caused by unresponsive containers. ```bash make azure-stop sleep 10 make azure-start ``` -------------------------------- ### 広聴AIアプリケーションアクセスURL Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/mac-setup.md セットアップ完了後、広聴AIアプリケーションにアクセスするためのローカルホストURLです。レポート閲覧画面と管理画面が提供されます。 ```APIDOC Application Access: - Report View: http://localhost:3000 - Admin Panel: http://localhost:4000 ``` -------------------------------- ### Stop the application using stop_win.bat Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/windows-setup.md Stops the 広聴AI application using the provided batch script. This script terminates the Docker containers associated with the application. ```BATCH stop_win.bat ``` -------------------------------- ### Docker Desktopリソース設定 Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/mac-setup.md メモリ不足エラーが発生した場合に推奨されるDocker Desktopのリソース割り当て設定です。これにより、アプリケーションの安定した動作が保証されます。 ```APIDOC Docker Resource Allocation: - Memory: 4GB or more - CPU: 2 cores or more ``` -------------------------------- ### Metadata File Setup for Customization Source: https://github.com/team-mirai/kouchou-ai/blob/main/README.md Details on how to customize reporter information (logo, links) by placing specific files in the 'server/public/meta/custom' directory. This includes metadata.json, reporter.png, icon.png, and ogp.png. ```json { "webLink": "https://example.com", "privacyLink": "https://example.com/privacy", "termsLink": "https://example.com/terms" } ``` -------------------------------- ### 広聴AIのダウンロードと展開 Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/linux-setup.md 広聴AIの最新安定版リリースをダウンロードし、指定したパスに展開するためのコマンド。 ```bash unzip ダウンロードしたzipファイル -d 展開先のパス ``` -------------------------------- ### Environment Configuration Source: https://github.com/team-mirai/kouchou-ai/blob/main/CLAUDE.md Information on how environment configurations are managed for Kouchou-AI, covering local `.env` files, Docker Compose orchestration, and Azure deployment specifics via Makefiles. ```bash # Environment Configuration # - Local: .env files in each service directory # - Docker: compose.yaml orchestrates all services # - Azure: Complex deployment via Makefile targets ``` -------------------------------- ### GitHub Project Board Statuses and Actions Source: https://github.com/team-mirai/kouchou-ai/blob/main/PROJECTS.md This table outlines the different statuses in the GitHub project board, their corresponding issue states, the actions to be taken, and the primary responsible party. It serves as a guide for task progression and management. ```APIDOC Status Definitions: | Status | Issue State | Action (To-Do) ``` -------------------------------- ### Check LM Studio API Health Source: https://github.com/team-mirai/kouchou-ai/blob/main/experimental/embvec_reduce_public_comment/generate_evil_comments_lmstudio.ipynb This snippet uses the `requests` library to send a GET request to the LM Studio API endpoint '/v1/models' to verify if the API is running and to retrieve a list of available models. It then pretty-prints the JSON response. ```python import requests, pprint pprint.pp(requests.get("http://localhost:1234/v1/models").json()) ``` -------------------------------- ### 広聴AIアプリケーションの起動・停止 Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/linux-setup.md 広聴AIアプリケーションを起動および停止するためのスクリプト。 ```bash ./start_linux.sh ``` ```bash ./stop_linux.sh ``` -------------------------------- ### OpenAI APIキーの再設定 Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/linux-setup.md 広聴AIのOpenAI APIキーを再設定するための手順。既存のアプリケーションを停止し、セットアップスクリプトを再実行する。 ```bash ./stop_linux.sh ./setup_linux.sh ``` -------------------------------- ### Build Commands Source: https://github.com/team-mirai/kouchou-ai/blob/main/CLAUDE.md Commands for building Docker images, generating static builds for the client, and performing development builds for both client and client-admin applications. ```bash # Build all Docker images make build # Static build generation make client-build-static # Client development builds cd client && npm run build cd client-admin && npm run build ``` -------------------------------- ### Docker権限エラーの解決 Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/linux-setup.md Dockerの権限エラー(permission denied)が発生した場合に、ユーザーをdockerグループに追加し、権限を再適用するコマンド。 ```bash sudo usermod -aG docker $USER ``` -------------------------------- ### Push Changes to GitHub Source: https://github.com/team-mirai/kouchou-ai/blob/main/docs/github-pages-hosting.md Adds all changed files, commits them with a message, and pushes the changes to the main branch of the GitHub repository. This deploys the static files. ```bash cd /path/to/kouchou-ai-reports git add . git commit -m "Update static files" git push origin main ``` -------------------------------- ### FastAPI Server Structure Source: https://github.com/team-mirai/kouchou-ai/blob/main/CLAUDE.md Overview of the directory structure for the FastAPI backend, highlighting key components like route handlers, business logic services, data models, and data access layers. ```bash # API Structure # - /server/src/routers/ - FastAPI route handlers # - /server/src/services/ - Business logic layer # - /server/src/schemas/ - Pydantic data models # - /server/src/repositories/ - Data access layer ```