Skip to content

Commit 4fc8bf8

Browse files
Merge pull request #56 from aws-samples/tool-init-error
カスタムエージェント新規登録に初期状態のツールが設定できない問題を修正
2 parents 68c0bca + 0f16a91 commit 4fc8bf8

File tree

6 files changed

+48
-10
lines changed

6 files changed

+48
-10
lines changed

.vscode/settings.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@
99
"editor.defaultFormatter": "esbenp.prettier-vscode"
1010
},
1111
"CodeGPT.apiKey": "CodeGPT Plus Beta",
12-
"CodeGPT.Autocomplete.enabled": true
12+
"CodeGPT.Autocomplete.enabled": true,
13+
"i18n-ally.localesPaths": [
14+
"src/renderer/src/i18n",
15+
"src/renderer/src/i18n/locales"
16+
]
1317
}

README-ja.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Bedrock Engineer はネイティブアプリです。アプリをダウンロー
1919

2020
MacOS:
2121

22-
[<img src="https://img.shields.io/badge/Download_FOR_MAC-Latest%20Release-blue?style=for-the-badge&logo=apple" alt="Download Latest Release" height="40">](https://github.com/aws-samples/bedrock-engineer/releases/latest/download/bedrock-engineer-1.7.0.dmg)
22+
[<img src="https://img.shields.io/badge/Download_FOR_MAC-Latest%20Release-blue?style=for-the-badge&logo=apple" alt="Download Latest Release" height="40">](https://github.com/aws-samples/bedrock-engineer/releases/latest/download/bedrock-engineer-1.7.1.dmg)
2323

2424
MacOS に最適化されていますが、Windows, Linux OS でもビルドして使用できます。不具合があるばあい、issue に起票ください。
2525

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Bedrock Engineer is a native app, you can download the app or build the source c
1919

2020
MacOS:
2121

22-
[<img src="https://img.shields.io/badge/Download_FOR_MAC-Latest%20Release-blue?style=for-the-badge&logo=apple" alt="Download Latest Release" height="40">](https://github.com/aws-samples/bedrock-engineer/releases/latest/download/bedrock-engineer-1.7.0.dmg)
22+
[<img src="https://img.shields.io/badge/Download_FOR_MAC-Latest%20Release-blue?style=for-the-badge&logo=apple" alt="Download Latest Release" height="40">](https://github.com/aws-samples/bedrock-engineer/releases/latest/download/bedrock-engineer-1.7.1.dmg)
2323

2424
It is optimized for MacOS, but can also be built and used on Windows and Linux OS. If you have any problems, please report an issue.
2525

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bedrock-engineer",
3-
"version": "1.7.0",
3+
"version": "1.7.1",
44
"description": "Autonomous software development agent apps using Amazon Bedrock, capable of customize to create/edit files, execute commands, search the web, use knowledge base, use multi-agents, generative images and more.",
55
"main": "./out/main/index.js",
66
"homepage": "https://github.com/daisuke-awaji/bedrock-engineer",

src/renderer/src/constants/defaultToolSets.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const getToolsForCategory = (category: string, allTools: ToolState[]): To
152152
const currentRegion = awsConfig?.region || ''
153153

154154
// カテゴリに基づいてツール設定を生成
155-
return allTools.map((tool) => {
155+
const result = allTools.map((tool) => {
156156
const toolName = tool.toolSpec?.name
157157
if (!toolName) return { ...tool, enabled: false }
158158

@@ -167,9 +167,14 @@ export const getToolsForCategory = (category: string, allTools: ToolState[]): To
167167
}
168168
}
169169

170+
// このツールがカテゴリに含まれるかどうか
171+
const isEnabled = categoryNames.includes(toolName)
172+
170173
return {
171174
...tool,
172-
enabled: categoryNames.includes(toolName)
175+
enabled: isEnabled
173176
}
174177
})
178+
179+
return result
175180
}

src/renderer/src/pages/ChatPage/components/AgentForm/useAgentForm.ts

+33-4
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,18 @@ export const useAgentForm = (initialAgent?: CustomAgent, onSave?: (agent: Custom
238238
async (tabId: AgentFormTabId) => {
239239
setActiveTab(tabId)
240240

241-
// ツールタブへの切り替え時にMCPツールを取得
241+
// ツールタブへの切り替え時
242242
if (tabId === 'tools') {
243243
console.log(
244244
'Switching to tools tab, fetching MCP tools with current servers:',
245245
formData.mcpServers?.length || 0
246246
)
247+
248+
// MCPツールを取得
247249
await fetchMcpTools(formData.mcpServers)
248250
}
249251
},
250-
[fetchMcpTools, formData.mcpServers]
252+
[fetchMcpTools, formData.mcpServers, formData.tools, agentTools, updateField]
251253
)
252254

253255
// サーバー設定変更時にツールをクリア
@@ -293,14 +295,41 @@ export const useAgentForm = (initialAgent?: CustomAgent, onSave?: (agent: Custom
293295
(e: React.FormEvent) => {
294296
e.preventDefault()
295297
console.log('Form submitted with data:', formData)
296-
if (onSave) {
298+
console.log(
299+
'ツール情報:',
300+
formData.tools ? `${formData.tools.length}件` : '未設定',
301+
formData.tools
302+
)
303+
304+
if (formData.tools && formData.tools.length === 0) {
305+
console.warn('警告: ツールが設定されていません')
306+
// ここで対処: ツールが設定されていない場合はデフォルトツール設定を適用
307+
const defaultTools = getDefaultToolsForCategory('all')
308+
const defaultToolNames = defaultTools
309+
.filter((tool) => tool.enabled)
310+
.map((tool) => tool.toolSpec?.name as ToolName)
311+
.filter(Boolean)
312+
313+
// formDataを更新
314+
const updatedFormData = {
315+
...formData,
316+
tools: defaultToolNames
317+
}
318+
319+
console.log('デフォルトツールを適用:', updatedFormData.tools)
320+
321+
if (onSave) {
322+
console.log('修正したフォームデータで保存')
323+
onSave(updatedFormData)
324+
}
325+
} else if (onSave) {
297326
console.log('Calling onSave callback')
298327
onSave(formData)
299328
} else {
300329
console.warn('onSave callback is not provided')
301330
}
302331
},
303-
[formData, onSave]
332+
[formData, onSave, getDefaultToolsForCategory]
304333
)
305334

306335
return {

0 commit comments

Comments
 (0)