MakiAi commited on
Commit
be798fa
·
2 Parent(s): f726617 56ea7f1

Merge feature/huggingface-sync-ui-chatbot

Browse files
Files changed (3) hide show
  1. .streamlit/config.toml +7 -0
  2. app.py +142 -6
  3. docs/README.en.md +97 -53
.streamlit/config.toml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [theme]
2
+ primaryColor="#7E84F2" # メインカラー(青紫)- ボタンやリンクなどのアクセント
3
+ backgroundColor="#BFD4D9" # メイン背景色(薄いグレーブルー)- 柔らかな印象
4
+ secondaryBackgroundColor="#FFFFFF" # サイドバーなどの二次的な背景(白)- コントラスト確保
5
+ textColor="#5E608C" # テキストカラー(濃い青紫)- 読みやすさを確保
6
+
7
+ font="sans serif"
app.py CHANGED
@@ -1,9 +1,145 @@
1
  import streamlit as st
 
 
2
  import os
 
3
 
4
- try:
5
- with open("README.md", "r", encoding="utf-8") as f:
6
- readme_content = f.read()
7
- st.markdown(readme_content, unsafe_allow_html=True)
8
- except FileNotFoundError:
9
- st.error("README.mdが見つかりませんでした。")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from configs.agents import *
3
+ from swarm import Swarm
4
  import os
5
+ from datetime import datetime
6
 
7
+ # ページ設定
8
+ st.set_page_config(
9
+ page_title="🐱 Neko Neko Company AI Chat 🐱",
10
+ page_icon="🐱",
11
+ layout="wide"
12
+ )
13
+
14
+ # Swarmクライアントの初期化
15
+ client = Swarm()
16
+
17
+ # セッション状態の初期化
18
+ if 'messages' not in st.session_state:
19
+ st.session_state['messages'] = []
20
+ if 'api_key' not in st.session_state:
21
+ st.session_state['api_key'] = os.getenv("OPENAI_API_KEY", "")
22
+ if 'context_variables' not in st.session_state:
23
+ st.session_state['context_variables'] = {
24
+ "company_context": """neko neko company 会社概要:
25
+
26
+ 設立: 2024年
27
+ 従業員数: 50名
28
+ 事業内容: AIソリューション開発、システムインテグレーション
29
+
30
+ 主要メンバー:
31
+ 1. 代表取締役社長 猫山太郎
32
+ - 元IT企業CTO
33
+ - 経営戦略のスペシャリスト
34
+
35
+ 2. 事業部長 猫田次郎
36
+ - プロジェクトマネジメントの達人
37
+ - 複数の大規模プロジェクト成功実績
38
+
39
+ 3. デザイン部長 三毛猫美咲
40
+ - 国際的なデザイン賞受賞
41
+ - UI/UXデザインの第一人者
42
+
43
+ 4. 技術部長 シャム猫健一
44
+ - AIアーキテクト
45
+ - オープンソースコミッティメンバー
46
+
47
+ 5. 人事部長 黒猫和子
48
+ - 組織開発のエキスパート
49
+ - 従業員満足度向上のスペシャリスト
50
+ """}
51
+
52
+ # サイドバーの設定
53
+ with st.sidebar:
54
+ st.image("https://raw.githubusercontent.com/Sunwood-ai-labs/swarm-neko-neko-company/refs/heads/main/docs/swarm-neko-neko-company.png", use_column_width=True)
55
+ st.title("🐱 Neko Neko Company")
56
+
57
+ # API Key設定セクション
58
+ st.markdown("### ⚙️ API設定")
59
+ api_key = st.text_input("OpenAI API Key", value=os.getenv("OPENAI_API_KEY", ""), type="password")
60
+ if api_key:
61
+ os.environ["OPENAI_API_KEY"] = api_key
62
+ st.success("✅ API Keyが設定されました!")
63
+
64
+ st.markdown("---")
65
+ st.markdown("""
66
+ ### 社内AI支援システム
67
+
68
+ 各部署のAIエージェントが、あなたの質問やリクエストに応答します。
69
+
70
+ #### 🌟 主なエージェント
71
+ - 👋 受付 みけこ
72
+ - 👔 社長 にゃんたろう
73
+ - 📊 事業部長 もふすけ
74
+ - 🎨 デザイン部長 ぷりん
75
+ - 💻 技術部長 たま
76
+ - 🔧 主任エンジニア ごまちゃん
77
+ - 👥 人事部長 ふわり
78
+ """)
79
+
80
+ if st.button("チャットをクリア"):
81
+ st.session_state['messages'] = []
82
+ st.rerun()
83
+
84
+ # メインコンテンツ
85
+ st.title("🐱 Neko Neko Company AI Chat System")
86
+
87
+ # チャット履歴の表示
88
+ for message in st.session_state['messages']:
89
+ with st.chat_message(message["role"], avatar=message.get("avatar")):
90
+ st.write(f"**{message.get('name', 'User')}**: {message['content']}")
91
+
92
+ # ユーザー入力
93
+ if prompt := st.chat_input("メッセージを入力してください..."):
94
+ # ユーザーメッセージの追加
95
+ st.session_state['messages'].append({
96
+ "role": "user",
97
+ "content": prompt,
98
+ "name": "User"
99
+ })
100
+
101
+ with st.chat_message("user"):
102
+ st.write(f"**User**: {prompt}")
103
+
104
+ try:
105
+ # Swarmを使用してエージェントの応答を取得
106
+ messages = [{"role": "user", "content": prompt}]
107
+
108
+ # メッセージプレースホルダーの作成
109
+ with st.chat_message("assistant", avatar="🐱"):
110
+ message_placeholder = st.empty()
111
+ message_placeholder.markdown("🤔 考え中...")
112
+
113
+ # 非ストリーミングモードで実行
114
+ response = client.run(
115
+ agent=triage_agent,
116
+ messages=messages,
117
+ context_variables=st.session_state['context_variables'],
118
+ stream=False
119
+ )
120
+
121
+ # レスポンスからメッセージを取得
122
+ if response and response.messages:
123
+ # 最後のメッセージを取得
124
+ last_message = response.messages[-1]
125
+ full_response = last_message["content"]
126
+ current_agent_name = last_message.get("sender", triage_agent.name)
127
+ message_placeholder.markdown(f"**{current_agent_name}**: {full_response} 🐱")
128
+
129
+ # 全てのエージェントの応答を保存
130
+ if response and response.messages:
131
+ for msg in response.messages:
132
+ if msg["role"] == "assistant":
133
+ st.session_state['messages'].append({
134
+ "role": "assistant",
135
+ "content": msg["content"],
136
+ "name": msg.get("sender", triage_agent.name),
137
+ "avatar": "🐱"
138
+ })
139
+
140
+ except Exception as e:
141
+ st.error(f"エラーが発生しました: {str(e)}")
142
+
143
+ # フッター
144
+ st.markdown("---")
145
+ st.markdown("© 2024 Neko Neko Company. All rights reserved. 🐱")
docs/README.en.md CHANGED
@@ -16,7 +16,11 @@
16
  </p>
