Skip to content

Commit d3e61dd

Browse files
Release 0.0.12 (#125)
* update * update * update
1 parent e0ef935 commit d3e61dd

16 files changed

+290
-145
lines changed

eng/MetaInfo.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<VersionPrefix>0.0.11</VersionPrefix>
4+
<VersionPrefix>0.0.12</VersionPrefix>
55
<Authors>LittleLittleCloud</Authors>
66
<RepositoryType>git</RepositoryType>
77
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>

src/StepWise.Core/Step.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ public override string ToString()
407407
{
408408
if (this.Step is null && this.StepRunType == StepRunType.Variable)
409409
{
410-
return $"{_result!.Name}[{_result!.Generation}]";
410+
return $"{_result!.Name}[{_result!.Generation}]:{_result!.Value}";
411411
}
412412

413413
// format [gen] stepName([gen]input1, [gen]input2, ...)

src/StepWise.Core/StepWiseEngine.cs

+6
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ private async Task ExecuteSingleStepAsync(
267267

268268
_stepRunQueue.Add(variable);
269269
}
270+
271+
// TODO
272+
// maybe we should support the scenario when the res is null
273+
// in this case, we should do the following:
274+
// - clear the existing value in the context
275+
// - add all the steps that depend on the value to the task queue again
270276
}
271277
catch (InvalidOperationException ioe) when (ioe.Message.Contains("The collection has been marked as complete with regards to additions"))
272278
{

stepwise-studio/components/chat-controlbar.tsx

+31-17
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "./chat-history";
1111
import { useStepwiseServerConfiguration } from "@/hooks/useVersion";
1212
import { useAuth0 } from "@auth0/auth0-react";
13-
import { LLMSelector, useLLMSelectorStore } from "./llm-selector";
13+
import { LLMSelector, OpenAI_LLM, useLLMSelectorStore } from "./llm-selector";
1414
import { useOpenAIConfiguration } from "./openai-configure-card";
1515
import OpenAI from "openai";
1616
import Image from "next/image";
@@ -41,13 +41,8 @@ export const ChatControlBar: React.FC = () => {
4141
const message = useChatBoxStore((state) => state.message);
4242
const chatHistory = useChatHistoryStore((state) => state.messages);
4343
const selectedLLM = useLLMSelectorStore((state) => state.selectedLLM);
44-
const claudeLLMs = useClaudeConfiguration((state) => state.LLMTypes);
45-
const openaiLLMs = useOpenAIConfiguration((state) => state.LLMTypes);
46-
const openAIApiKey = useOpenAIConfiguration((state) => state.apiKey);
47-
const claudeApiKey = useClaudeConfiguration((state) => state.apiKey);
4844
const setMessage = useChatBoxStore((state) => state.setMessage);
4945
const addMessage = useChatHistoryStore((state) => state.addMessage);
50-
const deleteMessage = useChatHistoryStore((state) => state.deleteMessage);
5146
const configuration = useStepwiseServerConfiguration();
5247
const [busy, setBusy] = React.useState(false);
5348
const { user } = useAuth0();
@@ -68,6 +63,11 @@ export const ChatControlBar: React.FC = () => {
6863
stepRunHistory: StepRunDTO[],
6964
chatHistory: ChatMessageContent[],
7065
) => {
66+
if (selectedLLM === undefined) {
67+
toast.error("Please select a language model");
68+
return;
69+
}
70+
7171
if (message !== "") {
7272
let userMessage: ChatMessage;
7373
if (configuration?.enableAuth0Authentication) {
@@ -106,6 +106,8 @@ You are a helpful workflow assistant. Your name is ${llmName}.
106106
107107
You are currently assisting user with the workflow ${workflow.name}. You can either invoke the workflow or provide assistance with the steps in the workflow.
108108
109+
When invoking a step in workflow, you don't need to consider whether it's pre-requisite steps are executed or not. The workflow engine will take care of it. So you can directly invoke the step.
110+
109111
Each workflow is associated with a context which contains the intermediate results of the workflow execution.
110112
111113
## current context:
@@ -116,12 +118,17 @@ ${
116118
.map((v) => `${v.result?.name}: ${v.result?.displayValue}`)
117119
.join("\n")
118120
}
121+
122+
You don't need to provide the arguments if they are already available in the context. You can override the context variables by providing the arguments explicitly.
119123
`;
120124

121125
const steps = workflow.steps;
122-
if (openaiLLMs.find((f) => f === selectedLLM) && openAIApiKey) {
126+
if (
127+
selectedLLM?.type === "OpenAI" &&
128+
(selectedLLM as OpenAI_LLM).apiKey
129+
) {
123130
const openAIClient = new OpenAI({
124-
apiKey: openAIApiKey,
131+
apiKey: (selectedLLM as OpenAI_LLM).apiKey,
125132
dangerouslyAllowBrowser: true,
126133
});
127134

@@ -147,7 +154,7 @@ ${
147154
id: msg.id,
148155
function: {
149156
name: msg.name,
150-
arguments: msg.arguments,
157+
arguments: msg.argument,
151158
} as ChatCompletionMessageToolCall.Function,
152159
},
153160
] as ChatCompletionMessageToolCall[],
@@ -175,7 +182,8 @@ ${
175182
"Number",
176183
"Boolean",
177184
"String[]",
178-
"Integer",
185+
"Int32",
186+
"Int64",
179187
"Float",
180188
"Double",
181189
];
@@ -187,6 +195,8 @@ ${
187195
Boolean: "boolean",
188196
"String[]": "array",
189197
Integer: "integer",
198+
Int32: "integer",
199+
Int64: "integer",
190200
Float: "number",
191201
Double: "number",
192202
};
@@ -198,6 +208,8 @@ ${
198208
Boolean: undefined,
199209
"String[]": "string",
200210
Integer: undefined,
211+
Int32: undefined,
212+
Int64: undefined,
201213
Float: undefined,
202214
Double: undefined,
203215
};
@@ -242,7 +254,7 @@ ${
242254
const chatCompletion =
243255
await openAIClient.chat.completions.create({
244256
messages: [systemMessage, ...openAIChatHistory],
245-
model: selectedLLM as ChatModel,
257+
model: (selectedLLM as OpenAI_LLM).modelId,
246258
tool_choice: "auto",
247259
tools: tools,
248260
parallel_tool_calls: false,
@@ -296,11 +308,13 @@ ${
296308
})
297309
.filter((v) => v !== undefined);
298310

311+
console.log(argumentsArray);
312+
299313
// merge the arguments with the context variables
300-
// remove the context variables that are overriden by the arguments
301-
const mergedVariables = argumentsArray.filter(
314+
// and override the context variables with the arguments
315+
const mergedVariables = contextVariables.filter(
302316
(v) =>
303-
!contextVariables.find(
317+
!argumentsArray.find(
304318
(a) => a.result?.name === v.result?.name,
305319
),
306320
);
@@ -309,15 +323,15 @@ ${
309323
type: "tool",
310324
id: tool.id,
311325
name: toolName,
312-
arguments: argumentJson,
326+
argument: argumentJson,
313327
displayValue: "",
314328
values: [],
315329
isExecuting: true,
316330
};
317331
addMessage(toolMessage);
318332
const newStepRunHistory = await executeStep(step, [
319-
...contextVariables,
320333
...mergedVariables,
334+
...argumentsArray,
321335
]);
322336

323337
if (newStepRunHistory.length > 0) {
@@ -452,7 +466,7 @@ ${
452466
chatHistory,
453467
)
454468
}
455-
disabled={busy || message === ""}
469+
disabled={busy || message === "" || selectedLLM === undefined}
456470
tooltip="Send message (Ctrl + Enter)"
457471
>
458472
<SendHorizonal />

stepwise-studio/components/chat-history.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface ChatTool {
3333
type: "tool";
3434
id?: string;
3535
name: string;
36-
arguments: string;
36+
argument: string;
3737
displayValue: string;
3838
values?: VariableDTO[];
3939
isExecuting: boolean; // whether the tool is currently executing
@@ -138,6 +138,7 @@ export const ChatToolCard: React.FC<ChatTool> = ({
138138
displayValue,
139139
values,
140140
isExecuting,
141+
argument,
141142
}) => {
142143
const [collapsed, setCollapsed] = React.useState(true);
143144
const [executing, setExecuting] = React.useState(isExecuting);
@@ -166,6 +167,7 @@ export const ChatToolCard: React.FC<ChatTool> = ({
166167
</div>
167168
{!collapsed && values && (
168169
<div className="flex flex-col justify-between bg-accent p-2 rounded-lg overflow-x-auto">
170+
<Markdown>{argument}</Markdown>
169171
{values.map((value, index) => (
170172
<VariableCard key={index} variable={value} />
171173
))}

stepwise-studio/components/claude-configure-card.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ export const useClaudeConfiguration = create<ClaudeConfigurationState>(
2828
(set, get) => ({
2929
apiKey: undefined,
3030
setApiKey: (apiKey: string) => {
31-
get().LLMTypes.forEach((llm) => {
32-
useLLMSelectorStore.getState().addLLM(llm);
33-
});
3431
set({ apiKey });
3532
},
3633
readApiKeyFromStorage: () => {
@@ -48,9 +45,6 @@ export const useClaudeConfiguration = create<ClaudeConfigurationState>(
4845
}
4946
},
5047
clearApiKey: () => {
51-
get().LLMTypes.forEach((llm) => {
52-
useLLMSelectorStore.getState().deleteLLM(llm);
53-
});
5448
set({ apiKey: undefined });
5549
},
5650
LLMTypes: [

stepwise-studio/components/control-bar.tsx

+34-36
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// | <autolayout> | <run> | <clean> | <max_parallel>: <input> | <max_steps>: <input> |
66

77
import { ChangeEvent, FC, useEffect, useState } from "react";
8-
import { buttonVariants } from "./ui/button";
8+
import { Button, buttonVariants } from "./ui/button";
99
import { cn } from "@/lib/utils";
1010
import {
1111
GithubIcon,
@@ -50,13 +50,10 @@ export const ControlBar: FC<ControlBarProps> = (props) => {
5050
<div className="flex flex-wrap justify-between items-center gap-2 px-2 p-1 bg-background shadow-xl rounded-md">
5151
<div className="flex items-center gap-1">
5252
{isMobile && <SidebarTrigger />}
53-
<button
54-
className={cn(
55-
buttonVariants({
56-
variant: isRunning ? "disabled" : "ghost",
57-
size: "tinyIcon",
58-
}),
59-
)}
53+
<Button
54+
variant={isRunning ? "disabled" : "ghost"}
55+
size="tinyIcon"
56+
tooltip="Run all steps"
6057
onClick={() => {
6158
if (!isRunning) {
6259
props.onRunClick();
@@ -68,41 +65,42 @@ export const ControlBar: FC<ControlBarProps> = (props) => {
6865
) : (
6966
<Play size={iconSize} />
7067
)}
71-
</button>
72-
<button
73-
className={cn(
74-
buttonVariants({
75-
variant: "ghost",
76-
size: "tinyIcon",
77-
}),
78-
)}
68+
</Button>
69+
<Button
70+
variant={isRunning ? "disabled" : "ghost"}
71+
size="tinyIcon"
72+
tooltip="Reset all step run results"
7973
onClick={props.onResetStepRunResultClick}
8074
>
8175
<RotateCcw size={iconSize} />
82-
</button>
83-
<button
84-
className={cn(
85-
buttonVariants({
86-
variant: "ghost",
87-
size: "tinyIcon",
88-
}),
89-
)}
76+
</Button>
77+
<Button
78+
variant={isRunning ? "disabled" : "ghost"}
79+
size="tinyIcon"
9080
onClick={props.onAutoLayoutClick}
81+
tooltip="Auto layout"
9182
>
9283
<LayoutGrid size={iconSize} />
93-
</button>
94-
<Link
95-
href={"https://github.com/LittleLittleCloud/StepWise"}
96-
className={cn(
97-
buttonVariants({
98-
variant: "ghost",
99-
size: "tinyIcon",
100-
}),
101-
)}
102-
target="_blank"
84+
</Button>
85+
<Button
86+
variant="link"
87+
size="tinyIcon"
88+
tooltip="Github"
89+
onClick={() => {}}
10390
>
104-
<GithubIcon size={iconSize} />
105-
</Link>
91+
<Link
92+
href={"https://github.com/LittleLittleCloud/StepWise"}
93+
className={cn(
94+
buttonVariants({
95+
variant: "ghost",
96+
size: "tinyIcon",
97+
}),
98+
)}
99+
target="_blank"
100+
>
101+
<GithubIcon size={iconSize} />
102+
</Link>
103+
</Button>
106104
</div>
107105
{/* vertical divider */}
108106
<div className="h-6 w-0.5 bg-accent/50" />
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import { ClaudeConfigCard } from "./claude-configure-card";
2+
import { useLLMSelectorStore } from "./llm-selector";
23
import { OpenAIConfigCard } from "./openai-configure-card";
34

45
export const LLMConfiguration: React.FC = () => {
6+
const availableLLMs = useLLMSelectorStore((state) => state.availableLLMs);
57
return (
68
<div className="flex flex-wrap p-10 gap-10 overflow-y-auto">
79
<OpenAIConfigCard />
10+
{availableLLMs.map((llm) => {
11+
if (llm.type === "AOAI") {
12+
return <ClaudeConfigCard key={llm.name} />;
13+
}
14+
})}
815
</div>
916
);
1017
};

0 commit comments

Comments
 (0)