GitHub Action
commited on
Commit
·
55cbdc2
1
Parent(s):
f1e6fda
🚀 Auto-deploy from GitHub Actions
Browse files- README.md +84 -1
- contbk/gra_12_rpa/rpa_automation.py +516 -0
- controllers/contbk_example.py +3 -3
- controllers/contbk_unified_dashboard.py +267 -0
- controllers/conversation_logger.py +323 -5
- controllers/github_issue_creator.py +182 -0
- docs/readme_addition.md +83 -0
- docs/system_showcase.md +121 -0
- generate_system_docs.py +313 -0
- mysite/routers/gradio.py +28 -13
- session_context_prompt.md +56 -0
README.md
CHANGED
|
@@ -506,4 +506,87 @@ netstat -tulpn | grep 5678
|
|
| 506 |
**Python**: 3.12+
|
| 507 |
**フレームワーク**: FastAPI + Django + Gradio + AI
|
| 508 |
|
| 509 |
-
> 🌱 **This website grows with AI** - 新機能はAIとの対話で自動追加される、生きたWebアプリケーションです。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 506 |
**Python**: 3.12+
|
| 507 |
**フレームワーク**: FastAPI + Django + Gradio + AI
|
| 508 |
|
| 509 |
+
> 🌱 **This website grows with AI** - 新機能はAIとの対話で自動追加される、生きたWebアプリケーションです。
|
| 510 |
+
|
| 511 |
+
## 📸 システムスクリーンショット・ギャラリー
|
| 512 |
+
|
| 513 |
+
### 🎯 ContBK統合ダッシュボード
|
| 514 |
+

|
| 515 |
+
|
| 516 |
+
**機能概要**:
|
| 517 |
+
- 🏠 概要タブで全体像把握
|
| 518 |
+
- 🤖 AI・自動化カテゴリ
|
| 519 |
+
- 📄 ドキュメント・開発カテゴリ
|
| 520 |
+
- 🎨 フロントエンド・UIカテゴリ
|
| 521 |
+
- 📊 データ・ファイルカテゴリ
|
| 522 |
+
- 🌐 その他ツール
|
| 523 |
+
- 🐙 開発・Issue管理カテゴリ
|
| 524 |
+
|
| 525 |
+
### 🐙 GitHub Issue自動作成機能
|
| 526 |
+

|
| 527 |
+
|
| 528 |
+
**革新的機能**:
|
| 529 |
+
- 💬 会話履歴からIssue自動生成
|
| 530 |
+
- 🏷️ ラベル自動付与
|
| 531 |
+
- 📝 Markdown形式の美しいIssue
|
| 532 |
+
- 🔄 セッション情報の自動記録
|
| 533 |
+
|
| 534 |
+
### 🤖 RPA自動化システム
|
| 535 |
+