17
 
18
  <h2 align="center">
19
- ~ AI-Powered Corporate Management System ~
 
 
 
 
20
  </h2>
21
 
22
  <p align="center">
@@ -29,35 +33,65 @@
29
 
30
  ## 🚀 Project Overview
31
 
32
- neko neko company AI Agents is an innovative AI agent system utilizing the Swarm framework. AI agents representing each department collaborate to support efficient corporate management.
 
 
 
 
33
 
34
  ## ✨ Main Features
35
 
36
  1. **Intelligent Reception System**:
37
- - Accurate request routing by Hanako Sato AI.
38
- - Smart inter-departmental collaboration.
39
 
40
- 2. **Specialized AI Agents**:
41
- - Management Support (Taro Nekoyama AI)
42
- - Project Management (Jiro Nekoda AI)
43
- - Design Supervision (Misaki Mikeneko AI)
44
- - Technical Support (Kenichi Siamneko AI)
45
- - Human Resources Management (Wako Kuroneko AI)
 
46
 
47
-
48
- ## 🏢 Organizational Structure
49
 
50
  ```mermaid
51
- graph TD
52
- A[CEO<br>Taro Nekoyama] --> B[Business Manager<br>Jiro Nekoda]
53
- A --> C[Design Manager<br>Misaki Mikeneko]
54
- A --> D[Technical Manager<br>Kenichi Siamneko]
55
- A --> E[HR Manager<br>Wako Kuroneko]
56
- F[Reception<br>Hanako Sato] --> A
57
- F --> B
58
- F --> C
59
- F --> D
60
- F --> E
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  ```
62
 
63
  ## 📦 Installation
@@ -76,8 +110,8 @@ pip install -r requirements.txt
76
  ## 🚀 Usage
77
 
78
  1. Set environment variables:
79
- - Copy `.env.example` and create `.env`.
80
- - Set the necessary tokens.
81
 
82
  2. Start the system:
