Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(playground): fix computer selection and make baseUrl optional (#1043)

Sarina Liaf04ddfb2b4f
diff --git a/libs/typescript/playground/src/adapters/types.ts b/libs/typescript/playground/src/adapters/types.ts
index 787123d549..a7f11018a8 100644
--- a/libs/typescript/playground/src/adapters/types.ts
+++ b/libs/typescript/playground/src/adapters/types.ts
@@ -97,8 +97,8 @@ export interface ComputerAdapter {
* Returned by the inference adapter based on the selected computer.
*/
export interface InferenceConfig {
- /** Base URL for the agent API */
- baseUrl: string;
+ /** Base URL for the inference API (optional, computer server has default) */
+ baseUrl?: string;
/** Model to use (optional, may be selected by user) */
model?: string;
diff --git a/libs/typescript/playground/src/components/Playground.tsx b/libs/typescript/playground/src/components/Playground.tsx
index 79d4240e63..b141eeef12 100644
--- a/libs/typescript/playground/src/components/Playground.tsx
+++ b/libs/typescript/playground/src/components/Playground.tsx
@@ -75,17 +75,28 @@ function PlaygroundContentInternal({
const vncUrl = currentComputer?.vncUrl;
// Create a draft chat for the empty state UI
- const draftChat = useMemo<Chat>(
- () => ({
+ const draftChat = useMemo<Chat>(() => {
+ const runningComputer = state.computers.find((c) => c.status === 'running');
+ const computerInfo = runningComputer ?? state.computers[0];
+
+ const computer = computerInfo
+ ? {
+ id: computerInfo.id,
+ name: computerInfo.name,
+ url: computerInfo.agentUrl,
+ }
+ : undefined;
+
+ return {
id: 'draft',
name: 'New Chat',
messages: [],
model: defaultModel,
+ computer,
created: new Date(),
updated: new Date(),
- }),
- [defaultModel]
- );
+ };
+ }, [state.computers, defaultModel]);
// Handle creating a new chat and sending the first message
const handleCreateAndSend = async (