|
| 536 |
+
|
| 537 |
+
**高度な自動化**:
|
| 538 |
+
- 🌐 Webブラウザ自動操作
|
| 539 |
+
- 📸 スクリーンショット取得
|
| 540 |
+
- 🎯 要素の自動認識
|
| 541 |
+
- 💾 操作履歴の完全記録
|
| 542 |
+
|
| 543 |
+
## 🚀 ライブデモ
|
| 544 |
+
|
| 545 |
+
### 🌐 本番環境
|
| 546 |
+
**メインサイト**: [https://ideal-halibut-4q5qp79g2jp9-7860.app.github.dev/](https://ideal-halibut-4q5qp79g2jp9-7860.app.github.dev/)
|
| 547 |
+
|
| 548 |
+
実際に稼働中のシステムをご体験いただけます!
|
| 549 |
+
|
| 550 |
+
### 📋 現在のオープンイシュー
|
| 551 |
+
|
| 552 |
+
- **#6** - test (更新: 2025-06-11)
|
| 553 |
+
- **#5** - RPAで画像取得ができなら (更新: 2025-06-11)
|
| 554 |
+
- **#4** - 🤖 ContBK統合システム:GitHub Issue自動作成機能開発 (enhancement, python) (更新: 2025-06-11)
|
| 555 |
+
|
| 556 |
+
## 📊 開発統計
|
| 557 |
+
|
| 558 |
+
### ✅ 実装完了機能 (6個)
|
| 559 |
+
1. 🤖 ContBK統合ダッシュボード
|
| 560 |
+
2. 🐙 GitHub Issue自動作成機能
|
| 561 |
+
3. 💬 会話履歴記録システム
|
| 562 |
+
4. 🤖 RPA自動化システム
|
| 563 |
+
5. 🎨 UI自動生成システム
|
| 564 |
+
6. 📄 ドキュメント生成AI
|
| 565 |
+
|
| 566 |
+
### 🏗️ システムアーキテクチャ
|
| 567 |
+
```
|
| 568 |
+
fastapi_django_main_live/
|
| 569 |
+
├── 🎯 controllers/ # 統合ダッシュボード・Issue作成
|
| 570 |
+
├── 🤖 contbk/ # AI・RPA・UI生成機能群
|
| 571 |
+
├── 💾 データベース/ # 会話・RPA・プロンプト履歴
|
| 572 |
+
├── 🌐 mysite/ # FastAPI・Django統合
|
| 573 |
+
└── 📚 docs/ # ドキュメント・スクリーンショット
|
| 574 |
+
```
|
| 575 |
+
|
| 576 |
+
### 📈 開発成果
|
| 577 |
+
- **開発期間**: 2025年06月
|
| 578 |
+
- **コミット数**: 継続的更新中
|
| 579 |
+
- **機能数**: 6個以上
|
| 580 |
+
- **技術統合**: AI + Web + 自動化
|
| 581 |
+
|
| 582 |
+
---
|
| 583 |
+
|
| 584 |
+
## 🔗 詳細ドキュメント
|
| 585 |
+
|
| 586 |
+
- 📘 **[システムショーケース](./docs/system_showcase.md)** - 開発成果の詳細
|
| 587 |
+
- 🤖 **[AI視点分析](./docs/AI.md)** - AIによるシステム評価
|
| 588 |
+
- 🛠️ **[技術仕様書](./docs/)** - 開発者向け詳細情報
|
| 589 |
+
|
| 590 |
+
---
|
| 591 |
+
|
| 592 |
+
*最終更新: 2025年06月11日 11:41:41*
|
contbk/gra_12_rpa/rpa_automation.py
ADDED
|
@@ -0,0 +1,516 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
RPAシステム with Gradio
|
| 3 |
+
========================
|
| 4 |
+
|
| 5 |
+
Playwright + Gradio を使った Web RPA システム
|
| 6 |
+
|
| 7 |
+
機能:
|
| 8 |
+
- 🎯 ウェブページスクリーンショット
|
| 9 |
+
- 🖱️ 画面操作自動化
|
| 10 |
+
- 📸 画像比較・認識
|
| 11 |
+
- 🔄 定期実行・監視
|
| 12 |
+
- 📊 実行履歴・ログ管理
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
import asyncio
|
| 16 |
+
import os
|
| 17 |
+
import sys
|
| 18 |
+
import datetime
|
| 19 |
+
import json
|
| 20 |
+
import sqlite3
|
| 21 |
+
from typing import Optional, List, Dict, Tuple
|
| 22 |
+
from pathlib import Path
|
| 23 |
+
import traceback
|
| 24 |
+
|
| 25 |
+
import gradio as gr
|
| 26 |
+
from PIL import Image, ImageDraw, ImageChops
|
| 27 |
+
import io
|
| 28 |
+
import base64
|
| 29 |
+
|
| 30 |
+
# Playwrightのインポート(遅延インポート)
|
| 31 |
+
try:
|
| 32 |
+
from playwright.async_api import async_playwright, Browser, Page
|
| 33 |
+
PLAYWRIGHT_AVAILABLE = True
|
| 34 |
+
except ImportError:
|
| 35 |
+
PLAYWRIGHT_AVAILABLE = False
|
| 36 |
+
print("⚠️ Playwright not installed. Install with: pip install playwright && playwright install")
|
| 37 |
+
|
| 38 |
+
# インターフェースメタデータ
|
| 39 |
+
interface_title = "🤖 RPA自動化システム"
|
| 40 |
+
interface_description = "Playwright + Gradio による Web RPA・画面自動化"
|
| 41 |
+
|
| 42 |
+
class RPAManager:
|
| 43 |
+
def __init__(self, db_path: str = "rpa_history.db"):
|
| 44 |
+
"""RPA管理システムの初期化"""
|
| 45 |
+
self.db_path = db_path
|
| 46 |
+
self.init_database()
|
| 47 |
+
self.browser = None
|
| 48 |
+
self.page = None
|
| 49 |
+
|
| 50 |
+
def init_database(self):
|
| 51 |
+
"""データベース初期化"""
|
| 52 |
+
conn = sqlite3.connect(self.db_path)
|
| 53 |
+
cursor = conn.cursor()
|
| 54 |
+
|
| 55 |
+
# RPA実行履歴テーブル
|
| 56 |
+
cursor.execute('''
|
| 57 |
+
CREATE TABLE IF NOT EXISTS rpa_executions (
|
| 58 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
| 59 |
+
task_name TEXT NOT NULL,
|
| 60 |
+
url TEXT,
|
| 61 |
+
action_type TEXT NOT NULL,
|
| 62 |
+
parameters TEXT,
|
| 63 |
+
screenshot_path TEXT,
|
| 64 |
+
success BOOLEAN,
|
| 65 |
+
error_message TEXT,
|
| 66 |
+
execution_time REAL,
|
| 67 |
+
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
| 68 |
+
)
|
| 69 |
+
''')
|
| 70 |
+
|
| 71 |
+
# RPAタスクテンプレートテーブル
|
| 72 |
+
cursor.execute('''
|
| 73 |
+
CREATE TABLE IF NOT EXISTS rpa_templates (
|
| 74 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
| 75 |
+
template_name TEXT NOT NULL UNIQUE,
|
| 76 |
+
description TEXT,
|
| 77 |
+
actions TEXT NOT NULL,
|
| 78 |
+
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
| 79 |
+
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
| 80 |
+
)
|
| 81 |
+
''')
|
| 82 |
+
|
| 83 |
+
conn.commit()
|
| 84 |
+
conn.close()
|
| 85 |
+
print("✅ RPA データベース初期化完了")
|
| 86 |
+
|
| 87 |
+
async def capture_screenshot(self, url: str, selector: str = None, wait_time: int = 3) -> Tuple[Image.Image, str]:
|
| 88 |
+
"""
|
| 89 |
+
ウェブページのスクリーンショットを取得
|
| 90 |
+
|
| 91 |
+
Args:
|
| 92 |
+
url: 対象URL
|
| 93 |
+
selector: 特定要素のセレクタ(オプション)
|
| 94 |
+
wait_time: 待機時間(秒)
|
| 95 |
+
|
| 96 |
+
Returns:
|
| 97 |
+
(画像, エラーメッセージ)
|
| 98 |
+
"""
|
| 99 |
+
if not PLAYWRIGHT_AVAILABLE:
|
| 100 |
+
return None, "Playwright がインストールされていません"
|
| 101 |
+
|
| 102 |
+
try:
|
| 103 |
+
async with async_playwright() as p:
|
| 104 |
+
browser = await p.chromium.launch(headless=True)
|
| 105 |
+
page = await browser.new_page()
|
| 106 |
+
|
| 107 |
+
# ページ読み込み
|
| 108 |
+
await page.goto(url, wait_until='networkidle')
|
| 109 |
+
|
| 110 |
+
# 待機
|
| 111 |
+
await asyncio.sleep(wait_time)
|
| 112 |
+
|
| 113 |
+
# スクリーンショット取得
|
| 114 |
+
if selector:
|
| 115 |
+
# 特定要素のスクリーンショット
|
| 116 |
+
element = await page.query_selector(selector)
|
| 117 |
+
if element:
|
| 118 |
+
screenshot_bytes = await element.screenshot()
|
| 119 |
+
else:
|
| 120 |
+
screenshot_bytes = await page.screenshot()
|
| 121 |
+
return None, f"セレクタ '{selector}' が見つかりません"
|
| 122 |
+
else:
|
| 123 |
+
# ページ全体のスクリーンショット
|
| 124 |
+
screenshot_bytes = await page.screenshot(full_page=True)
|
| 125 |
+
|
| 126 |
+
await browser.close()
|
| 127 |
+
|
| 128 |
+
# PIL画像に変換
|
| 129 |
+
img = Image.open(io.BytesIO(screenshot_bytes))
|
| 130 |
+
|
| 131 |
+
# 実行履歴を保存
|
| 132 |
+
self.save_execution(
|
| 133 |
+
task_name="スクリーンショット取得",
|
| 134 |
+
url=url,
|
| 135 |
+
action_type="screenshot",
|
| 136 |
+
parameters=json.dumps({"selector": selector, "wait_time": wait_time}),
|
| 137 |
+
success=True
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
+
return img, "✅ スクリーンショット取得成功"
|
| 141 |
+
|
| 142 |
+
except Exception as e:
|
| 143 |
+
error_msg = f"❌ エラー: {str(e)}"
|
| 144 |
+
|
| 145 |
+
# エラーログを保存
|
| 146 |
+
self.save_execution(
|
| 147 |
+
task_name="スクリーンショット取得",
|
| 148 |
+
url=url,
|
| 149 |
+
action_type="screenshot",
|
| 150 |
+
parameters=json.dumps({"selector": selector, "wait_time": wait_time}),
|
| 151 |
+
success=False,
|
| 152 |
+
error_message=str(e)
|
| 153 |
+
)
|
| 154 |
+
|
| 155 |
+
return None, error_msg
|
| 156 |
+
|
| 157 |
+
async def click_element(self, url: str, selector: str, wait_time: int = 3) -> Tuple[Image.Image, str]:
|
| 158 |
+
"""
|
| 159 |
+
要素をクリックして結果をキャプチャ
|
| 160 |
+
|
| 161 |
+
Args:
|
| 162 |
+
url: 対象URL
|
| 163 |
+
selector: クリック対象のセレクタ
|
| 164 |
+
wait_time: クリック後の待機時間
|
| 165 |
+
|
| 166 |
+
Returns:
|
| 167 |
+
(クリック後の画像, メッセージ)
|
| 168 |
+
"""
|
| 169 |
+
if not PLAYWRIGHT_AVAILABLE:
|
| 170 |
+
return None, "Playwright がインストールされていません"
|
| 171 |
+
|
| 172 |
+
try:
|
| 173 |
+
async with async_playwright() as p:
|
| 174 |
+
browser = await p.chromium.launch(headless=True)
|
| 175 |
+
page = await browser.new_page()
|
| 176 |
+
|
| 177 |
+
# ページ読み込み
|
| 178 |
+
await page.goto(url, wait_until='networkidle')
|
| 179 |
+
|
| 180 |
+
# 要素を待機してクリック
|
| 181 |
+
await page.wait_for_selector(selector, timeout=10000)
|
| 182 |
+
await page.click(selector)
|
| 183 |
+
|
| 184 |
+
# 待機
|
| 185 |
+
await asyncio.sleep(wait_time)
|
| 186 |
+
|
| 187 |
+
# クリック後のスクリーンショット
|
| 188 |
+
screenshot_bytes = await page.screenshot(full_page=True)
|
| 189 |
+
await browser.close()
|
| 190 |
+
|
| 191 |
+
img = Image.open(io.BytesIO(screenshot_bytes))
|
| 192 |
+
|
| 193 |
+
# 実行履歴を保存
|
| 194 |
+
self.save_execution(
|
| 195 |
+
task_name="要素クリック",
|
| 196 |
+
url=url,
|
| 197 |
+
action_type="click",
|
| 198 |
+
parameters=json.dumps({"selector": selector, "wait_time": wait_time}),
|
| 199 |
+
success=True
|
| 200 |
+
)
|
| 201 |
+
|
| 202 |
+
return img, f"✅ 要素クリック成功: {selector}"
|
| 203 |
+
|
| 204 |
+
except Exception as e:
|
| 205 |
+
error_msg = f"❌ クリックエラー: {str(e)}"
|
| 206 |
+
|
| 207 |
+
self.save_execution(
|
| 208 |
+
task_name="要素クリック",
|
| 209 |
+
url=url,
|
| 210 |
+
action_type="click",
|
| 211 |
+
parameters=json.dumps({"selector": selector, "wait_time": wait_time}),
|
| 212 |
+
success=False,
|
| 213 |
+
error_message=str(e)
|
| 214 |
+
)
|
| 215 |
+
|
| 216 |
+
return None, error_msg
|
| 217 |
+
|
| 218 |
+
async def fill_form(self, url: str, form_data: Dict[str, str], submit_selector: str = None) -> Tuple[Image.Image, str]:
|
| 219 |
+
"""
|
| 220 |
+
フォーム入力と送信
|
| 221 |
+
|
| 222 |
+
Args:
|
| 223 |
+
url: 対象URL
|
| 224 |
+
form_data: {セレクタ: 入力値} の辞書
|
| 225 |
+
submit_selector: 送信ボタンのセレクタ
|
| 226 |
+
|
| 227 |
+
Returns:
|
| 228 |
+
(実行後の画像, メッセージ)
|
| 229 |
+
"""
|
| 230 |
+
if not PLAYWRIGHT_AVAILABLE:
|
| 231 |
+
return None, "Playwright がインストールされていません"
|
| 232 |
+
|
| 233 |
+
try:
|
| 234 |
+
async with async_playwright() as p:
|
| 235 |
+
browser = await p.chromium.launch(headless=True)
|
| 236 |
+
page = await browser.new_page()
|
| 237 |
+
|
| 238 |
+
await page.goto(url, wait_until='networkidle')
|
| 239 |
+
|
| 240 |
+
# フォーム入力
|
| 241 |
+
for selector, value in form_data.items():
|
| 242 |
+
await page.wait_for_selector(selector, timeout=10000)
|
| 243 |
+
await page.fill(selector, value)
|
| 244 |
+
await asyncio.sleep(0.5)
|
| 245 |
+
|
| 246 |
+
# 送信ボタンクリック
|
| 247 |
+
if submit_selector:
|
| 248 |
+
await page.click(submit_selector)
|
| 249 |
+
await asyncio.sleep(3)
|
| 250 |
+
|
| 251 |
+
# 結果のスクリーンショット
|
| 252 |
+
screenshot_bytes = await page.screenshot(full_page=True)
|
| 253 |
+
await browser.close()
|
| 254 |
+
|
| 255 |
+
img = Image.open(io.BytesIO(screenshot_bytes))
|
| 256 |
+
|
| 257 |
+
self.save_execution(
|
| 258 |
+
task_name="フォーム入力",
|
| 259 |
+
url=url,
|
| 260 |
+
action_type="fill_form",
|
| 261 |
+
parameters=json.dumps({"form_data": form_data, "submit_selector": submit_selector}),
|
| 262 |
+
success=True
|
| 263 |
+
)
|
| 264 |
+
|
| 265 |
+
return img, "✅ フォーム入力・送信成功"
|
| 266 |
+
|
| 267 |
+
except Exception as e:
|
| 268 |
+
error_msg = f"❌ フォーム入力エラー: {str(e)}"
|
| 269 |
+
|
| 270 |
+
self.save_execution(
|
| 271 |
+
task_name="フォーム入力",
|
| 272 |
+
url=url,
|
| 273 |
+
action_type="fill_form",
|
| 274 |
+
parameters=json.dumps({"form_data": form_data, "submit_selector": submit_selector}),
|
| 275 |
+
success=False,
|
| 276 |
+
error_message=str(e)
|
| 277 |
+
)
|
| 278 |
+
|
| 279 |
+
return None, error_msg
|
| 280 |
+
|
| 281 |
+
def save_execution(self, task_name: str, url: str, action_type: str,
|
| 282 |
+
parameters: str, success: bool, error_message: str = None):
|
| 283 |
+
"""実行履歴をデータベースに保存"""
|
| 284 |
+
try:
|
| 285 |
+
conn = sqlite3.connect(self.db_path)
|
| 286 |
+
cursor = conn.cursor()
|
| 287 |
+
|
| 288 |
+
cursor.execute('''
|
| 289 |
+
INSERT INTO rpa_executions
|
| 290 |
+
(task_name, url, action_type, parameters, success, error_message)
|
| 291 |
+
VALUES (?, ?, ?, ?, ?, ?)
|
| 292 |
+
''', (task_name, url, action_type, parameters, success, error_message))
|
| 293 |
+
|
| 294 |
+
conn.commit()
|
| 295 |
+
conn.close()
|
| 296 |
+
except Exception as e:
|
| 297 |
+
print(f"⚠️ 実行履歴保存エラー: {e}")
|
| 298 |
+
|
| 299 |
+
def get_execution_history(self, limit: int = 20) -> List[Dict]:
|
| 300 |
+
"""実行履歴を取得"""
|
| 301 |
+
try:
|
| 302 |
+
conn = sqlite3.connect(self.db_path)
|
| 303 |
+
cursor = conn.cursor()
|
| 304 |
+
|
| 305 |
+
cursor.execute('''
|
| 306 |
+
SELECT task_name, url, action_type, success, error_message, created_at
|
| 307 |
+
FROM rpa_executions
|
| 308 |
+
ORDER BY created_at DESC
|
| 309 |
+
LIMIT ?
|
| 310 |
+
''', (limit,))
|
| 311 |
+
|
| 312 |
+
rows = cursor.fetchall()
|
| 313 |
+
conn.close()
|
| 314 |
+
|
| 315 |
+
return [
|
| 316 |
+
{
|
| 317 |
+
"task_name": row[0],
|
| 318 |
+
"url": row[1],
|
| 319 |
+
"action_type": row[2],
|
| 320 |
+
"success": row[3],
|
| 321 |
+
"error_message": row[4],
|
| 322 |
+
"created_at": row[5]
|
| 323 |
+
}
|
| 324 |
+
for row in rows
|
| 325 |
+
]
|
| 326 |
+
except Exception as e:
|
| 327 |
+
print(f"⚠️ 履歴取得エラー: {e}")
|
| 328 |
+
return []
|
| 329 |
+
|
| 330 |
+
# グローバルインスタンス
|
| 331 |
+
rpa_manager = RPAManager()
|
| 332 |
+
|
| 333 |
+
def create_rpa_interface():
|
| 334 |
+
"""RPA Gradio インターフェースを作成"""
|
| 335 |
+
|
| 336 |
+
def screenshot_wrapper(url, selector, wait_time):
|
| 337 |
+
"""スクリーンショット取得のラッパー関数"""
|
| 338 |
+
if not url:
|
| 339 |
+
return None, "❌ URLを入力してください"
|
| 340 |
+
|
| 341 |
+
try:
|
| 342 |
+
img, message = asyncio.run(rpa_manager.capture_screenshot(url, selector or None, wait_time))
|
| 343 |
+
return img, message
|
| 344 |
+
except Exception as e:
|
| 345 |
+
return None, f"❌ エラー: {str(e)}"
|
| 346 |
+
|
| 347 |
+
def click_wrapper(url, selector, wait_time):
|
| 348 |
+
"""クリック操作のラッパー関数"""
|
| 349 |
+
if not url or not selector:
|
| 350 |
+
return None, "❌ URLとセレクタを入力してください"
|
| 351 |
+
|
| 352 |
+
try:
|
| 353 |
+
img, message = asyncio.run(rpa_manager.click_element(url, selector, wait_time))
|
| 354 |
+
return img, message
|
| 355 |
+
except Exception as e:
|
| 356 |
+
return None, f"❌ エラー: {str(e)}"
|
| 357 |
+
|
| 358 |
+
def get_history_display():
|
| 359 |
+
"""実行履歴を表示用フォーマットで取得"""
|
| 360 |
+
history = rpa_manager.get_execution_history(10)
|
| 361 |
+
if not history:
|
| 362 |
+
return "📊 実行履歴はありません"
|
| 363 |
+
|
| 364 |
+
lines = ["# 🕒 RPA実行履歴", ""]
|
| 365 |
+
for i, record in enumerate(history, 1):
|
| 366 |
+
status = "✅" if record["success"] else "❌"
|
| 367 |
+
lines.append(f"## {i}. {status} {record['task_name']}")
|
| 368 |
+
lines.append(f"- **URL**: {record['url']}")
|
| 369 |
+
lines.append(f"- **アクション**: {record['action_type']}")
|
| 370 |
+
lines.append(f"- **日時**: {record['created_at']}")
|
| 371 |
+
if record["error_message"]:
|
| 372 |
+
lines.append(f"- **エラー**: {record['error_message']}")
|
| 373 |
+
lines.append("")
|
| 374 |
+
|
| 375 |
+
return "\n".join(lines)
|
| 376 |
+
|
| 377 |
+
with gr.Blocks(title="🤖 RPA自動化システム", theme=gr.themes.Soft()) as interface:
|
| 378 |
+
gr.Markdown("# 🤖 RPA自動化システム")
|
| 379 |
+
gr.Markdown("Playwright + Gradio による Web自動化・画面操作ツール")
|
| 380 |
+
|
| 381 |
+
if not PLAYWRIGHT_AVAILABLE:
|
| 382 |
+
gr.Markdown("""
|
| 383 |
+
## ⚠️ セットアップが必要です
|
| 384 |
+
|
| 385 |
+
Playwrightをインストールしてください:
|
| 386 |
+
```bash
|
| 387 |
+
pip install playwright
|
| 388 |
+
playwright install
|
| 389 |
+
```
|
| 390 |
+
""")
|
| 391 |
+
|
| 392 |
+
with gr.Tab("📸 スクリーンショット"):
|
| 393 |
+
gr.Markdown("## 🎯 ウェブページキャプチャ")
|
| 394 |
+
|
| 395 |
+
with gr.Row():
|
| 396 |
+
with gr.Column(scale=2):
|
| 397 |
+
url_input = gr.Textbox(
|
| 398 |
+
label="🌐 URL",
|
| 399 |
+
placeholder="https://example.com",
|
| 400 |
+
value="https://www.google.com"
|
| 401 |
+
)
|
| 402 |
+
with gr.Column(scale=1):
|
| 403 |
+
wait_time = gr.Slider(
|
| 404 |
+
label="⏱️ 待機時間(秒)",
|
| 405 |
+
minimum=1,
|
| 406 |
+
maximum=10,
|
| 407 |
+
value=3,
|
| 408 |
+
step=1
|
| 409 |
+
)
|
| 410 |
+
|
| 411 |
+
selector_input = gr.Textbox(
|
| 412 |
+
label="🎯 セレクタ (オプション)",
|
| 413 |
+
placeholder="body, .class-name, #id-name など",
|
| 414 |
+
value=""
|
| 415 |
+
)
|
| 416 |
+
|
| 417 |
+
screenshot_btn = gr.Button("📸 スクリーンショット取得", variant="primary", size="lg")
|
| 418 |
+
|
| 419 |
+
with gr.Row():
|
| 420 |
+
screenshot_output = gr.Image(label="📷 取得画像")
|
| 421 |
+
screenshot_message = gr.Textbox(label="📝 実行結果", lines=3)
|
| 422 |
+
|
| 423 |
+
screenshot_btn.click(
|
| 424 |
+
screenshot_wrapper,
|
| 425 |
+
inputs=[url_input, selector_input, wait_time],
|
| 426 |
+
outputs=[screenshot_output, screenshot_message]
|
| 427 |
+
)
|
| 428 |
+
|
| 429 |
+
with gr.Tab("🖱️ 画面操作"):
|
| 430 |
+
gr.Markdown("## 🎯 要素クリック・操作")
|
| 431 |
+
|
| 432 |
+
with gr.Row():
|
| 433 |
+
click_url = gr.Textbox(
|
| 434 |
+
label="🌐 URL",
|
| 435 |
+
placeholder="https://example.com",
|
| 436 |
+
scale=2
|
| 437 |
+
)
|
| 438 |
+
click_wait = gr.Slider(
|
| 439 |
+
label="⏱️ 待機時間",
|
| 440 |
+
minimum=1,
|
| 441 |
+
maximum=10,
|
| 442 |
+
value=3,
|
| 443 |
+
scale=1
|
| 444 |
+
)
|
| 445 |
+
|
| 446 |
+
click_selector = gr.Textbox(
|
| 447 |
+
label="🎯 クリック対象セレクタ",
|
| 448 |
+
placeholder="button, .btn, #submit など",
|
| 449 |
+
value=""
|
| 450 |
+
)
|
| 451 |
+
|
| 452 |
+
click_btn = gr.Button("🖱️ クリック実行", variant="primary", size="lg")
|
| 453 |
+
|
| 454 |
+
with gr.Row():
|
| 455 |
+
click_output = gr.Image(label="📷 実行後画像")
|
| 456 |
+
click_message = gr.Textbox(label="📝 実行結果", lines=3)
|
| 457 |
+
|
| 458 |
+
click_btn.click(
|
| 459 |
+
click_wrapper,
|
| 460 |
+
inputs=[click_url, click_selector, click_wait],
|
| 461 |
+
outputs=[click_output, click_message]
|
| 462 |
+
)
|
| 463 |
+
|
| 464 |
+
with gr.Tab("📊 実行履歴"):
|
| 465 |
+
gr.Markdown("## 🕒 RPA実行履歴")
|
| 466 |
+
|
| 467 |
+
refresh_btn = gr.Button("🔄 履歴更新", variant="secondary")
|
| 468 |
+
history_display = gr.Markdown(value=get_history_display())
|
| 469 |
+
|
| 470 |
+
refresh_btn.click(
|
| 471 |
+
get_history_display,
|
| 472 |
+
outputs=history_display
|
| 473 |
+
)
|
| 474 |
+
|
| 475 |
+
with gr.Tab("ℹ️ ヘルプ"):
|
| 476 |
+
gr.Markdown("""
|
| 477 |
+
## 📚 RPA自動化システム ヘルプ
|
| 478 |
+
|
| 479 |
+
### 🎯 機能概要
|
| 480 |
+
- **📸 スクリーンショット**: ウェブページの画面キャプチャ
|
| 481 |
+
- **🖱️ 画面操作**: 要素のクリック、フォーム入力
|
| 482 |
+
- **📊 履歴管理**: 実行履歴の記録・表示
|
| 483 |
+
|
| 484 |
+
### 🔧 セレクタ例
|
| 485 |
+
- **要素タイプ**: `button`, `input`, `a`
|
| 486 |
+
- **クラス**: `.btn`, `.form-control`, `.nav-link`
|
| 487 |
+
- **ID**: `#submit`, `#login-form`, `#search-box`
|
| 488 |
+
- **属性**: `[name="email"]`, `[type="submit"]`
|
| 489 |
+
|
| 490 |
+
### 💡 使用例
|
| 491 |
+
1. **Google検索**:
|
| 492 |
+
- URL: `https://www.google.com`
|
| 493 |
+
- セレクタ: `[name="q"]` (検索ボックス)
|
| 494 |
+
|
| 495 |
+
2. **ボタンクリック**:
|
| 496 |
+
- セレクタ: `button`, `.btn-primary`, `#submit-btn`
|
| 497 |
+
|
| 498 |
+
### ⚠️ 注意事項
|
| 499 |
+
- 対象サイトの利用規約を確認してください
|
| 500 |
+
- 過度なアクセスは避けてください
|
| 501 |
+
- エラーが発生した場合は履歴を確認してください
|
| 502 |
+
""")
|
| 503 |
+
|
| 504 |
+
return interface
|
| 505 |
+
|
| 506 |
+
# このファイルのメインエクスポート
|
| 507 |
+
gradio_interface = create_rpa_interface()
|
| 508 |
+
|
| 509 |
+
# スタンドアロン実行用
|
| 510 |
+
if __name__ == "__main__":
|
| 511 |
+
print("🤖 RPA自動化システム起動中...")
|
| 512 |
+
gradio_interface.launch(
|
| 513 |
+
server_port=7865,
|
| 514 |
+
share=False,
|
| 515 |
+
debug=True
|
| 516 |
+
)
|
controllers/contbk_example.py
CHANGED
|
@@ -304,11 +304,11 @@ def create_unified_dashboard() -> gr.TabbedInterface:
|
|
| 304 |
|
| 305 |
print("🚀 Creating gradio_interface...")
|
| 306 |
# このファイルのメインエクスポート - 美しいタイトル付き
|
| 307 |
-
# gradio_interface = create_unified_dashboard() #
|
| 308 |
-
print("🚫 gradio_interface disabled to
|
| 309 |
|
| 310 |
# 自動検出システム用のメタデータ
|
| 311 |
-
interface_title = "🎯 ContBK ダッシュボード"
|
| 312 |
interface_description = "ContBKフォルダーの全インターフェースを統合表示"
|
| 313 |
|
| 314 |
# テスト実行用
|
|
|
|
| 304 |
|
| 305 |
print("🚀 Creating gradio_interface...")
|
| 306 |
# このファイルのメインエクスポート - 美しいタイトル付き
|
| 307 |
+
# gradio_interface = create_unified_dashboard() # 無効化:新しい統合ダッシュボードに移行
|
| 308 |
+
print("🚫 gradio_interface disabled - moved to contbk_unified_dashboard.py")
|
| 309 |
|
| 310 |
# 自動検出システム用のメタデータ
|
| 311 |
+
interface_title = "🎯 ContBK ダッシュボード (旧版)"
|
| 312 |
interface_description = "ContBKフォルダーの全インターフェースを統合表示"
|
| 313 |
|
| 314 |
# テスト実行用
|
controllers/contbk_unified_dashboard.py
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
ContBK 統合ダッシュボード
|
| 3 |
+
======================
|
| 4 |
+
|
| 5 |
+
ContBKフォルダーの全機能を統合した見やすいダッシュボード
|
| 6 |
+
サブフォルダーの機能を「Example」タブ内で整理して表示
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import gradio as gr
|
| 10 |
+
import importlib
|
| 11 |
+
import os
|
| 12 |
+
import sys
|
| 13 |
+
import traceback
|
| 14 |
+
from typing import List, Tuple, Any, Dict
|
| 15 |
+
|
| 16 |
+
def load_contbk_interfaces() -> Dict[str, List[Tuple[Any, str]]]:
|
| 17 |
+
"""
|
| 18 |
+
ContBKフォルダーから機能をカテゴリ別に読み込み
|
| 19 |
+
"""
|
| 20 |
+
print("📂 ContBK統合ダッシュボード: 機能を読み込み中...")
|
| 21 |
+
|
| 22 |
+
# パスの設定
|
| 23 |
+
contbk_path = "/workspaces/fastapi_django_main_live/contbk"
|
| 24 |
+
main_path = "/workspaces/fastapi_django_main_live"
|
| 25 |
+
|
| 26 |
+
if contbk_path not in sys.path:
|
| 27 |
+
sys.path.insert(0, contbk_path)
|
| 28 |
+
if main_path not in sys.path:
|
| 29 |
+
sys.path.insert(0, main_path)
|
| 30 |
+
|
| 31 |
+
# カテゴリ別の機能整理
|
| 32 |
+
categories = {
|
| 33 |
+
"🤖 AI・自動化": [
|
| 34 |
+
("gra_01_chat.Chat", "💬 AI チャット"),
|
| 35 |
+
("gra_02_openInterpreter.OpenInterpreter", "🤖 AI インタープリター"),
|
| 36 |
+
("gra_12_rpa.rpa_automation", "🤖 RPA自動化システム"),
|
| 37 |
+
],
|
| 38 |
+
"📄 ドキュメント・開発": [
|
| 39 |
+
("gra_03_programfromdoc.programfromdoc", "📄 ドキュメント生成"),
|
| 40 |
+
("gra_03_programfromdocgas.programfromdocAI", "📄 プログラム生成AI"),
|
| 41 |
+
("gra_03_programfromdocs.lavelo", "💾 プロンプト管理"),
|
| 42 |
+
],
|
| 43 |
+
"🎨 フロントエンド・UI": [
|
| 44 |
+
("gra_10_frontend.frontend_generator", "🎨 フロントエンド生成"),
|
| 45 |
+
("gra_11_multimodal.image_to_ui", "🖼️ 画像からUI生成"),
|
| 46 |
+
],
|
| 47 |
+
"📊 データ・ファイル": [
|
| 48 |
+
("gra_04_database.rides", "🚗 データベース管理"),
|
| 49 |
+
("gra_05_files.files", "📁 ファイル管理"),
|
| 50 |
+
],
|
| 51 |
+
"🌐 その他ツール": [
|
| 52 |
+
("gra_09_weather.weather", "🌤️ 天気予報"),
|
| 53 |
+
("gra_06_video.video", "🎥 動画処理"),
|
| 54 |
+
],
|
| 55 |
+
"🐙 開発・Issue管理": [
|
| 56 |
+
("controllers.github_issue_creator", "🐙 GitHub Issue作成"),
|
| 57 |
+
],
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
loaded_categories = {}
|
| 61 |
+
|
| 62 |
+
for category_name, modules in categories.items():
|
| 63 |
+
loaded_interfaces = []
|
| 64 |
+
|
| 65 |
+
for module_name, display_name in modules:
|
| 66 |
+
try:
|
| 67 |
+
print(f"🔍 Loading {module_name}...")
|
| 68 |
+
module = importlib.import_module(module_name)
|
| 69 |
+
|
| 70 |
+
if hasattr(module, 'gradio_interface'):
|
| 71 |
+
loaded_interfaces.append((module.gradio_interface, display_name))
|
| 72 |
+
print(f"✅ Successfully loaded: {display_name}")
|
| 73 |
+
else:
|
| 74 |
+
print(f"⚠️ No gradio_interface found in {module_name}")
|
| 75 |
+
|
| 76 |
+
except Exception as e:
|
| 77 |
+
print(f"❌ Failed to load {module_name}: {str(e)}")
|
| 78 |
+
continue
|
| 79 |
+
|
| 80 |
+
if loaded_interfaces:
|
| 81 |
+
loaded_categories[category_name] = loaded_interfaces
|
| 82 |
+
|
| 83 |
+
return loaded_categories
|
| 84 |
+
|
| 85 |
+
def create_category_tab(interfaces: List[Tuple[Any, str]], category_name: str) -> gr.Blocks:
|
| 86 |
+
"""
|
| 87 |
+
カテゴリごとのタブを作成
|
| 88 |
+
"""
|
| 89 |
+
with gr.Blocks(title=f"ContBK - {category_name}") as category_tab:
|
| 90 |
+
gr.Markdown(f"# {category_name}")
|
| 91 |
+
gr.Markdown(f"このカテゴリには {len(interfaces)} 個の機能があります。")
|
| 92 |
+
|
| 93 |
+
if interfaces:
|
| 94 |
+
# サブタブとして各機能を表示
|
| 95 |
+
interface_list = [interface for interface, _ in interfaces]
|
| 96 |
+
interface_names = [name for _, name in interfaces]
|
| 97 |
+
|
| 98 |
+
if len(interfaces) == 1:
|
| 99 |
+
# 1つの機能のみの場合、直接表示
|
| 100 |
+
interface_list[0].render()
|
| 101 |
+
else:
|
| 102 |
+
# 複数の機能がある場合、サブタブで表示
|
| 103 |
+
sub_tabs = gr.TabbedInterface(
|
| 104 |
+
interface_list,
|
| 105 |
+
interface_names,
|
| 106 |
+
title=f"{category_name} 機能一覧"
|
| 107 |
+
)
|
| 108 |
+
else:
|
| 109 |
+
gr.Markdown("⚠️ このカテゴリには利用可能な機能がありません。")
|
| 110 |
+
|
| 111 |
+
return category_tab
|
| 112 |
+
|
| 113 |
+
def create_overview_tab() -> gr.Blocks:
|
| 114 |
+
"""
|
| 115 |
+
概要・ヘルプタブを作成
|
| 116 |
+
"""
|
| 117 |
+
with gr.Blocks() as overview_tab:
|
| 118 |
+
gr.Markdown("""
|
| 119 |
+
# 🎯 ContBK 統合ダッシュボード
|
| 120 |
+
|
| 121 |
+
## 📋 概要
|
| 122 |
+
このダッシュボードは、ContBKフォルダーにある全ての機能を整理して表示します。
|
| 123 |
+
|
| 124 |
+
## 🗂️ カテゴリ構成
|
| 125 |
+
|
| 126 |
+
### 🤖 AI・自動化
|
| 127 |
+
- **AI チャット**: 対話型AIインターフェース
|
| 128 |
+
- **AI インタープリター**: コード実行・解析
|
| 129 |
+
- **RPA自動化システム**: Webブラウザ自動化
|
| 130 |
+
|
| 131 |
+
### 📄 ドキュメント・開発
|
| 132 |
+
- **ドキュメント生成**: 仕様書からコード生成
|
| 133 |
+
- **プログラム生成AI**: AI支援開発
|
| 134 |
+
- **プロンプト管理**: プロンプトライブラリ
|
| 135 |
+
|
| 136 |
+
### 🎨 フロントエンド・UI
|
| 137 |
+
- **フロントエンド生成**: UI自動生成
|
| 138 |
+
- **画像からUI生成**: 画像ベースUI作成
|
| 139 |
+
|
| 140 |
+
### 📊 データ・ファイル
|
| 141 |
+
- **データベース管理**: CRUD操作
|
| 142 |
+
- **ファイル管理**: ファイル操作・編集
|
| 143 |
+
|
| 144 |
+
### 🌐 その他ツール
|
| 145 |
+
- **天気予報**: 気象情報取得
|
| 146 |
+
- **動画処理**: 動画編集・変換
|
| 147 |
+
|
| 148 |
+
### 🐙 開発・Issue管理
|
| 149 |
+
- **GitHub Issue作成**: 会話履歴からIssue自動生成
|
| 150 |
+
|
| 151 |
+
## 🚀 使用方法
|
| 152 |
+
1. 上部のタブから興味のあるカテゴリを選択
|
| 153 |
+
2. カテゴリ内の機能を探索
|
| 154 |
+
3. 各機能の詳細な操作は個別のインターフェースで実行
|
| 155 |
+
|
| 156 |
+
## 💡 ヒント
|
| 157 |
+
- 各カテゴリは関連する機能でグループ化されています
|
| 158 |
+
- 機能に問題がある場合は、ログを確認してください
|
| 159 |
+
- 新しい機能は随時追加されます
|
| 160 |
+
""")
|
| 161 |
+
|
| 162 |
+
# システム情報表示
|
| 163 |
+
with gr.Row():
|
| 164 |
+
with gr.Column():
|
| 165 |
+
def get_system_info():
|
| 166 |
+
import datetime
|
| 167 |
+
contbk_path = "/workspaces/fastapi_django_main_live/contbk"
|
| 168 |
+
folder_count = len([d for d in os.listdir(contbk_path)
|
| 169 |
+
if os.path.isdir(os.path.join(contbk_path, d))
|
| 170 |
+
and d.startswith('gra_')])
|
| 171 |
+
|
| 172 |
+
return f"""
|
| 173 |
+
**現在時刻**: {datetime.datetime.now().strftime('%Y年%m月%d日 %H:%M:%S')}
|
| 174 |
+
**ContBK パス**: {contbk_path}
|
| 175 |
+
**利用可能フォルダー数**: {folder_count}個
|
| 176 |
+
**Gradio バージョン**: {gr.__version__}
|
| 177 |
+
"""
|
| 178 |
+
|
| 179 |
+
system_info = gr.Textbox(
|
| 180 |
+
label="💻 システム情報",
|
| 181 |
+
value=get_system_info(),
|
| 182 |
+
lines=6,
|
| 183 |
+
interactive=False
|
| 184 |
+
)
|
| 185 |
+
|
| 186 |
+
refresh_btn = gr.Button("🔄 情報更新", variant="secondary")
|
| 187 |
+
refresh_btn.click(fn=get_system_info, outputs=system_info)
|
| 188 |
+
|
| 189 |
+
return overview_tab
|
| 190 |
+
|
| 191 |
+
def create_unified_dashboard() -> gr.TabbedInterface:
|
| 192 |
+
"""
|
| 193 |
+
統合ダッシュボードを作成
|
| 194 |
+
"""
|
| 195 |
+
print("🚀 ContBK統合ダッシュボードを作成中...")
|
| 196 |
+
|
| 197 |
+
try:
|
| 198 |
+
# ContBK機能をカテゴリ別に読み込み
|
| 199 |
+
categories = load_contbk_interfaces()
|
| 200 |
+
|
| 201 |
+
# タブリストを作成
|
| 202 |
+
all_tabs = []
|
| 203 |
+
all_names = []
|
| 204 |
+
|
| 205 |
+
# 概要タブを最初に追加
|
| 206 |
+
overview_tab = create_overview_tab()
|
| 207 |
+
all_tabs.append(overview_tab)
|
| 208 |
+
all_names.append("🏠 概要")
|
| 209 |
+
|
| 210 |
+
# カテゴリ別タブを追加
|
| 211 |
+
for category_name, interfaces in categories.items():
|
| 212 |
+
category_tab = create_category_tab(interfaces, category_name)
|
| 213 |
+
all_tabs.append(category_tab)
|
| 214 |
+
all_names.append(category_name)
|
| 215 |
+
|
| 216 |
+
# 統合タブ付きインターフェースを作成
|
| 217 |
+
if len(all_tabs) > 1:
|
| 218 |
+
dashboard = gr.TabbedInterface(
|
| 219 |
+
all_tabs,
|
| 220 |
+
all_names,
|
| 221 |
+
title="🎯 ContBK 統合ダッシュボード"
|
| 222 |
+
)
|
| 223 |
+
else:
|
| 224 |
+
# フォールバック:概要タブのみ
|
| 225 |
+
dashboard = overview_tab
|
| 226 |
+
|
| 227 |
+
print(f"✅ ダッシュボード作成完了: {len(all_tabs)} タブ")
|
| 228 |
+
return dashboard
|
| 229 |
+
|
| 230 |
+
except Exception as e:
|
| 231 |
+
print(f"❌ ダッシュボード作成エラー: {str(e)}")
|
| 232 |
+
traceback.print_exc()
|
| 233 |
+
|
| 234 |
+
# エラー時のフォールバック
|
| 235 |
+
with gr.Blocks() as error_tab:
|
| 236 |
+
gr.Markdown(f"""
|
| 237 |
+
# ❌ エラーが発生しました
|
| 238 |
+
|
| 239 |
+
ContBK統合ダッシュボードの作成中にエラーが発生しました。
|
| 240 |
+
|
| 241 |
+
**エラー詳細**: {str(e)}
|
| 242 |
+
|
| 243 |
+
## 🔧 対処方法
|
| 244 |
+
1. アプリケーションを再起動してください
|
| 245 |
+
2. ログを確認してください
|
| 246 |
+
3. 個別の機能が正常に動作するかテストしてください
|
| 247 |
+
""")
|
| 248 |
+
|
| 249 |
+
return gr.TabbedInterface([error_tab], ["❌ エラー"])
|
| 250 |
+
|
| 251 |
+
# メインのgradio_interfaceを作成
|
| 252 |
+
print("🚀 Creating unified ContBK dashboard...")
|
| 253 |
+
gradio_interface = create_unified_dashboard()
|
| 254 |
+
|
| 255 |
+
# 自動検出システム用のメタデータ
|
| 256 |
+
interface_title = "���� ContBK統合ダッシュボード"
|
| 257 |
+
interface_description = "ContBKフォルダーの全機能を整理したダッシュボード"
|
| 258 |
+
|
| 259 |
+
# テスト実行用
|
| 260 |
+
if __name__ == "__main__":
|
| 261 |
+
print("🚀 ContBK統合ダッシュボードを起動中...")
|
| 262 |
+
gradio_interface.launch(
|
| 263 |
+
server_name="0.0.0.0",
|
| 264 |
+
server_port=7865, # 専用ポート
|
| 265 |
+
share=False,
|
| 266 |
+
debug=True
|
| 267 |
+
)
|
controllers/conversation_logger.py
CHANGED
|
@@ -16,6 +16,7 @@ import json
|
|
| 16 |
import os
|
| 17 |
import traceback
|
| 18 |
import sqlite3
|
|
|
|
| 19 |
from typing import Optional, Dict, List
|
| 20 |
from controllers.conversation_history import ConversationManager
|
| 21 |
|
|
@@ -191,6 +192,269 @@ class ConversationLogger:
|
|
| 191 |
except Exception as e:
|
| 192 |
print(f"❌ セッションエクスポートエラー: {e}")
|
| 193 |
return ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
|
| 195 |
# グローバルログインスタンス
|
| 196 |
conversation_logger = ConversationLogger()
|
|
@@ -223,6 +487,57 @@ def start_new_conversation_session(session_name: str = None):
|
|
| 223 |
"""新しい会話セッションを開始"""
|
| 224 |
return conversation_logger.start_new_session(session_name)
|
| 225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
def get_current_session_info():
|
| 227 |
"""現在のセッション情報を取得"""
|
| 228 |
return conversation_logger.get_session_summary()
|
|
@@ -276,16 +591,19 @@ if __name__ == "__main__":
|
|
| 276 |
|
| 277 |
# サンプル会話を記録
|
| 278 |
log_this_conversation(
|
| 279 |
-
user_msg="
|
| 280 |
-
assistant_msg="
|
| 281 |
-
context="
|
| 282 |
files=["controllers/conversation_logger.py"],
|
| 283 |
-
tools=["
|
| 284 |
-
tags=["
|
| 285 |
)
|
| 286 |
|
| 287 |
# セッション情報表示
|
| 288 |
session_info = get_current_session_info()
|
| 289 |
print(f"📊 セッション情報: {session_info}")
|
| 290 |
|
|
|
|
|
|
|
|
|
|
| 291 |
print("✅ テスト完了")
|
|
|
|
| 16 |
import os
|
| 17 |
import traceback
|
| 18 |
import sqlite3
|
| 19 |
+
import subprocess
|
| 20 |
from typing import Optional, Dict, List
|
| 21 |
from controllers.conversation_history import ConversationManager
|
| 22 |
|
|
|
|
| 192 |
except Exception as e:
|
| 193 |
print(f"❌ セッションエクスポートエラー: {e}")
|
| 194 |
return ""
|
| 195 |
+
|
| 196 |
+
def create_github_issue(self,
|
| 197 |
+
title: str = None,
|
| 198 |
+
session_id: str = None,
|
| 199 |
+
labels: List[str] = None,
|
| 200 |
+
assignee: str = None) -> bool:
|
| 201 |
+
"""
|
| 202 |
+
GitHub Issueを作成
|
| 203 |
+
|
| 204 |
+
Args:
|
| 205 |
+
title: Issue のタイトル(未指定の場合は自動生成)
|
| 206 |
+
session_id: 対象セッションID(未指定の場合は現在のセッション)
|
| 207 |
+
labels: 付与するラベル
|
| 208 |
+
assignee: アサイニー
|
| 209 |
+
|
| 210 |
+
Returns:
|
| 211 |
+
作成成功の可否
|
| 212 |
+
"""
|
| 213 |
+
try:
|
| 214 |
+
target_session = session_id or self.current_session_id
|
| 215 |
+
|
| 216 |
+
# 会話履歴を取得
|
| 217 |
+
conversations = self.conversation_manager.get_conversations(
|
| 218 |
+
session_id=target_session
|
| 219 |
+
)
|
| 220 |
+
|
| 221 |
+
if not conversations:
|
| 222 |
+
print("⚠️ 会話履歴が見つかりません")
|
| 223 |
+
return False
|
| 224 |
+
|
| 225 |
+
# タイトルを自動生成(未指定の場合)
|
| 226 |
+
if not title:
|
| 227 |
+
first_conversation = conversations[-1] # 最初の会話
|
| 228 |
+
title = f"開発セッション: {first_conversation.get('user_message', '')[:50]}..."
|
| 229 |
+
|
| 230 |
+
# Issue本文を生成
|
| 231 |
+
issue_body = self._generate_issue_body(conversations, target_session)
|
| 232 |
+
|
| 233 |
+
# GitHub CLI を使用してIssue作成
|
| 234 |
+
cmd = [
|
| 235 |
+
'gh', 'issue', 'create',
|
| 236 |
+
'--title', title,
|
| 237 |
+
'--body', issue_body
|
| 238 |
+
]
|
| 239 |
+
|
| 240 |
+
# ラベルを追加
|
| 241 |
+
if labels:
|
| 242 |
+
for label in labels:
|
| 243 |
+
cmd.extend(['--label', label])
|
| 244 |
+
|
| 245 |
+
# アサイニーを追加
|
| 246 |
+
if assignee:
|
| 247 |
+
cmd.extend(['--assignee', assignee])
|
| 248 |
+
|
| 249 |
+
# コマンド実行
|
| 250 |
+
result = subprocess.run(cmd, capture_output=True, text=True, cwd='/workspaces/fastapi_django_main_live')
|
| 251 |
+
|
| 252 |
+
if result.returncode == 0:
|
| 253 |
+
issue_url = result.stdout.strip()
|
| 254 |
+
print(f"✅ GitHub Issue作成成功: {issue_url}")
|
| 255 |
+
|
| 256 |
+
# セッションにIssue URLを記録
|
| 257 |
+
self._update_session_issue_url(target_session, issue_url)
|
| 258 |
+
|
| 259 |
+
return True
|
| 260 |
+
else:
|
| 261 |
+
print(f"❌ GitHub Issue作成失敗: {result.stderr}")
|
| 262 |
+
return False
|
| 263 |
+
|
| 264 |
+
except Exception as e:
|
| 265 |
+
print(f"❌ GitHub Issue作成エラー: {e}")
|
| 266 |
+
print(traceback.format_exc())
|
| 267 |
+
return False
|
| 268 |
+
|
| 269 |
+
def _generate_issue_body(self, conversations: List[Dict], session_id: str) -> str:
|
| 270 |
+
"""Issue本文を生成"""
|
| 271 |
+
|
| 272 |
+
# セッション情報
|
| 273 |
+
session_info = self.get_session_summary()
|
| 274 |
+
|
| 275 |
+
body_parts = [
|
| 276 |
+
"# 開発セッション記録",
|
| 277 |
+
"",
|
| 278 |
+
"## 📊 セッション情報",
|
| 279 |
+
f"- **セッションID**: `{session_id[:8]}`",
|
| 280 |
+
f"- **開始時刻**: {self.session_start_time.strftime('%Y-%m-%d %H:%M:%S')}",
|
| 281 |
+
f"- **会話数**: {len(conversations)}",
|
| 282 |
+
f"- **継続時間**: {session_info.get('duration_minutes', 0):.1f}分",
|
| 283 |
+
"",
|
| 284 |
+
"## 🗣️ 会話履歴",
|
| 285 |
+
""
|
| 286 |
+
]
|
| 287 |
+
|
| 288 |
+
# 会話履歴を追加(最新10件まで)
|
| 289 |
+
recent_conversations = conversations[:10] if len(conversations) > 10 else conversations
|
| 290 |
+
|
| 291 |
+
for i, conv in enumerate(reversed(recent_conversations), 1):
|
| 292 |
+
body_parts.extend([
|
| 293 |
+
f"### {i}. {conv.get('timestamp', '')}",
|
| 294 |
+
"",
|
| 295 |
+
"**👤 User:**",
|
| 296 |
+
"```",
|
| 297 |
+
conv.get('user_message', ''),
|
| 298 |
+
"```",
|
| 299 |
+
"",
|
| 300 |
+
"**🤖 Assistant:**",
|
| 301 |
+
"```",
|
| 302 |
+
conv.get('assistant_response', '')[:1000] + ('...' if len(conv.get('assistant_response', '')) > 1000 else ''),
|
| 303 |
+
"```",
|
| 304 |
+
""
|
| 305 |
+
])
|
| 306 |
+
|
| 307 |
+
# コンテキスト情報があれば追加
|
| 308 |
+
if conv.get('context_info'):
|
| 309 |
+
body_parts.extend([
|
| 310 |
+
"**📝 Context:**",
|
| 311 |
+
"```",
|
| 312 |
+
conv.get('context_info', ''),
|
| 313 |
+
"```",
|
| 314 |
+
""
|
| 315 |
+
])
|
| 316 |
+
|
| 317 |
+
# 関連ファイルがあれば追加
|
| 318 |
+
if conv.get('files_involved'):
|
| 319 |
+
body_parts.extend([
|
| 320 |
+
"**📁 Files:**",
|
| 321 |
+
f"`{conv.get('files_involved', '')}`",
|
| 322 |
+
""
|
| 323 |
+
])
|
| 324 |
+
|
| 325 |
+
# 使用ツールがあれば追加
|
| 326 |
+
if conv.get('tools_used'):
|
| 327 |
+
body_parts.extend([
|
| 328 |
+
"**🔧 Tools:**",
|
| 329 |
+
f"`{conv.get('tools_used', '')}`",
|
| 330 |
+
""
|
| 331 |
+
])
|
| 332 |
+
|
| 333 |
+
body_parts.append("---")
|
| 334 |
+
body_parts.append("")
|
| 335 |
+
|
| 336 |
+
# 要約とタグ
|
| 337 |
+
all_files = set()
|
| 338 |
+
all_tools = set()
|
| 339 |
+
all_tags = set()
|
| 340 |
+
|
| 341 |
+
for conv in conversations:
|
| 342 |
+
if conv.get('files_involved'):
|
| 343 |
+
all_files.update(conv.get('files_involved', '').split(', '))
|
| 344 |
+
if conv.get('tools_used'):
|
| 345 |
+
all_tools.update(conv.get('tools_used', '').split(', '))
|
| 346 |
+
if conv.get('tags'):
|
| 347 |
+
all_tags.update(conv.get('tags', '').split(', '))
|
| 348 |
+
|
| 349 |
+
body_parts.extend([
|
| 350 |
+
"## 📋 セッション要約",
|
| 351 |
+
"",
|
| 352 |
+
"### 関連ファイル",
|
| 353 |
+
"",
|
| 354 |
+
])
|
| 355 |
+
|
| 356 |
+
for file in sorted(all_files):
|
| 357 |
+
if file.strip():
|
| 358 |
+
body_parts.append(f"- `{file.strip()}`")
|
| 359 |
+
|
| 360 |
+
body_parts.extend([
|
| 361 |
+
"",
|
| 362 |
+
"### 使用ツール",
|
| 363 |
+
"",
|
| 364 |
+
])
|
| 365 |
+
|
| 366 |
+
for tool in sorted(all_tools):
|
| 367 |
+
if tool.strip():
|
| 368 |
+
body_parts.append(f"- `{tool.strip()}`")
|
| 369 |
+
|
| 370 |
+
if all_tags:
|
| 371 |
+
body_parts.extend([
|
| 372 |
+
"",
|
| 373 |
+
"### タグ",
|
| 374 |
+
"",
|
| 375 |
+
])
|
| 376 |
+
|
| 377 |
+
for tag in sorted(all_tags):
|
| 378 |
+
if tag.strip():
|
| 379 |
+
body_parts.append(f"- `{tag.strip()}`")
|
| 380 |
+
|
| 381 |
+
body_parts.extend([
|
| 382 |
+
"",
|
| 383 |
+
"---",
|
| 384 |
+
f"*自動生成: {datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}*"
|
| 385 |
+
])
|
| 386 |
+
|
| 387 |
+
return "\n".join(body_parts)
|
| 388 |
+
|
| 389 |
+
def _update_session_issue_url(self, session_id: str, issue_url: str):
|
| 390 |
+
"""セッションにIssue URLを記録"""
|
| 391 |
+
try:
|
| 392 |
+
conn = sqlite3.connect(self.conversation_manager.db_path)
|
| 393 |
+
cursor = conn.cursor()
|
| 394 |
+
|
| 395 |
+
# sessions テーブルにissue_url カラムを追加(存在しない場合)
|
| 396 |
+
cursor.execute('''
|
| 397 |
+
ALTER TABLE sessions ADD COLUMN issue_url TEXT
|
| 398 |
+
''')
|
| 399 |
+
|
| 400 |
+
except sqlite3.OperationalError:
|
| 401 |
+
# カラムが既に存在する場合
|
| 402 |
+
pass
|
| 403 |
+
|
| 404 |
+
try:
|
| 405 |
+
cursor.execute('''
|
| 406 |
+
INSERT OR REPLACE INTO sessions (session_id, issue_url)
|
| 407 |
+
VALUES (?, ?)
|
| 408 |
+
''', (session_id, issue_url))
|
| 409 |
+
|
| 410 |
+
conn.commit()
|
| 411 |
+
conn.close()
|
| 412 |
+
|
| 413 |
+
except Exception as e:
|
| 414 |
+
print(f"⚠️ Issue URL記録エラー: {e}")
|
| 415 |
+
|
| 416 |
+
def create_issue_for_current_session(self,
|
| 417 |
+
title: str = None,
|
| 418 |
+
labels: List[str] = None) -> bool:
|
| 419 |
+
"""現在のセッションのGitHub Issueを作成"""
|
| 420 |
+
default_labels = [] # デフォルトラベルを空に
|
| 421 |
+
if labels:
|
| 422 |
+
default_labels.extend(labels)
|
| 423 |
+
|
| 424 |
+
return self.create_github_issue(
|
| 425 |
+
title=title,
|
| 426 |
+
session_id=self.current_session_id,
|
| 427 |
+
labels=default_labels
|
| 428 |
+
)
|
| 429 |
+
|
| 430 |
+
def create_quick_issue(title: str,
|
| 431 |
+
user_msg: str,
|
| 432 |
+
assistant_msg: str,
|
| 433 |
+
labels: List[str] = None):
|
| 434 |
+
"""
|
| 435 |
+
会話内容から直接GitHub Issueを作成
|
| 436 |
+
|
| 437 |
+
使用例:
|
| 438 |
+
create_quick_issue(
|
| 439 |
+
title="ContBK統合システム開発",
|
| 440 |
+
user_msg="このやりとりをGit Issueへ登録したい",
|
| 441 |
+
assistant_msg="GitHub Issue作成機能を実装しました",
|
| 442 |
+
labels=["development", "enhancement"]
|
| 443 |
+
)
|
| 444 |
+
"""
|
| 445 |
+
# 一時的に会話を記録
|
| 446 |
+
conversation_logger.log_conversation(
|
| 447 |
+
user_message=user_msg,
|
| 448 |
+
assistant_response=assistant_msg,
|
| 449 |
+
context_info="GitHub Issue直接作成",
|
| 450 |
+
tags=["quick-issue"] + (labels or [])
|
| 451 |
+
)
|
| 452 |
+
|
| 453 |
+
# すぐにIssue作成
|
| 454 |
+
return conversation_logger.create_issue_for_current_session(
|
| 455 |
+
title=title,
|
| 456 |
+
labels=labels or ["development", "conversation-log"]
|
| 457 |
+
)
|
| 458 |
|
| 459 |
# グローバルログインスタンス
|
| 460 |
conversation_logger = ConversationLogger()
|
|
|
|
| 487 |
"""新しい会話セッションを開始"""
|
| 488 |
return conversation_logger.start_new_session(session_name)
|
| 489 |
|
| 490 |
+
def create_quick_issue(title: str,
|
| 491 |
+
user_msg: str,
|
| 492 |
+
assistant_msg: str,
|
| 493 |
+
labels: List[str] = None):
|
| 494 |
+
"""
|
| 495 |
+
会話内容から直接GitHub Issueを作成
|
| 496 |
+
|
| 497 |
+
使用例:
|
| 498 |
+
create_quick_issue(
|
| 499 |
+
title="ContBK統合システム開発",
|
| 500 |
+
user_msg="このやりとりをGit Issueへ登録したい",
|
| 501 |
+
assistant_msg="GitHub Issue作成機能を実装しました",
|
| 502 |
+
labels=["development", "enhancement"]
|
| 503 |
+
)
|
| 504 |
+
"""
|
| 505 |
+
# 一時的に会話を記録
|
| 506 |
+
conversation_logger.log_conversation(
|
| 507 |
+
user_message=user_msg,
|
| 508 |
+
assistant_response=assistant_msg,
|
| 509 |
+
context_info="GitHub Issue直接作成",
|
| 510 |
+
tags=["quick-issue"] + (labels or [])
|
| 511 |
+
)
|
| 512 |
+
|
| 513 |
+
# すぐにIssue作成
|
| 514 |
+
return conversation_logger.create_issue_for_current_session(
|
| 515 |
+
title=title,
|
| 516 |
+
labels=labels or [] # デフォルトラベルを空に
|
| 517 |
+
)
|
| 518 |
+
|
| 519 |
+
def create_github_issue_for_session(title: str = None,
|
| 520 |
+
labels: List[str] = None,
|
| 521 |
+
session_id: str = None):
|
| 522 |
+
"""
|
| 523 |
+
現在のセッションまたは指定セッションのGitHub Issueを作成
|
| 524 |
+
|
| 525 |
+
使用例:
|
| 526 |
+
create_github_issue_for_session(
|
| 527 |
+
title="ContBK統合システム開発セッション",
|
| 528 |
+
labels=["enhancement", "contbk"]
|
| 529 |
+
)
|
| 530 |
+
"""
|
| 531 |
+
return conversation_logger.create_github_issue(
|
| 532 |
+
title=title,
|
| 533 |
+
session_id=session_id,
|
| 534 |
+
labels=labels or ["development", "conversation-log"]
|
| 535 |
+
)
|
| 536 |
+
|
| 537 |
+
def create_issue_now(title: str = "開発セッション記録"):
|
| 538 |
+
"""ワンクリックでGitHub Issue作成"""
|
| 539 |
+
return conversation_logger.create_issue_for_current_session(title=title)
|
| 540 |
+
|
| 541 |
def get_current_session_info():
|
| 542 |
"""現在のセッション情報を取得"""
|
| 543 |
return conversation_logger.get_session_summary()
|
|
|
|
| 591 |
|
| 592 |
# サンプル会話を記録
|
| 593 |
log_this_conversation(
|
| 594 |
+
user_msg="GitHub Issue作成機能のテストです",
|
| 595 |
+
assistant_msg="GitHub Issue作成機能が正常に動作しています!",
|
| 596 |
+
context="GitHub Issue機能追加",
|
| 597 |
files=["controllers/conversation_logger.py"],
|
| 598 |
+
tools=["create_github_issue", "gh"],
|
| 599 |
+
tags=["github", "issue", "automation"]
|
| 600 |
)
|
| 601 |
|
| 602 |
# セッション情報表示
|
| 603 |
session_info = get_current_session_info()
|
| 604 |
print(f"📊 セッション情報: {session_info}")
|
| 605 |
|
| 606 |
+
# GitHub Issue作成テスト(コメントアウト)
|
| 607 |
+
# create_issue_now("テスト用GitHub Issue")
|
| 608 |
+
|
| 609 |
print("✅ テスト完了")
|
controllers/github_issue_creator.py
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
GitHub Issue作成インターフェース
|
| 3 |
+
==============================
|
| 4 |
+
|
| 5 |
+
会話履歴から自動的にGitHub Issueを作成するGradioインターフェース
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import gradio as gr
|
| 9 |
+
import datetime
|
| 10 |
+
import sys
|
| 11 |
+
import os
|
| 12 |
+
|
| 13 |
+
# パスを追加
|
| 14 |
+
sys.path.append('/workspaces/fastapi_django_main_live')
|
| 15 |
+
|
| 16 |
+
from controllers.conversation_logger import create_quick_issue, get_current_session_info, conversation_logger
|
| 17 |
+
|
| 18 |
+
def create_github_issue_interface():
|
| 19 |
+
"""GitHub Issue作成インターフェース"""
|
| 20 |
+
|
| 21 |
+
def create_issue_from_input(title, user_message, assistant_response, labels_text):
|
| 22 |
+
"""入力からGitHub Issueを作成"""
|
| 23 |
+
try:
|
| 24 |
+
# ラベルを処理
|
| 25 |
+
labels = [label.strip() for label in labels_text.split(',') if label.strip()] if labels_text else []
|
| 26 |
+
|
| 27 |
+
# Issue作成
|
| 28 |
+
result = create_quick_issue(
|
| 29 |
+
title=title,
|
| 30 |
+
user_msg=user_message,
|
| 31 |
+
assistant_msg=assistant_response,
|
| 32 |
+
labels=labels
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
if result:
|
| 36 |
+
return "✅ GitHub Issue作成成功!"
|
| 37 |
+
else:
|
| 38 |
+
return "❌ GitHub Issue作成失敗"
|
| 39 |
+
|
| 40 |
+
except Exception as e:
|
| 41 |
+
return f"❌ エラー: {str(e)}"
|
| 42 |
+
|
| 43 |
+
def get_session_info():
|
| 44 |
+
"""現在のセッション情報を取得"""
|
| 45 |
+
try:
|
| 46 |
+
info = get_current_session_info()
|
| 47 |
+
return f"""
|
| 48 |
+
📊 **現在のセッション情報**
|
| 49 |
+
- セッションID: `{info.get('session_id', 'N/A')[:8]}`
|
| 50 |
+
- 会話数: {info.get('conversation_count', 0)}
|
| 51 |
+
- 継続時間: {info.get('duration_minutes', 0):.1f}分
|
| 52 |
+
"""
|
| 53 |
+
except Exception as e:
|
| 54 |
+
return f"⚠️ セッション情報取得エラー: {str(e)}"
|
| 55 |
+
|
| 56 |
+
def get_suggested_labels():
|
| 57 |
+
"""おすすめラベルを取得"""
|
| 58 |
+
return "enhancement, python, bug, documentation, question"
|
| 59 |
+
|
| 60 |
+
with gr.Blocks(title="GitHub Issue Creator", theme=gr.themes.Soft()) as interface:
|
| 61 |
+
gr.Markdown("""
|
| 62 |
+
# 🐙 GitHub Issue Creator
|
| 63 |
+
|
| 64 |
+
会話内容から自動的にGitHub Issueを作成します。
|
| 65 |
+
""")
|
| 66 |
+
|
| 67 |
+
with gr.Row():
|
| 68 |
+
with gr.Column(scale=2):
|
| 69 |
+
# Issue作成フォーム
|
| 70 |
+
with gr.Group():
|
| 71 |
+
gr.Markdown("## 📝 Issue作成")
|
| 72 |
+
|
| 73 |
+
title_input = gr.Textbox(
|
| 74 |
+
label="Issue タイトル",
|
| 75 |
+
placeholder="例: ContBK統合システム:新機能開発",
|
| 76 |
+
lines=1
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
user_msg_input = gr.Textbox(
|
| 80 |
+
label="ユーザーメッセージ",
|
| 81 |
+
placeholder="開発依頼や質問内容を入力...",
|
| 82 |
+
lines=4
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
assistant_msg_input = gr.Textbox(
|
| 86 |
+
label="アシスタント回答",
|
| 87 |
+
placeholder="実装内容や解決方法を入力...",
|
| 88 |
+
lines=6
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
labels_input = gr.Textbox(
|
| 92 |
+
label="ラベル (カンマ区切り)",
|
| 93 |
+
placeholder="enhancement, python",
|
| 94 |
+
lines=1
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
with gr.Row():
|
| 98 |
+
create_btn = gr.Button("🚀 Issue作成", variant="primary")
|
| 99 |
+
clear_btn = gr.Button("🗑️ クリア", variant="secondary")
|
| 100 |
+
|
| 101 |
+
with gr.Column(scale=1):
|
| 102 |
+
# 情報パネル
|
| 103 |
+
with gr.Group():
|
| 104 |
+
gr.Markdown("## ℹ️ 情報")
|
| 105 |
+
|
| 106 |
+
session_info_display = gr.Markdown(get_session_info())
|
| 107 |
+
|
| 108 |
+
refresh_info_btn = gr.Button("🔄 情報更新", size="sm")
|
| 109 |
+
|
| 110 |
+
gr.Markdown("### 🏷️ 利用可能ラベル")
|
| 111 |
+
gr.Markdown("""
|
| 112 |
+
- `enhancement` - 新機能
|
| 113 |
+
- `python` - Python関連
|
| 114 |
+
- `bug` - バグ修正
|
| 115 |
+
- `documentation` - ドキュメント
|
| 116 |
+
- `question` - 質問
|
| 117 |
+
""")
|
| 118 |
+
|
| 119 |
+
suggest_labels_btn = gr.Button("💡 ラベル提案", size="sm")
|
| 120 |
+
|
| 121 |
+
# 結果表示
|
| 122 |
+
with gr.Row():
|
| 123 |
+
result_display = gr.Markdown("")
|
| 124 |
+
|
| 125 |
+
# イベントハンドラー
|
| 126 |
+
create_btn.click(
|
| 127 |
+
fn=create_issue_from_input,
|
| 128 |
+
inputs=[title_input, user_msg_input, assistant_msg_input, labels_input],
|
| 129 |
+
outputs=[result_display]
|
| 130 |
+
)
|
| 131 |
+
|
| 132 |
+
clear_btn.click(
|
| 133 |
+
fn=lambda: ("", "", "", ""),
|
| 134 |
+
outputs=[title_input, user_msg_input, assistant_msg_input, labels_input]
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
refresh_info_btn.click(
|
| 138 |
+
fn=get_session_info,
|
| 139 |
+
outputs=[session_info_display]
|
| 140 |
+
)
|
| 141 |
+
|
| 142 |
+
suggest_labels_btn.click(
|
| 143 |
+
fn=get_suggested_labels,
|
| 144 |
+
outputs=[labels_input]
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
# サンプルデータ設定ボタン
|
| 148 |
+
with gr.Row():
|
| 149 |
+
sample_btn = gr.Button("📋 サンプルデータ設定", variant="secondary")
|
| 150 |
+
|
| 151 |
+
def set_sample_data():
|
| 152 |
+
return (
|
| 153 |
+
"🤖 ContBK統合システム:GitHub Issue自動作成機能",
|
| 154 |
+
"会話履歴をGitHub Issueに自動登録する機能が欲しい",
|
| 155 |
+
"GitHub CLI(gh)を使用してIssue作成機能を実装しました。会話履歴から自動的にMarkdown形式のIssueを生成できます。",
|
| 156 |
+
"enhancement, python"
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
sample_btn.click(
|
| 160 |
+
fn=set_sample_data,
|
| 161 |
+
outputs=[title_input, user_msg_input, assistant_msg_input, labels_input]
|
| 162 |
+
)
|
| 163 |
+
|
| 164 |
+
return interface
|
| 165 |
+
|
| 166 |
+
def create_gradio_interface():
|
| 167 |
+
"""Gradioインターフェースを作成"""
|
| 168 |
+
return create_github_issue_interface()
|
| 169 |
+
|
| 170 |
+
# 自動検出用のgradio_interface
|
| 171 |
+
gradio_interface = create_gradio_interface()
|
| 172 |
+
interface_title = "🐙 GitHub Issue Creator"
|
| 173 |
+
interface_description = "会話履歴からGitHub Issueを自動作成"
|
| 174 |
+
|
| 175 |
+
if __name__ == "__main__":
|
| 176 |
+
interface = create_gradio_interface()
|
| 177 |
+
interface.launch(
|
| 178 |
+
server_name="0.0.0.0",
|
| 179 |
+
server_port=7861,
|
| 180 |
+
share=False,
|
| 181 |
+
debug=True
|
| 182 |
+
)
|
docs/readme_addition.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
## 📸 システムスクリーンショット・ギャラリー
|
| 4 |
+
|
| 5 |
+
### 🎯 ContBK統合ダッシュボード
|
| 6 |
+

|
| 7 |
+
|
| 8 |
+
**機能概要**:
|
| 9 |
+
- 🏠 概要タブで全体像把握
|
| 10 |
+
- 🤖 AI・自動化カテゴリ
|
| 11 |
+
- 📄 ドキュメント・開発カテゴリ
|
| 12 |
+
- 🎨 フロントエンド・UIカテゴリ
|
| 13 |
+
- 📊 データ・ファイルカテゴリ
|
| 14 |
+
- 🌐 その他ツール
|
| 15 |
+
- 🐙 開発・Issue管理カテゴリ
|
| 16 |
+
|
| 17 |
+
### 🐙 GitHub Issue自動作成機能
|
| 18 |
+

|
| 19 |
+
|
| 20 |
+
**革新的機能**:
|
| 21 |
+
- 💬 会話履歴からIssue自動生成
|
| 22 |
+
- 🏷️ ラベル自動付与
|
| 23 |
+
- 📝 Markdown形式の美しいIssue
|
| 24 |
+
- 🔄 セッション情報の自動記録
|
| 25 |
+
|
| 26 |
+
### 🤖 RPA自動化システム
|
| 27 |
+

|
| 28 |
+
|
| 29 |
+
**高度な自動化**:
|
| 30 |
+
- 🌐 Webブラウザ自動操作
|
| 31 |
+
- 📸 スクリーンショット取得
|
| 32 |
+
- 🎯 要素の自動認識
|
| 33 |
+
- 💾 操作履歴の完全記録
|
| 34 |
+
|
| 35 |
+
## 🚀 ライブデモ
|
| 36 |
+
|
| 37 |
+
### 🌐 本番環境
|
| 38 |
+
**メインサイト**: [https://ideal-halibut-4q5qp79g2jp9-7860.app.github.dev/](https://ideal-halibut-4q5qp79g2jp9-7860.app.github.dev/)
|
| 39 |
+
|
| 40 |
+
実際に稼働中のシステムをご体験いただけます!
|
| 41 |
+
|
| 42 |
+
### 📋 現在のオープンイシュー
|
| 43 |
+
[{"labels":[],"number":6,"title":"test","updatedAt":"2025-06-11T11:31:53Z"},{"labels":[],"number":5,"title":"RPAで画像取得ができなら","updatedAt":"2025-06-11T11:28:37Z"},{"labels":[{"id":"LA_kwDOO4Jtec8AAAACCXPV4g","name":"enhancement","description":"New feature or request","color":"a2eeef"},{"id":"LA_kwDOO4Jtec8AAAACCXVhxg","name":"python","description":"Pull requests that update python code","color":"2b67c6"}],"number":4,"title":"🤖 ContBK統合システム:GitHub Issue自動作成機能開発","updatedAt":"2025-06-11T11:25:21Z"}]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
## 📊 開発統計
|
| 47 |
+
|
| 48 |
+
### ✅ 実装完了機能 (6個)
|
| 49 |
+
1. 🤖 ContBK統合ダッシュボード
|
| 50 |
+
2. 🐙 GitHub Issue自動作成機能
|
| 51 |
+
3. 💬 会話履歴記録システム
|
| 52 |
+
4. 🤖 RPA自動化システム
|
| 53 |
+
5. 🎨 UI自動生成システム
|
| 54 |
+
6. 📄 ドキュメント生成AI
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
### 🏗️ システムアーキテクチャ
|
| 58 |
+
```
|
| 59 |
+
fastapi_django_main_live/
|
| 60 |
+
├── 🎯 controllers/ # 統合ダッシュボード・Issue作成
|
| 61 |
+
├── 🤖 contbk/ # AI・RPA・UI生成機能群
|
| 62 |
+
├── 💾 データベース/ # 会話・RPA・プロンプト履歴
|
| 63 |
+
├── 🌐 mysite/ # FastAPI・Django統合
|
| 64 |
+
└── 📚 docs/ # ドキュメント・スクリーンショット
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### 📈 開発成果
|
| 68 |
+
- **開発期間**: 2025年06月
|
| 69 |
+
- **コミット数**: 継続的更新中
|
| 70 |
+
- **機能数**: 6個以上
|
| 71 |
+
- **技術統合**: AI + Web + 自動化
|
| 72 |
+
|
| 73 |
+
---
|
| 74 |
+
|
| 75 |
+
## 🔗 詳細ドキュメント
|
| 76 |
+
|
| 77 |
+
- 📘 **[システムショーケース](./docs/system_showcase.md)** - 開発成果の詳細
|
| 78 |
+
- 🤖 **[AI視点分析](./docs/AI.md)** - AIによるシステム評価
|
| 79 |
+
- 🛠️ **[技術仕様書](./docs/)** - 開発者向け詳細情報
|
| 80 |
+
|
| 81 |
+
---
|
| 82 |
+
|
| 83 |
+
*最終更新: 2025年06月11日 11:41:41*
|
docs/system_showcase.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🚀 ContBK統合システム - 開発成果ショーケース
|
| 2 |
+
|
| 3 |
+
*生成日時: 2025年06月11日 11:41:41*
|
| 4 |
+
|
| 5 |
+
## 🎯 システム概要
|
| 6 |
+
|
| 7 |
+
このドキュメントは、GitHub CopilotとAIアシスタントによって協働開発された**ContBK統合システム**の成果物を紹介します。
|
| 8 |
+
|
| 9 |
+
### 🌐 稼働中システム
|
| 10 |
+
- **メインサイト**: [https://ideal-halibut-4q5qp79g2jp9-7860.app.github.dev/](https://ideal-halibut-4q5qp79g2jp9-7860.app.github.dev/)
|
| 11 |
+
- **統合ダッシュボード**: [http://localhost:7865](http://localhost:7865)
|
| 12 |
+
- **GitHubリポジトリ**: [https://github.com/miyataken999/fastapi_django_main_live](https://github.com/miyataken999/fastapi_django_main_live)
|
| 13 |
+
|
| 14 |
+
## 🛠️ 実装完了機能
|
| 15 |
+
|
| 16 |
+
### ✅ 主要機能一覧
|
| 17 |
+
- 🤖 ContBK統合ダッシュボード
|
| 18 |
+
- 🐙 GitHub Issue自動作成機能
|
| 19 |
+
- 💬 会話履歴記録システム
|
| 20 |
+
- 🤖 RPA自動化システム
|
| 21 |
+
- 🎨 UI自動生成システム
|
| 22 |
+
- 📄 ドキュメント生成AI
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
## 📊 開発状況
|
| 26 |
+
|
| 27 |
+
### 🔄 オープンイシュー
|
| 28 |
+
[{"labels":[],"number":6,"title":"test","updatedAt":"2025-06-11T11:31:53Z"},{"labels":[],"number":5,"title":"RPAで画像取得ができなら","updatedAt":"2025-06-11T11:28:37Z"},{"labels":[{"id":"LA_kwDOO4Jtec8AAAACCXPV4g","name":"enhancement","description":"New feature or request","color":"a2eeef"},{"id":"LA_kwDOO4Jtec8AAAACCXVhxg","name":"python","description":"Pull requests that update python code","color":"2b67c6"}],"number":4,"title":"🤖 ContBK統合システム:GitHub Issue自動作成機能開発","updatedAt":"2025-06-11T11:25:21Z"}]
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
## 📸 システムスクリーンショット
|
| 32 |
+
|
| 33 |
+
### 🏠 メインダッシュボード
|
| 34 |
+

|
| 35 |
+
|
| 36 |
+
*ContBK統合システムのメインインターフェース。カテゴリ別に整理された機能一覧。*
|
| 37 |
+
|
| 38 |
+
### 🤖 AI・自動化カテゴリ
|
| 39 |
+

|
| 40 |
+
|
| 41 |
+
*AI チャット、AI インタープリター、RPA自動化システムを統合。*
|
| 42 |
+
|
| 43 |
+
### 🐙 GitHub Issue作成機能
|
| 44 |
+

|
| 45 |
+
|
| 46 |
+
*会話履歴から自動的にGitHub Issueを作成する革新的な機能。*
|
| 47 |
+
|
| 48 |
+
### 📄 ドキュメント・開発カテゴリ
|
| 49 |
+

|
| 50 |
+
|
| 51 |
+
*ドキュメント生成、プログラム生成AI、プロンプト管理機能。*
|
| 52 |
+
|
| 53 |
+
### 🎨 フロントエンド・UI カテゴリ
|
| 54 |
+

|
| 55 |
+
|
| 56 |
+
*フロントエンド生成、画像からUI生成の高度な機能群。*
|
| 57 |
+
|
| 58 |
+
## 🔧 技術的特徴
|
| 59 |
+
|
| 60 |
+
### 🚀 革新的アーキテクチャ
|
| 61 |
+
- **自動発見システム**: `controllers/`と`contbk/`を自動スキャン
|
| 62 |
+
- **プラグイン式設計**: 新機能の追加が容易
|
| 63 |
+
- **統合ダッシュボード**: 全機能を一元管理
|
| 64 |
+
- **会話駆動開発**: 自然言語でシステム拡張
|
| 65 |
+
|
| 66 |
+
### 💾 データ管理
|
| 67 |
+
- **SQLite統合**: 会話履歴、RPA履歴、プロンプト管理
|
| 68 |
+
- **自動記録**: システム操作の完全トレーサビリティ
|
| 69 |
+
- **バックアップ**: データの安全性確保
|
| 70 |
+
|
| 71 |
+
### 🔗 外部連携
|
| 72 |
+
- **GitHub CLI統合**: Issue作成・管理の自動化
|
| 73 |
+
- **Gradio WebUI**: 美しく直感的なインターフェース
|
| 74 |
+
- **AI API統合**: 複数のAIサービスとの連携
|
| 75 |
+
|
| 76 |
+
## 📈 開発プロセス
|
| 77 |
+
|
| 78 |
+
### 🤖 AI協働開発
|
| 79 |
+
1. **要求分析**: 自然言語での機能要求
|
| 80 |
+
2. **設計**: AIによる最適なアーキテクチャ提案
|
| 81 |
+
3. **実装**: リアルタイムコード生成と統合
|
| 82 |
+
4. **テスト**: 自動テストとデバッグ
|
| 83 |
+
5. **ドキュメント**: 自動ドキュメント生成
|
| 84 |
+
|
| 85 |
+
### 🔄 継続的改善
|
| 86 |
+
- **フィードバック**: ユーザー操作からの学習
|
| 87 |
+
- **自動最適化**: パフォーマンス監視と改善
|
| 88 |
+
- **機能拡張**: 新たなニーズへの即座の対応
|
| 89 |
+
|
| 90 |
+
## 🎉 成果と影響
|
| 91 |
+
|
| 92 |
+
### ✨ 開発速度の革命
|
| 93 |
+
- **従来**: 数週間 → **現在**: 数分〜数時間
|
| 94 |
+
- **コード品質**: AI支援による高品質コード
|
| 95 |
+
- **保守性**: モジュラー設計による高い保守性
|
| 96 |
+
|
| 97 |
+
### 🌟 ユーザー体験
|
| 98 |
+
- **直感的操作**: 自然言語での機能利用
|
| 99 |
+
- **統合環境**: 全ての機能が一箇所に集約
|
| 100 |
+
- **カスタマイズ**: ユーザーニーズに応じた柔軟な拡張
|
| 101 |
+
|
| 102 |
+
## 🔮 今後の展望
|
| 103 |
+
|
| 104 |
+
### 🚀 予定機能
|
| 105 |
+
- **マルチモーダルAI**: 画像・音声・動画処理の統合
|
| 106 |
+
- **リアルタイム協働**: 複数ユーザーでの同時開発
|
| 107 |
+
- **自動デプロイ**: CI/CDパイプラインの完全自動化
|
| 108 |
+
- **AI学習**: システム利用パターンからの自動学習
|
| 109 |
+
|
| 110 |
+
### 🌐 拡張可能性
|
| 111 |
+
- **プラットフォーム**: クラウド・オンプレミス対応
|
| 112 |
+
- **API化**: 外部システムとの連携強化
|
| 113 |
+
- **多言語対応**: グローバル展開への準備
|
| 114 |
+
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
*このシステムは、人間とAIの協働による新しい開発パ��ダイムの実証実験として位置づけられています。*
|
| 118 |
+
|
| 119 |
+
**開発チーム**: GitHub Copilot + AI Assistant + 人間開発者
|
| 120 |
+
**開発期間**: 2025年06月
|
| 121 |
+
**技術スタック**: Python, FastAPI, Django, Gradio, SQLite, GitHub CLI
|
generate_system_docs.py
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
システムドキュメント生成ツール
|
| 3 |
+
============================
|
| 4 |
+
|
| 5 |
+
開発したシステムの画面キャプチャとドキュメントを自動生成
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import os
|
| 9 |
+
import datetime
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
import subprocess
|
| 12 |
+
import requests
|
| 13 |
+
from PIL import Image
|
| 14 |
+
import io
|
| 15 |
+
|
| 16 |
+
def create_documentation_structure():
|
| 17 |
+
"""ドキュメント用のディレクトリ構造を作成"""
|
| 18 |
+
|
| 19 |
+
docs_dir = Path("/workspaces/fastapi_django_main_live/docs")
|
| 20 |
+
images_dir = docs_dir / "images"
|
| 21 |
+
screenshots_dir = images_dir / "screenshots"
|
| 22 |
+
|
| 23 |
+
# ディレクトリ作成
|
| 24 |
+
for dir_path in [docs_dir, images_dir, screenshots_dir]:
|
| 25 |
+
dir_path.mkdir(exist_ok=True)
|
| 26 |
+
print(f"📁 Created directory: {dir_path}")
|
| 27 |
+
|
| 28 |
+
return {
|
| 29 |
+
"docs": docs_dir,
|
| 30 |
+
"images": images_dir,
|
| 31 |
+
"screenshots": screenshots_dir
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
def capture_system_info():
|
| 35 |
+
"""システム情報を取得"""
|
| 36 |
+
|
| 37 |
+
# GitHub Issues取得
|
| 38 |
+
try:
|
| 39 |
+
result = subprocess.run(['gh', 'issue', 'list', '--state', 'open', '--json', 'number,title,labels,updatedAt'],
|
| 40 |
+
capture_output=True, text=True, cwd='/workspaces/fastapi_django_main_live')
|
| 41 |
+
open_issues = result.stdout if result.returncode == 0 else "[]"
|
| 42 |
+
except Exception as e:
|
| 43 |
+
open_issues = f"Error: {e}"
|
| 44 |
+
|
| 45 |
+
# システム情報
|
| 46 |
+
system_info = {
|
| 47 |
+
"timestamp": datetime.datetime.now().isoformat(),
|
| 48 |
+
"main_url": "https://ideal-halibut-4q5qp79g2jp9-7860.app.github.dev/",
|
| 49 |
+
"local_dashboard": "http://localhost:7865",
|
| 50 |
+
"github_repo": "https://github.com/miyataken999/fastapi_django_main_live",
|
| 51 |
+
"open_issues": open_issues,
|
| 52 |
+
"features_implemented": [
|
| 53 |
+
"🤖 ContBK統合ダッシュボード",
|
| 54 |
+
"🐙 GitHub Issue自動作成機能",
|
| 55 |
+
"💬 会話履歴記録システム",
|
| 56 |
+
"🤖 RPA自動化システム",
|
| 57 |
+
"🎨 UI自動生成システム",
|
| 58 |
+
"📄 ドキュメント生成AI"
|
| 59 |
+
]
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
return system_info
|
| 63 |
+
|
| 64 |
+
def generate_system_showcase_doc(dirs, system_info):
|
| 65 |
+
"""システムショーケースドキュメントを生成"""
|
| 66 |
+
|
| 67 |
+
showcase_content = f"""# 🚀 ContBK統合システム - 開発成果ショーケース
|
| 68 |
+
|
| 69 |
+
*生成日時: {datetime.datetime.now().strftime('%Y年%m月%d日 %H:%M:%S')}*
|
| 70 |
+
|
| 71 |
+
## 🎯 システム概要
|
| 72 |
+
|
| 73 |
+
このドキュメントは、GitHub CopilotとAIアシスタントによって協働開発された**ContBK統合システム**の成果物を紹介します。
|
| 74 |
+
|
| 75 |
+
### 🌐 稼働中システム
|
| 76 |
+
- **メインサイト**: [{system_info['main_url']}]({system_info['main_url']})
|
| 77 |
+
- **統合ダッシュボード**: [{system_info['local_dashboard']}]({system_info['local_dashboard']})
|
| 78 |
+
- **GitHubリポジトリ**: [{system_info['github_repo']}]({system_info['github_repo']})
|
| 79 |
+
|
| 80 |
+
## 🛠️ 実装完了機能
|
| 81 |
+
|
| 82 |
+
### ✅ 主要機能一覧
|
| 83 |
+
"""
|
| 84 |
+
|
| 85 |
+
for feature in system_info['features_implemented']:
|
| 86 |
+
showcase_content += f"- {feature}\n"
|
| 87 |
+
|
| 88 |
+
showcase_content += f"""
|
| 89 |
+
|
| 90 |
+
## 📊 開発状況
|
| 91 |
+
|
| 92 |
+
### 🔄 オープンイシュー
|
| 93 |
+
{system_info['open_issues']}
|
| 94 |
+
|
| 95 |
+
## 📸 システムスクリーンショット
|
| 96 |
+
|
| 97 |
+
### 🏠 メインダッシュボード
|
| 98 |
+

|
| 99 |
+
|
| 100 |
+
*ContBK統合システムのメインインターフェース。カテゴリ別に整理された機能一覧。*
|
| 101 |
+
|
| 102 |
+
### 🤖 AI・自動化カテゴリ
|
| 103 |
+

|
| 104 |
+
|
| 105 |
+
*AI チャット、AI インタープリター、RPA自動化システムを統合。*
|
| 106 |
+
|
| 107 |
+
### 🐙 GitHub Issue作成機能
|
| 108 |
+

|
| 109 |
+
|
| 110 |
+
*会話履歴から自動的にGitHub Issueを作成する革新的な機能。*
|
| 111 |
+
|
| 112 |
+
### 📄 ドキュメント・開発カテゴリ
|
| 113 |
+

|
| 114 |
+
|
| 115 |
+
*ドキュメント生成、プログラム生成AI、プロンプト管理機能。*
|
| 116 |
+
|
| 117 |
+
### 🎨 フロントエンド・UI カテゴリ
|
| 118 |
+

|
| 119 |
+
|
| 120 |
+
*フロントエンド生成、画像からUI生成の高度な機能群。*
|
| 121 |
+
|
| 122 |
+
## 🔧 技術的特徴
|
| 123 |
+
|
| 124 |
+
### 🚀 革新的アーキテクチャ
|
| 125 |
+
- **自動発見システム**: `controllers/`と`contbk/`を自動スキャン
|
| 126 |
+
- **プラグイン式設計**: 新機能の追加が容易
|
| 127 |
+
- **統合ダッシュボード**: 全機能を一元管理
|
| 128 |
+
- **会話駆動開発**: 自然言語でシステム拡張
|
| 129 |
+
|
| 130 |
+
### 💾 データ管理
|
| 131 |
+
- **SQLite統合**: 会話履歴、RPA履歴、プロンプト管理
|
| 132 |
+
- **自動記録**: システム操作の完全トレーサビリティ
|
| 133 |
+
- **バックアップ**: データの安全性確保
|
| 134 |
+
|
| 135 |
+
### 🔗 外部連携
|
| 136 |
+
- **GitHub CLI統合**: Issue作成・管理の自動化
|
| 137 |
+
- **Gradio WebUI**: 美しく直感的なインターフェース
|
| 138 |
+
- **AI API統合**: 複数のAIサービスとの連携
|
| 139 |
+
|
| 140 |
+
## 📈 開発プロセス
|
| 141 |
+
|
| 142 |
+
### ���� AI協働開発
|
| 143 |
+
1. **要求分析**: 自然言語での機能要求
|
| 144 |
+
2. **設計**: AIによる最適なアーキテクチャ提案
|
| 145 |
+
3. **実装**: リアルタイムコード生成と統合
|
| 146 |
+
4. **テスト**: 自動テストとデバッグ
|
| 147 |
+
5. **ドキュメント**: 自動ドキュメント生成
|
| 148 |
+
|
| 149 |
+
### 🔄 継続的改善
|
| 150 |
+
- **フィードバック**: ユーザー操作からの学習
|
| 151 |
+
- **自動最適化**: パフォーマンス監視と改善
|
| 152 |
+
- **機能拡張**: 新たなニーズへの即座の対応
|
| 153 |
+
|
| 154 |
+
## 🎉 成果と影響
|
| 155 |
+
|
| 156 |
+
### ✨ 開発速度の革命
|
| 157 |
+
- **従来**: 数週間 → **現在**: 数分〜数時間
|
| 158 |
+
- **コード品質**: AI支援による高品質コード
|
| 159 |
+
- **保守性**: モジュラー設計による高い保守性
|
| 160 |
+
|
| 161 |
+
### 🌟 ユーザー体験
|
| 162 |
+
- **直感的操作**: 自然言語での機能利用
|
| 163 |
+
- **統合環境**: 全ての機能が一箇所に集約
|
| 164 |
+
- **カスタマイズ**: ユーザーニーズに応じた柔軟な拡張
|
| 165 |
+
|
| 166 |
+
## 🔮 今後の展望
|
| 167 |
+
|
| 168 |
+
### 🚀 予定機能
|
| 169 |
+
- **マルチモーダルAI**: 画像・音声・動画処理の統合
|
| 170 |
+
- **リアルタイム協働**: 複数ユーザーでの同時開発
|
| 171 |
+
- **自動デプロイ**: CI/CDパイプラインの完全自動化
|
| 172 |
+
- **AI学習**: システム利用パターンからの自動学習
|
| 173 |
+
|
| 174 |
+
### 🌐 拡張可能性
|
| 175 |
+
- **プラットフォーム**: クラウド・オンプレミス対応
|
| 176 |
+
- **API化**: 外部システムとの連携強化
|
| 177 |
+
- **多言語対応**: グローバル展開への準備
|
| 178 |
+
|
| 179 |
+
---
|
| 180 |
+
|
| 181 |
+
*このシステムは、人間とAIの協働による新しい開発パラダイムの実証実験として位置づけられています。*
|
| 182 |
+
|
| 183 |
+
**開発チーム**: GitHub Copilot + AI Assistant + 人間開発者
|
| 184 |
+
**開発期間**: {datetime.datetime.now().strftime('%Y年%m月')}
|
| 185 |
+
**技術スタック**: Python, FastAPI, Django, Gradio, SQLite, GitHub CLI
|
| 186 |
+
"""
|
| 187 |
+
|
| 188 |
+
return showcase_content
|
| 189 |
+
|
| 190 |
+
def generate_updated_readme(dirs, system_info):
|
| 191 |
+
"""更新されたREADME.mdを生成"""
|
| 192 |
+
|
| 193 |
+
readme_addition = f"""
|
| 194 |
+
|
| 195 |
+
## 📸 システムスクリーンショット・ギャラリー
|
| 196 |
+
|
| 197 |
+
### 🎯 ContBK統合ダッシュボード
|
| 198 |
+

|
| 199 |
+
|
| 200 |
+
**機能概要**:
|
| 201 |
+
- 🏠 概要タブで全体像把握
|
| 202 |
+
- 🤖 AI・自動化カテゴリ
|
| 203 |
+
- 📄 ドキュメント・開発カテゴリ
|
| 204 |
+
- 🎨 フロントエンド・UIカテゴリ
|
| 205 |
+
- 📊 データ・ファイルカテゴリ
|
| 206 |
+
- 🌐 その他ツール
|
| 207 |
+
- 🐙 開発・Issue管理カテゴリ
|
| 208 |
+
|
| 209 |
+
### 🐙 GitHub Issue自動作成機能
|
| 210 |
+

|
| 211 |
+
|
| 212 |
+
**革新的機能**:
|
| 213 |
+
- 💬 会話履歴からIssue自動生成
|
| 214 |
+
- 🏷️ ラベル自動付与
|
| 215 |
+
- 📝 Markdown形式の美しいIssue
|
| 216 |
+
- 🔄 セッション情報の自動記録
|
| 217 |
+
|
| 218 |
+
### 🤖 RPA自動化システム
|
| 219 |
+

|
| 220 |
+
|
| 221 |
+
**高度な自動化**:
|
| 222 |
+
- 🌐 Webブラウザ自動操作
|
| 223 |
+
- 📸 スクリーンショット取得
|
| 224 |
+
- 🎯 要素の自動認識
|
| 225 |
+
- 💾 操作履歴の完全記録
|
| 226 |
+
|
| 227 |
+
## 🚀 ライブデモ
|
| 228 |
+
|
| 229 |
+
### 🌐 本番環境
|
| 230 |
+
**メインサイト**: [https://ideal-halibut-4q5qp79g2jp9-7860.app.github.dev/](https://ideal-halibut-4q5qp79g2jp9-7860.app.github.dev/)
|
| 231 |
+
|
| 232 |
+
実際に稼働中のシステムをご体験いただけます!
|
| 233 |
+
|
| 234 |
+
### 📋 現在のオープンイシュー
|
| 235 |
+
{system_info['open_issues']}
|
| 236 |
+
|
| 237 |
+
## 📊 開発統計
|
| 238 |
+
|
| 239 |
+
### ✅ 実装完了機能 ({len(system_info['features_implemented'])}個)
|
| 240 |
+
"""
|
| 241 |
+
|
| 242 |
+
for i, feature in enumerate(system_info['features_implemented'], 1):
|
| 243 |
+
readme_addition += f"{i}. {feature}\n"
|
| 244 |
+
|
| 245 |
+
readme_addition += f"""
|
| 246 |
+
|
| 247 |
+
### 🏗️ システムアーキテクチャ
|
| 248 |
+
```
|
| 249 |
+
fastapi_django_main_live/
|
| 250 |
+
├── 🎯 controllers/ # 統合ダッシュボード・Issue作成
|
| 251 |
+
├── 🤖 contbk/ # AI・RPA・UI生成機能群
|
| 252 |
+
├── 💾 データベース/ # 会話・RPA・プロンプト履歴
|
| 253 |
+
├── 🌐 mysite/ # FastAPI・Django統合
|
| 254 |
+
└── 📚 docs/ # ドキュメント・スクリーンショット
|
| 255 |
+
```
|
| 256 |
+
|
| 257 |
+
### 📈 開発成果
|
| 258 |
+
- **開発期間**: {datetime.datetime.now().strftime('%Y年%m月')}
|
| 259 |
+
- **コミット数**: 継続的更新中
|
| 260 |
+
- **機能数**: {len(system_info['features_implemented'])}個以上
|
| 261 |
+
- **技術統合**: AI + Web + 自動化
|
| 262 |
+
|
| 263 |
+
---
|
| 264 |
+
|
| 265 |
+
## 🔗 詳細ドキュメント
|
| 266 |
+
|
| 267 |
+
- 📘 **[システムショーケース](./docs/system_showcase.md)** - 開発成果の詳細
|
| 268 |
+
- 🤖 **[AI視点分析](./docs/AI.md)** - AIによるシステム評価
|
| 269 |
+
- 🛠️ **[技術仕様書](./docs/)** - 開発者向け詳細情報
|
| 270 |
+
|
| 271 |
+
---
|
| 272 |
+
|
| 273 |
+
*最終更新: {datetime.datetime.now().strftime('%Y年%m月%d日 %H:%M:%S')}*
|
| 274 |
+
"""
|
| 275 |
+
|
| 276 |
+
return readme_addition
|
| 277 |
+
|
| 278 |
+
def main():
|
| 279 |
+
"""メイン実行関数"""
|
| 280 |
+
print("🚀 システムドキュメント生成を開始...")
|
| 281 |
+
|
| 282 |
+
# ディレクトリ構造作成
|
| 283 |
+
dirs = create_documentation_structure()
|
| 284 |
+
print("✅ ディレクトリ構造作成完了")
|
| 285 |
+
|
| 286 |
+
# システム情報取得
|
| 287 |
+
system_info = capture_system_info()
|
| 288 |
+
print("✅ システム情報取得完了")
|
| 289 |
+
|
| 290 |
+
# システムショーケースドキュメント生成
|
| 291 |
+
showcase_content = generate_system_showcase_doc(dirs, system_info)
|
| 292 |
+
showcase_path = dirs["docs"] / "system_showcase.md"
|
| 293 |
+
with open(showcase_path, 'w', encoding='utf-8') as f:
|
| 294 |
+
f.write(showcase_content)
|
| 295 |
+
print(f"✅ システムショーケース生成: {showcase_path}")
|
| 296 |
+
|
| 297 |
+
# README更新内容生成
|
| 298 |
+
readme_addition = generate_updated_readme(dirs, system_info)
|
| 299 |
+
readme_addition_path = dirs["docs"] / "readme_addition.md"
|
| 300 |
+
with open(readme_addition_path, 'w', encoding='utf-8') as f:
|
| 301 |
+
f.write(readme_addition)
|
| 302 |
+
print(f"✅ README追加内容生成: {readme_addition_path}")
|
| 303 |
+
|
| 304 |
+
print("🎉 ドキュメント生成完了!")
|
| 305 |
+
print("\n📋 次のステップ:")
|
| 306 |
+
print("1. システムのスクリーンショット取得")
|
| 307 |
+
print("2. README.mdに追加内容をマージ")
|
| 308 |
+
print("3. GitHub Issueの状況確認・更新")
|
| 309 |
+
|
| 310 |
+
return dirs, system_info
|
| 311 |
+
|
| 312 |
+
if __name__ == "__main__":
|
| 313 |
+
main()
|
mysite/routers/gradio.py
CHANGED
|
@@ -19,20 +19,32 @@ import pkgutil
|
|
| 19 |
import traceback
|
| 20 |
|
| 21 |
def include_gradio_interfaces():
|
| 22 |
-
package_dir = "controllers" # 相対パスでcontrollersディレクトリを指定
|
| 23 |
gradio_interfaces = {} # 辞書型: { interface_name: gradio_interface }
|
| 24 |
|
| 25 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
package_paths = []
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
# パッケージの Python モジュールを取得
|
| 34 |
-
rel_path = os.path.relpath(package_path,
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
for module_info in pkgutil.iter_modules([package_path]):
|
| 38 |
sub_module_name = f"{package_name}.{module_info.name}"
|
|
@@ -53,6 +65,8 @@ def include_gradio_interfaces():
|
|
| 53 |
title_mapping = {
|
| 54 |
'conversation_history': '💬 会話履歴管理',
|
| 55 |
'conversation_logger': '📝 会話ログ',
|
|
|
|
|
|
|
| 56 |
# 'contbk_example': '🎯 ContBK ダッシュボード', # 無効化済み
|
| 57 |
# 'contbk_dashboard': '📊 ContBK 統合', # 無効化済み
|
| 58 |
# 'example_gradio_interface': '🔧 サンプル', # 無効化済み
|
|
@@ -60,11 +74,12 @@ def include_gradio_interfaces():
|
|
| 60 |
'Chat': '💬 チャット',
|
| 61 |
'OpenInterpreter': '🤖 AI インタープリター',
|
| 62 |
'programfromdoc': '📄 ドキュメント生成',
|
| 63 |
-
'gradio_interface': '🚀 AI
|
| 64 |
-
'lavelo': '💾
|
| 65 |
-
'rides': '🚗
|
| 66 |
'files': '📁 ファイル管理',
|
| 67 |
'gradio': '🌐 HTML表示',
|
|
|
|
| 68 |
}
|
| 69 |
|
| 70 |
# モジュールにtitle属性があるかチェック
|
|
|
|
| 19 |
import traceback
|
| 20 |
|
| 21 |
def include_gradio_interfaces():
|
|
|
|
| 22 |
gradio_interfaces = {} # 辞書型: { interface_name: gradio_interface }
|
| 23 |
|
| 24 |
+
# 検索対象ディレクトリを指定(ContBKは統合ダッシュボードで表示するため除外)
|
| 25 |
+
search_dirs = [
|
| 26 |
+
("controllers", "controllers"), # メインのcontrollersディレクトリのみ
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
package_paths = []
|
| 30 |
+
|
| 31 |
+
# 各検索ディレクトリをスキャン
|
| 32 |
+
for package_dir, module_prefix in search_dirs:
|
| 33 |
+
if os.path.exists(package_dir):
|
| 34 |
+
print(f"📂 Scanning directory: {package_dir}")
|
| 35 |
+
for root, dirs, files in os.walk(package_dir):
|
| 36 |
+
if "__pycache__" in root: # `__pycache__` を除外
|
| 37 |
+
continue
|
| 38 |
+
package_paths.append((root, module_prefix))
|
| 39 |
+
|
| 40 |
+
for package_path, module_prefix in package_paths:
|
| 41 |
# パッケージの Python モジュールを取得
|
| 42 |
+
rel_path = os.path.relpath(package_path, module_prefix.split('.')[0] if '.' in module_prefix else module_prefix)
|
| 43 |
+
|
| 44 |
+
if rel_path == ".":
|
| 45 |
+
package_name = module_prefix
|
| 46 |
+
else:
|
| 47 |
+
package_name = module_prefix + "." + rel_path.replace(os.sep, ".")
|
| 48 |
|
| 49 |
for module_info in pkgutil.iter_modules([package_path]):
|
| 50 |
sub_module_name = f"{package_name}.{module_info.name}"
|
|
|
|
| 65 |
title_mapping = {
|
| 66 |
'conversation_history': '💬 会話履歴管理',
|
| 67 |
'conversation_logger': '📝 会話ログ',
|
| 68 |
+
'conversation_demo': '🎯 会話履歴統合デモ',
|
| 69 |
+
'contbk_unified_dashboard': '🎯 ContBK統合ダッシュボード',
|
| 70 |
# 'contbk_example': '🎯 ContBK ダッシュボード', # 無効化済み
|
| 71 |
# 'contbk_dashboard': '📊 ContBK 統合', # 無効化済み
|
| 72 |
# 'example_gradio_interface': '🔧 サンプル', # 無効化済み
|
|
|
|
| 74 |
'Chat': '💬 チャット',
|
| 75 |
'OpenInterpreter': '🤖 AI インタープリター',
|
| 76 |
'programfromdoc': '📄 ドキュメント生成',
|
| 77 |
+
'gradio_interface': '🚀 AI開発プラットフォーム',
|
| 78 |
+
'lavelo': '💾 プロンプト管理システム',
|
| 79 |
+
'rides': '🚗 データベース管理',
|
| 80 |
'files': '📁 ファイル管理',
|
| 81 |
'gradio': '🌐 HTML表示',
|
| 82 |
+
'rpa_automation': '🤖 RPA自動化システム',
|
| 83 |
}
|
| 84 |
|
| 85 |
# モジュールにtitle属性があるかチェック
|
session_context_prompt.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<conversation-summary>
|
| 2 |
+
## CONVERSATION SUMMARY
|
| 3 |
+
|
| 4 |
+
**TASK DESCRIPTION:**
|
| 5 |
+
統合開発環境でのContBKフォルダーインターフェース統合、会話履歴システム実装、
|
| 6 |
+
SQLiteベースの自動ログ機能開発を継続的に行っています。
|
| 7 |
+
|
| 8 |
+
**COMPLETED:**
|
| 9 |
+
- ✅ 総会話数: 10件
|
| 10 |
+
- ✅ セッション数: 3件
|
| 11 |
+
- ✅ ContBK統合システム実装済み
|
| 12 |
+
- ✅ SQLite会話履歴システム実装済み
|
| 13 |
+
- ✅ DuplicateBlockError修正済み
|
| 14 |
+
- ✅ Git同期管理実装済み
|
| 15 |
+
|
| 16 |
+
**RECENT SESSIONS:**
|
| 17 |
+
- セッション_manual_l (1件) - 2025-06-11 10:35
|
| 18 |
+
- セッション_b0a99fa1 (2件) - 2025-06-11 10:22
|
| 19 |
+
- セッション_39ea93ef (3件) - 2025-06-11 09:32
|
| 20 |
+
|
| 21 |
+
**LATEST CONVERSATIONS:**
|
| 22 |
+
1. [2025-06-11T10:44] プロンプト履歴生成システム実装
|
| 23 |
+
→ プロンプト生成機能完成!新セッション用コンテキストプロンプト自動生成、会話履歴サマリー機能、技術フォーカス版対応。GitHub Copilotの継続性が向上しました!
|
| 24 |
+
Context: プロンプト履歴生成システム実装完了
|
| 25 |
+
2. [2025-06-11T10:43] あなたとのやりとりはプロンプトに追加したらいいかね まいかい新規の際にそれをみてと でないと過去の記憶なくなるよね
|
| 26 |
+
→ 素晴らしいアイデア!プロンプト履歴生成システムを実装しました!
|
| 27 |
+
|
| 28 |
+
✅ **新機能完成:**
|
| 29 |
+
|
| 30 |
+
1. **プロンプト生成機能**:
|
| 31 |
+
- 📝 新セッション用コンテキストプロンプト自動生成
|
| 32 |
+
-...
|
| 33 |
+
Context: プロンプト履歴生成システム実装
|
| 34 |
+
3. [2025-06-11T10:36] sqliteに毎回履歴は追加していってね
|
| 35 |
+
→ Git Push完了 & SQLite履歴追加確認済み!毎回の会話履歴はちゃんとSQLiteに追加され続けます!
|
| 36 |
+
Context: Git push操作とSQLite履歴確認
|
| 37 |
+
4. [2025-06-11T10:36] sqliteに毎回履歴は追加していってね
|
| 38 |
+
→ ✅ Git Push完了 & SQLite履歴追加確認済み!
|
| 39 |
+
|
| 40 |
+
**実行済み作業:**
|
| 41 |
+
|
| 42 |
+
1. **Git Push成功**: DuplicateBlockError修正とContBK統合システムをリ...
|
| 43 |
+
Context: Git push操作とSQLite履歴確認
|
| 44 |
+
5. [2025-06-11 10:35] sqliteに毎回履歴は追加していってね
|
| 45 |
+
→ Git Push完了 & SQLite履歴追加確認済み!
|
| 46 |
+
|
| 47 |
+
✅ **実行済み作業:**
|
| 48 |
+
|
| 49 |
+
1. **Git Push成功**: DuplicateBlockError修正とContBK統合システムをリ...
|
| 50 |
+
Context: Git push操作とSQLite履歴確認作業
|
| 51 |
+
|
| 52 |
+
**CURRENT_STATE:**
|
| 53 |
+
アプリケーションは http://localhost:7860 で正常稼働中。
|
| 54 |
+
10個のGradioインターフェースが統合され、会話履歴システムも完全に動作しています。
|
| 55 |
+
全ての変更はGitで管理され、SQLiteに自動記録されています。
|
| 56 |
+
</conversation-summary>
|