Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc24ede5

Browse files
kylecarbsjohnstcn
authored andcommitted
Add more tools
1 parent579a8ec commitc24ede5

File tree

2 files changed

+210
-103
lines changed

2 files changed

+210
-103
lines changed
Lines changed: 85 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import{Meta,StoryObj}from"@storybook/react";
22
import{ChatToolInvocation}from"./ChatToolInvocation";
3-
import{MockWorkspace}from"testHelpers/entities";
3+
import{
4+
MockStartingWorkspace,
5+
MockStoppedWorkspace,
6+
MockStoppingWorkspace,
7+
MockWorkspace,
8+
}from"testHelpers/entities";
49

510
constmeta:Meta<typeofChatToolInvocation>={
611
title:"pages/ChatPage/ChatToolInvocation",
@@ -11,32 +16,93 @@ export default meta;
1116
typeStory=StoryObj<typeofChatToolInvocation>;
1217

1318
exportconstGetWorkspace:Story={
14-
args:{
15-
toolInvocation:{
16-
toolName:"coder_get_workspace",
17-
args:{
19+
render:()=>
20+
renderInvocations(
21+
"coder_get_workspace",
22+
{
1823
id:MockWorkspace.id,
1924
},
20-
result:MockWorkspace,
21-
state:"result",
22-
toolCallId:"some-id",
23-
},
24-
},
25+
MockWorkspace,
26+
),
2527
};
2628

2729
exportconstCreateWorkspace:Story={
28-
args:{
29-
toolInvocation:{
30-
toolName:"coder_create_workspace",
31-
args:{
30+
render:()=>
31+
renderInvocations(
32+
"coder_create_workspace",
33+
{
3234
name:MockWorkspace.name,
3335
rich_parameters:{},
3436
template_version_id:MockWorkspace.template_active_version_id,
3537
user:MockWorkspace.owner_name,
3638
},
37-
result:MockWorkspace,
38-
state:"result",
39-
toolCallId:"some-id",
40-
},
41-
},
39+
MockWorkspace,
40+
),
41+
};
42+
43+
exportconstListWorkspaces:Story={
44+
render:()=>
45+
renderInvocations(
46+
"coder_list_workspaces",
47+
{
48+
owner:"me",
49+
},
50+
[
51+
MockWorkspace,
52+
MockStoppedWorkspace,
53+
MockStoppingWorkspace,
54+
MockStartingWorkspace,
55+
],
56+
),
57+
};
58+
59+
constrenderInvocations=<TextendsChatToolInvocation["toolName"]>(
60+
toolName:T,
61+
args:Extract<ChatToolInvocation,{toolName:T}>["args"],
62+
result:Extract<
63+
ChatToolInvocation,
64+
{toolName:T;state:"result"}
65+
>["result"],
66+
error?:string,
67+
)=>{
68+
return(
69+
<>
70+
<ChatToolInvocation
71+
toolInvocation={{
72+
toolCallId:"call",
73+
toolName,
74+
args:argsasany,
75+
state:"call",
76+
}}
77+
/>
78+
<ChatToolInvocation
79+
toolInvocation={{
80+
toolCallId:"partial-call",
81+
toolName,
82+
args:argsasany,
83+
state:"partial-call",
84+
}}
85+
/>
86+
<ChatToolInvocation
87+
toolInvocation={{
88+
toolCallId:"result",
89+
toolName,
90+
args:argsasany,
91+
state:"result",
92+
result:resultasany,
93+
}}
94+
/>
95+
<ChatToolInvocation
96+
toolInvocation={{
97+
toolCallId:"result",
98+
toolName,
99+
args:argsasany,
100+
state:"result",
101+
result:{
102+
error:error||"Something bad happened!",
103+
},
104+
}}
105+
/>
106+
</>
107+
);
42108
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp