Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ export class ApiClient implements IApiClient {
if (metadata.personality_id) {
form.append("personality_id", metadata.personality_id);
}
if (metadata.template !== undefined) {
form.append("template", String(metadata.template));
}

const url = `${this.baseUrl}${ENDPOINTS.uploadCapability}`;

Expand Down Expand Up @@ -438,9 +441,7 @@ export class ApiClient implements IApiClient {
// Uses multipart/form-data — JSON is rejected
const form = new FormData();
form.append("personality_id", personalityId);
for (const capId of capabilityIds) {
form.append("matching_capabilities", String(capId));
}
form.append("matching_capabilities", capabilityIds.join(","));
return this.request<AssignCapabilitiesResponse>(
ENDPOINTS.editPersonality,
{ method: "PUT", body: form },
Expand Down
1 change: 1 addition & 0 deletions src/api/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface UploadAbilityMetadata {
category: AbilityCategory;
matching_hotwords: string[];
personality_id?: string;
template?: number;
}

export interface UploadAbilityResponse {
Expand Down
5 changes: 5 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ program
)
.option("--json", "Output machine-readable JSON")
.option("--mock", "Use mock API client (no real network calls)")
.option(
"--template <id>",
"Template ID to associate with the ability (workaround for cloud router — see issue #14)",
)
.action(
async (
path: string | undefined,
Expand All @@ -314,6 +318,7 @@ program
triggers?: string;
timeout?: string;
json?: boolean;
template?: string;
},
) => {
await deployCommand(path, opts);
Expand Down
6 changes: 6 additions & 0 deletions src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export async function deployCommand(
triggers?: string;
json?: boolean;
timeout?: string; // seconds as string from commander
template?: string;
} = {},
): Promise<void> {
if (!opts.json) p.intro("🚀 Upload Ability");
Expand Down Expand Up @@ -218,12 +219,17 @@ export async function deployCommand(

const personalityId = opts.personality ?? getConfig().default_personality_id;

const templateId = opts.template ? parseInt(opts.template, 10) : undefined;

const metadata: UploadAbilityMetadata = {
name,
description,
category,
matching_hotwords: hotwords,
personality_id: personalityId,
...(templateId !== undefined && !Number.isNaN(templateId)
? { template: templateId }
: {}),
};

let zipBuffer: Buffer;
Expand Down