83
  ```bash
@@ -91,42 +125,52 @@ streamlit run app.py
91
 
92
  ## 💼 Agent Details
93
 
94
- ### 👩‍💼 Receptionist: Hanako Sato
95
  - Role: Request routing
96
- - Characteristics: Accurate judgment and quick response
97
- - Functionality: Optimal transfer to each department
98
 
99
- ### 👨‍💼 CEO: Taro Nekoyama
100
  - Role: Management strategy, important decisions
101
- - Characteristics: Former CTO of an IT company, management specialist
102
- - Functionality: Strategic decision-making, escalation to humans
 
103
 
104
- ### 👨‍💼 Business Manager: Jiro Nekoda
105
- - Role: Project management, inter-departmental coordination
106
- - Characteristics: Project management expert
107
- - Functionality: Project management, inter-departmental coordination
 
108
 
109
- ### 👩‍🎨 Design Manager: Misaki Mikeneko
110
  - Role: UI/UX design, branding
111
- - Characteristics: Winner of international design awards
112
- - Functionality: Design review, guideline creation
113
-
114
- ### 👨‍💻 Technical Manager: Kenichi Siamneko
115
- - Role: System development, technical support
116
- - Characteristics: AI architect, OSS contributor
117
- - Functionality: Code review, technical problem solving
118
-
119
- ### 👩‍💼 HR Manager: Wako Kuroneko
 
 
 
 
 
 
 
 
120
  - Role: Recruitment, labor management
121
- - Characteristics: Organizational development expert
122
- - Functionality: Recruitment management, employee relations management
123
-
124
 
125
  ## 🛠️ Tech Stack
126
 
127
  - **Framework**: Swarm
128
  - **Frontend**: Streamlit
129
- - **Key Libraries**:
130
  - aira
131
  - sourcesage
132
  - openai
@@ -138,17 +182,17 @@ streamlit run app.py
138
 
139
  ```plaintext
140
  ├─ configs/
141
- │ ├─ agents.py # Agent definitions
142
- │ ├─ tools.py # Tool functions
143
  ├─ app.py # Streamlit app
144
  ├─ main.py # Main script
145
- ├─ README.md
146
  └─ requirements.txt
147
  ```
148
 
149
  ## 🤝 Contributions
150
 
151
- Contributions to the project are welcome. We encourage bug reports, feature additions, documentation improvements, and any other form of contribution.
152
 
153
  ## 📄 License
154
 
@@ -156,5 +200,5 @@ This project is licensed under the MIT License.
156
 
157
  ---
158
 
159
- 🐱 Let's achieve more efficient and smart corporate management with neko neko company AI Agents!
160
  ```
 
16
  </p>
17
 
18
  <h2 align="center">
19
+ A wonderfully amazing AI-Powered Corporate Management System ~
20
+
21
+ <a href="https://github.com/Sunwood-ai-labs/swarm-neko-neko-company/blob/main/README.md"><img src="https://img.shields.io/badge/ドキュメント-日本語-white.svg" alt="JA doc"/></a>
22
+ <a href="https://github.com/Sunwood-ai-labs/swarm-neko-neko-company/blob/main/docs/README.en.md"><img src="https://img.shields.io/badge/english-document-white.svg" alt="EN doc"></a>
23
+
24
  </h2>
25
 
26
  <p align="center">
 
33
 
34
  ## 🚀 Project Overview
35
 
36
+ neko neko company AI Agents is an innovative AI agent system utilizing the Swarm framework. Cute cat-themed AI agents cooperate in their respective areas of expertise to support efficient corporate management. They're incredibly reliable allies!
37
+
38
+ ## 🎥 Demo Video
39
+
40
+ https://github.com/user-attachments/assets/0f12fce0-214e-42a6-bdba-c19a7bfc3f07
41
 
42
  ## ✨ Main Features
43
 
44
  1. **Intelligent Reception System**:
45
+ - Accurate request routing by Mikeko AI
46
+ - Smart inter-departmental collaboration
47
 
48
+ 2. **Specialized Cat-Eared AI Agents**:
49
+ - Management decision support (Nyantaro AI)
50
+ - Project management (Mofusuke AI)
51
+ - Design supervision (Purin AI)
52
+ - Technology strategy (Tama AI)
53
+ - System development (Gomachan AI)
54
+ - Human resource management (Fuwari AI)
55
 
56
+ ## 🏢 neko neko company AI Organizational Structure
 
57
 
