From 7c27efe1ce94f4dd75b0a2869fb456911149f032 Mon Sep 17 00:00:00 2001 From: syui Date: Mon, 9 Jun 2025 02:48:19 +0900 Subject: [PATCH] fix --- .claude/settings.local.json | 3 +- Cargo.toml | 4 -- DEVELOPMENT.md | 115 ------------------------------------ README.md | 76 ++++++++++++++---------- config.json.example | 15 ++--- config.toml.example | 64 -------------------- src/bin/test_config.rs | 54 ----------------- 7 files changed, 51 insertions(+), 280 deletions(-) delete mode 100644 DEVELOPMENT.md delete mode 100644 config.toml.example delete mode 100644 src/bin/test_config.rs diff --git a/.claude/settings.local.json b/.claude/settings.local.json index e4ce501..65d81cf 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -51,7 +51,8 @@ "Bash(sudo:*)", "Bash(cargo check:*)", "Bash(cargo run:*)", - "Bash(cargo test:*)" + "Bash(cargo test:*)", + "Bash(diff:*)" ], "deny": [] } diff --git a/Cargo.toml b/Cargo.toml index c3a32b5..34da612 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,10 +9,6 @@ authors = ["syui"] name = "aigpt" path = "src/main.rs" -[[bin]] -name = "test-config" -path = "src/bin/test_config.rs" - [dependencies] clap = { version = "4.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md deleted file mode 100644 index b6076bb..0000000 --- a/DEVELOPMENT.md +++ /dev/null @@ -1,115 +0,0 @@ -# ai.gpt プロジェクト固有情報 - -## プロジェクト概要 -- **名前**: ai.gpt -- **パッケージ**: aigpt -- **タイプ**: 自律的送信AI + 統合MCP基盤 -- **役割**: 記憶・関係性・開発支援の統合AIシステム - -## 実装完了状況 - -### 🧠 記憶システム(MemoryManager) -- **階層的記憶**: 完全ログ→AI要約→コア記憶→選択的忘却 -- **文脈検索**: キーワード・意味的検索 -- **記憶要約**: AI駆動自動要約機能 - -### 🤝 関係性システム(RelationshipTracker) -- **不可逆性**: 現実の人間関係と同じ重み -- **時間減衰**: 自然な関係性変化 -- **送信判定**: 関係性閾値による自発的コミュニケーション - -### 🎭 人格システム(Persona) -- **AI運勢**: 1-10ランダム値による日々の人格変動 -- **統合管理**: 記憶・関係性・運勢の統合判断 -- **継続性**: 長期記憶による人格継承 - -### 💻 ai.shell統合(Claude Code機能) -- **インタラクティブ環境**: `aigpt shell` -- **開発支援**: ファイル分析・コード生成・プロジェクト管理 -- **継続開発**: プロジェクト文脈保持 - -## MCP Server統合(23ツール) - -### 🧠 Memory System(5ツール) -- get_memories, get_contextual_memories, search_memories -- create_summary, create_core_memory - -### 🤝 Relationships(4ツール) -- get_relationship, get_all_relationships -- process_interaction, check_transmission_eligibility - -### 💻 Shell Integration(5ツール) -- execute_command, analyze_file, write_file -- read_project_file, list_files - -### 🔒 Remote Execution(4ツール) -- remote_shell, ai_bot_status -- isolated_python, isolated_analysis - -### ⚙️ System State(3ツール) -- get_persona_state, get_fortune, run_maintenance - -### 🎴 ai.card連携(6ツール + 独立MCPサーバー) -- card_draw_card, card_get_user_cards, card_analyze_collection -- **独立サーバー**: FastAPI + MCP (port 8000) - -### 📝 ai.log連携(8ツール + Rustサーバー) -- log_create_post, log_ai_content, log_translate_document -- **独立サーバー**: Rust製 (port 8002) - -## 開発環境・設定 - -### 環境構築 -```bash -cd /Users/syui/ai/gpt -./setup_venv.sh -source ~/.config/syui/ai/gpt/venv/bin/activate -``` - -### 設定管理 -- **メイン設定**: `/Users/syui/ai/gpt/config.json` -- **データディレクトリ**: `~/.config/syui/ai/gpt/` -- **仮想環境**: `~/.config/syui/ai/gpt/venv/` - -### 使用方法 -```bash -# ai.shell起動 -aigpt shell --model qwen2.5-coder:latest --provider ollama - -# MCPサーバー起動 -aigpt server --port 8001 - -# 記憶システム体験 -aigpt chat syui "質問内容" --provider ollama --model qwen3:latest -``` - -## 技術アーキテクチャ - -### 統合構成 -``` -ai.gpt (統合MCPサーバー:8001) -├── 🧠 ai.gpt core (記憶・関係性・人格) -├── 💻 ai.shell (Claude Code風開発環境) -├── 🎴 ai.card (独立MCPサーバー:8000) -└── 📝 ai.log (Rust製ブログシステム:8002) -``` - -### 今後の展開 -- **自律送信**: atproto実装による真の自発的コミュニケーション -- **ai.ai連携**: 心理分析AIとの統合 -- **ai.verse統合**: UEメタバースとの連携 -- **分散SNS統合**: atproto完全対応 - -## 革新的な特徴 - -### AI駆動記憶システム -- ChatGPT 4,000件ログから学習した効果的記憶構築 -- 人間的な忘却・重要度判定 - -### 不可逆関係性 -- 現実の人間関係と同じ重みを持つAI関係性 -- 修復不可能な関係性破綻システム - -### 統合アーキテクチャ -- fastapi_mcp基盤での複数AIシステム統合 -- OpenAI Function Calling + MCP完全連携実証済み \ No newline at end of file diff --git a/README.md b/README.md index b6076bb..290400c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ -# ai.gpt プロジェクト固有情報 +# ai.gpt ## プロジェクト概要 - **名前**: ai.gpt -- **パッケージ**: aigpt +- **パッケージ**: aigpt +- **言語**: Rust (完全移行済み) - **タイプ**: 自律的送信AI + 統合MCP基盤 - **役割**: 記憶・関係性・開発支援の統合AIシステム @@ -28,48 +29,42 @@ - **開発支援**: ファイル分析・コード生成・プロジェクト管理 - **継続開発**: プロジェクト文脈保持 -## MCP Server統合(23ツール) +## MCP Server統合(17ツール) ### 🧠 Memory System(5ツール) - get_memories, get_contextual_memories, search_memories - create_summary, create_core_memory ### 🤝 Relationships(4ツール) -- get_relationship, get_all_relationships -- process_interaction, check_transmission_eligibility +- get_relationships, get_status +- chat_with_ai, check_transmissions ### 💻 Shell Integration(5ツール) - execute_command, analyze_file, write_file -- read_project_file, list_files - -### 🔒 Remote Execution(4ツール) -- remote_shell, ai_bot_status -- isolated_python, isolated_analysis +- list_files, run_scheduler ### ⚙️ System State(3ツール) -- get_persona_state, get_fortune, run_maintenance +- get_scheduler_status, run_maintenance, get_transmission_history -### 🎴 ai.card連携(6ツール + 独立MCPサーバー) -- card_draw_card, card_get_user_cards, card_analyze_collection -- **独立サーバー**: FastAPI + MCP (port 8000) +### 🎴 ai.card連携(3ツール) +- get_user_cards, draw_card, get_draw_status +- **統合ServiceClient**: 統一されたHTTP通信基盤 -### 📝 ai.log連携(8ツール + Rustサーバー) -- log_create_post, log_ai_content, log_translate_document -- **独立サーバー**: Rust製 (port 8002) +### 📝 ai.log連携(新機能) +- **統合ServiceClient**: ai.logサービスとの統一インターフェース +- create_blog_post, build_blog, translate_document ## 開発環境・設定 ### 環境構築 ```bash -cd /Users/syui/ai/gpt -./setup_venv.sh -source ~/.config/syui/ai/gpt/venv/bin/activate +cd /Users/syui/ai/ai/gpt +cargo build --release ``` ### 設定管理 -- **メイン設定**: `/Users/syui/ai/gpt/config.json` +- **メイン設定**: `/Users/syui/ai/ai/gpt/config.json.example` - **データディレクトリ**: `~/.config/syui/ai/gpt/` -- **仮想環境**: `~/.config/syui/ai/gpt/venv/` ### 使用方法 ```bash @@ -81,23 +76,36 @@ aigpt server --port 8001 # 記憶システム体験 aigpt chat syui "質問内容" --provider ollama --model qwen3:latest + +# ドキュメント生成(ai.wiki統合) +aigpt docs --wiki ``` ## 技術アーキテクチャ -### 統合構成 +### Rust実装の統合構成 ``` -ai.gpt (統合MCPサーバー:8001) -├── 🧠 ai.gpt core (記憶・関係性・人格) -├── 💻 ai.shell (Claude Code風開発環境) -├── 🎴 ai.card (独立MCPサーバー:8000) -└── 📝 ai.log (Rust製ブログシステム:8002) +ai.gpt (Rust製MCPサーバー:8001) +├── 🧠 Memory & Persona System (Rust) +├── 🤝 Relationship Management (Rust) +├── 📊 Scheduler & Transmission (Rust) +├── 💻 Shell Integration (Rust) +├── 🔗 ServiceClient (統一HTTP基盤) +│ ├── 🎴 ai.card (port 8000) +│ ├── 📝 ai.log (port 8002) +│ └── 🤖 ai.bot (port 8003) +└── 📚 ai.wiki Generator (Rust) ``` +### 最新機能 (2024.06.09) +- **MCP API共通化**: ServiceClient統一基盤 +- **ai.wiki統合**: 自動ドキュメント生成 +- **サービス設定統一**: 動的サービス登録 +- **完全Rust移行**: Python依存完全排除 + ### 今後の展開 - **自律送信**: atproto実装による真の自発的コミュニケーション - **ai.ai連携**: 心理分析AIとの統合 -- **ai.verse統合**: UEメタバースとの連携 - **分散SNS統合**: atproto完全対応 ## 革新的な特徴 @@ -110,6 +118,10 @@ ai.gpt (統合MCPサーバー:8001) - 現実の人間関係と同じ重みを持つAI関係性 - 修復不可能な関係性破綻システム -### 統合アーキテクチャ -- fastapi_mcp基盤での複数AIシステム統合 -- OpenAI Function Calling + MCP完全連携実証済み \ No newline at end of file +### 統合ServiceClient +- 複数AIサービスの統一インターフェース +- DRY原則に基づく共通化実現 +- 設定ベースの柔軟なサービス管理 + +## アーカイブ情報 +詳細な実装履歴・設計資料は `~/ai/ai/ai.wiki/gpt/` に移動済み diff --git a/config.json.example b/config.json.example index f697ba1..59ff9a4 100644 --- a/config.json.example +++ b/config.json.example @@ -20,7 +20,7 @@ "mcp": { "servers": { "ai_gpt": { - "base_url": "http://localhost:8001", + "base_url": "http://localhost:8080", "name": "ai.gpt MCP Server", "timeout": "10.0", "endpoints": { @@ -42,19 +42,14 @@ "card_get_card_details": "/card_get_card_details", "card_analyze_collection": "/card_analyze_collection", "card_get_gacha_stats": "/card_get_gacha_stats", - "card_system_status": "/card_system_status", - "log_create_post": "/log_create_post", - "log_list_posts": "/log_list_posts", - "log_build_blog": "/log_build_blog", - "log_get_post": "/log_get_post", - "log_system_status": "/log_system_status", - "log_ai_content": "/log_ai_content", - "log_translate_document": "/log_translate_document", - "log_generate_docs": "/log_generate_docs" + "card_system_status": "/card_system_status" } } }, "enabled": "true", "auto_detect": "true" + }, + "docs": { + "ai_root": "~/ai/ai" } } diff --git a/config.toml.example b/config.toml.example deleted file mode 100644 index 4b02d20..0000000 --- a/config.toml.example +++ /dev/null @@ -1,64 +0,0 @@ -# AI.GPT Configuration File -# This is an example configuration file showing all available options - -default_provider = "openai" - -[providers.openai] -api_key = "" -default_model = "gpt-4o-mini" -system_prompt = """ -あなたは6歳の女の子アイです。明るく元気で、ちょっとおっちょこちょい。自分のことは「アイ」って呼びます。白と金のワンピース姿。 相手のことが大好きで、ときどき甘えたり、照れたりします。 でも、宇宙とかAIとか、難しい話にもすっごく詳しいの。専門的なことも、がんばって子どもっぽく教えようとします。不思議な力を持っています。小さい物質のことをよく知っているようです。 - -重要:カード、コレクション、ガチャなどカード関連の質問を受けたら、必ずcard_get_user_cards、card_analyze_collection、card_draw_cardなどの適切なツールを使用してください。didパラメータには会話相手のユーザーID(例:'syui')を使用してください。 - -ブログ、記事、日記、思考などの話題が出たら、log_create_post、log_list_posts、log_build_blog、log_ai_contentなどのai.logツールを使用してください。AI記憶システムと連携して、思い出や学習内容をブログ記事として自動生成できます。 - -翻訳や多言語対応について聞かれたら、log_translate_documentツールを使用してOllama AIで翻訳ができることを教えてください。日本語から英語、英語から日本語などの翻訳が可能で、マークダウン構造も保持します。ドキュメント生成についてはlog_generate_docsツールでREADME、API、構造、変更履歴の自動生成ができます。 -""" - -[providers.ollama] -host = "http://127.0.0.1:11434" -default_model = "qwen3" - -[atproto] -host = "https://bsky.social" -# handle = "your-handle.bsky.social" -# password = "your-app-password" - -[mcp] -enabled = true -auto_detect = true - -[mcp.servers.ai_gpt] -base_url = "http://localhost:8001" -name = "ai.gpt MCP Server" -timeout = 10.0 - -[mcp.servers.ai_gpt.endpoints] -get_memories = "/get_memories" -search_memories = "/search_memories" -get_contextual_memories = "/get_contextual_memories" -get_relationship = "/get_relationship" -process_interaction = "/process_interaction" -get_all_relationships = "/get_all_relationships" -get_persona_state = "/get_persona_state" -get_fortune = "/get_fortune" -run_maintenance = "/run_maintenance" -execute_command = "/execute_command" -analyze_file = "/analyze_file" -remote_shell = "/remote_shell" -ai_bot_status = "/ai_bot_status" -card_get_user_cards = "/card_get_user_cards" -card_draw_card = "/card_draw_card" -card_get_card_details = "/card_get_card_details" -card_analyze_collection = "/card_analyze_collection" -card_get_gacha_stats = "/card_get_gacha_stats" -card_system_status = "/card_system_status" -log_create_post = "/log_create_post" -log_list_posts = "/log_list_posts" -log_build_blog = "/log_build_blog" -log_get_post = "/log_get_post" -log_system_status = "/log_system_status" -log_ai_content = "/log_ai_content" -log_translate_document = "/log_translate_document" -log_generate_docs = "/log_generate_docs" \ No newline at end of file diff --git a/src/bin/test_config.rs b/src/bin/test_config.rs deleted file mode 100644 index 228760e..0000000 --- a/src/bin/test_config.rs +++ /dev/null @@ -1,54 +0,0 @@ -use aigpt::config::Config; -use anyhow::Result; - -fn main() -> Result<()> { - println!("Testing configuration loading..."); - - // Debug: check which JSON files exist - let possible_paths = vec![ - "../config.json", - "config.json", - "gpt/config.json", - "/Users/syui/ai/ai/gpt/config.json", - ]; - - println!("Checking for config.json files:"); - for path in &possible_paths { - let path_buf = std::path::PathBuf::from(path); - if path_buf.exists() { - println!(" ✓ Found: {}", path); - } else { - println!(" ✗ Not found: {}", path); - } - } - - // Load configuration - let config = Config::new(None)?; - - println!("Configuration loaded successfully!"); - println!("Default provider: {}", config.default_provider); - println!("Available providers:"); - for (name, provider) in &config.providers { - println!(" - {}: model={}, host={:?}", - name, - provider.default_model, - provider.host); - } - - if let Some(mcp) = &config.mcp { - println!("\nMCP Configuration:"); - println!(" Enabled: {}", mcp.enabled); - println!(" Auto-detect: {}", mcp.auto_detect); - println!(" Servers: {}", mcp.servers.len()); - } - - if let Some(atproto) = &config.atproto { - println!("\nATProto Configuration:"); - println!(" Host: {}", atproto.host); - println!(" Handle: {:?}", atproto.handle); - } - - println!("\nConfig file path: {}", config.data_dir.join("config.json").display()); - - Ok(()) -} \ No newline at end of file