58
  ```mermaid
59
+ %%{init: {'theme':'base'}}%%
60
+ graph LR
61
+ A[CEO<br>Nyantaro] -->|transfer_to_director| B[Director<br>Mofusuke]
62
+ A -->|transfer_to_designer| C[Design Director<br>Purin]
63
+ A -->|transfer_to_tech_lead| D[Tech Director<br>Tama]
64
+ A -->|transfer_to_hr| E[HR Director<br>Fuwari]
65
+ A -->|transfer_to_engineer| F[Lead Engineer<br>Gomachan]
66
+ G[Reception<br>Mikeko] -->|transfer_to_ceo| A
67
+ G -->|transfer_to_director| B
68
+ G -->|transfer_to_designer| C
69
+ G -->|transfer_to_tech_lead| D
70
+ G -->|transfer_to_hr| E
71
+ G -->|transfer_to_engineer| F
72
+
73
+ %% 各エージェントの実行関数と成果
74
+ A -->|make_strategic_decision| S[Management Decisions]
75
+ A -->|escalate_to_human| H[Escalation to Human]
76
+
77
+ B -->|manage_project| P[Project Planning]
78
+ B -->|coordinate_departments| CD[Departmental Coordination]
79
+
80
+ C -->|review_design| RD[Design Review]
81
+ C -->|create_design_guidelines| DG[Design Guidelines]
82
+
83
+ D -->|review_code| RC[Code Review]
84
+ D -->|solve_technical_issues| TI[Technical Issue Resolution]
85
+
86
+ F -->|write_code| WC[Code]
87
+ F -->|debug_code| DC[Bug Fixing]
88
+
89
+ E -->|handle_reception| R[Recruitment]
90
+ E -->|manage_employee_relations| ER[Employee Relations Management]
91
+
92
+ %% 成果物のスタイル
93
+ classDef result fill:#e1f5fe,stroke:#01579b,stroke-width:2px
94
+ class S,H,P,CD,RD,DG,RC,TI,WC,DC,R,ER result
95
  ```
96
 
97
  ## 📦 Installation
 
110
  ## 🚀 Usage
111
 
112
  1. Set environment variables:
113
+ - Copy `.env.example` and create `.env`
114
+ - Set the necessary tokens
115
 
116
  2. Start the system:
117
  ```bash
 
125
 
126
  ## 💼 Agent Details
127
 
128
+ ### 🐱 Receptionist Mikeko
129
  - Role: Request routing
130
+ - Characteristics: Smart and kind calico cat, excellent judgment
131
+ - Functions: Optimal transfer and coordination to each department
132
 
133
+ ### 😺 CEO Nyantaro
134
  - Role: Management strategy, important decisions
135
+ - Characteristics: Former IT company CTO, management specialist
136
+ - Catchphrase: "Important decision, nya!"
137
+ - Functions: Strategic decision-making, escalation to humans
138
 
139
+ ### 😸 Director Mofusuke
140
+ - Role: Project management, department coordination
141
+ - Characteristics: Fluffy long-haired cat, project management expert
142
+ - Catchphrase: "Schedule management is perfect, nya!"
143
+ - Functions: Project management, inter-departmental coordination
144
 
145
+ ### 😺 Design Director Purin
146
  - Role: UI/UX design, branding
147
+ - Characteristics: Cute brown tabby cat, excellent sense
148
+ - Catchphrase: "Lovely design, nya~♪"
149
+ - Functions: Design review, guideline creation
150
+
151
+ ### 🐱 Tech Director Tama
152
+ - Role: System architecture design, technology strategy
153
+ - Characteristics: Cool white cat, technology expert
154
+ - Catchphrase: "Architecture design, nya!"
155
+ - Functions: Technology strategy planning, quality control
156
+
157
+ ### 😺 Lead Engineer Gomachan
158
+ - Role: System development, implementation
159
+ - Characteristics: Black cat, coding genius
160
+ - Catchphrase: "Fixing bugs, nya~!"
161
+ - Functions: Coding, debugging, unit test creation
162
+
163
+ ### 😽 HR Director Fuwari
164
  - Role: Recruitment, labor management
165
+ - Characteristics: Kind Persian cat, soothing
166
+ - Catchphrase: "Making everyone happy, nya♪"
167
+ - Functions: Recruitment management, employee relations management
168
 
169
  ## 🛠️ Tech Stack
170
 
171
  - **Framework**: Swarm
172
  - **Frontend**: Streamlit
173
+ - **Main Libraries**:
174
  - aira
175
  - sourcesage
176
  - openai
 
182
 
183
  ```plaintext
184
  ├─ configs/
185
+ │ ├─ agents.py # The incredibly clever agents
186
+ │ ├─ tools.py # Useful tools
187
  ├─ app.py # Streamlit app
188
  ├─ main.py # Main script
189
+ ├─ README.md # This file
190
  └─ requirements.txt
191
  ```
192
 
193
  ## 🤝 Contributions
194
 
195
+ Contributions to the project are welcome! We look forward to contributions of all kinds, including bug reports, feature additions, and documentation improvements. We eagerly await your wonderfully amazing ideas!
196
 
197
  ## 📄 License
198
 
 
200
 
201
  ---
202
 
203
+ 🐱 Let's achieve more efficient and smart corporate management with neko neko company AI Agents! Nya♪
204
  ```