chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { useCopilotAction } from "@copilotkit/react-core";
|
||||
|
||||
useCopilotAction({
|
||||
name: "object",
|
||||
parameters: [
|
||||
{
|
||||
name: "arg",
|
||||
type: "object[]",
|
||||
description: "The object argument to display.",
|
||||
attributes: [
|
||||
{
|
||||
name: "x",
|
||||
type: "string",
|
||||
description: "The x attribute.",
|
||||
},
|
||||
{
|
||||
name: "y",
|
||||
type: "number",
|
||||
description: "The y attribute.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
handler: async ({ arg }) => {
|
||||
const x: string = arg[0].x;
|
||||
const y: number = arg[0].y;
|
||||
const z: boolean = arg[0].z;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
import { useCopilotAction } from "@copilotkit/react-core";
|
||||
|
||||
useCopilotAction({
|
||||
name: "enum",
|
||||
parameters: [
|
||||
{
|
||||
name: "arg",
|
||||
type: "string",
|
||||
description: "The enum to display.",
|
||||
enum: ["one", "two", "three"],
|
||||
},
|
||||
],
|
||||
handler: async ({ arg }) => {
|
||||
switch (arg) {
|
||||
case "one":
|
||||
console.log("One");
|
||||
break;
|
||||
case "two":
|
||||
console.log("Two");
|
||||
break;
|
||||
default:
|
||||
const exhaustiveCheck: never = arg;
|
||||
}
|
||||
console.log("No args action");
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import { useCopilotAction } from "@copilotkit/react-core";
|
||||
|
||||
useCopilotAction({
|
||||
name: "noargs",
|
||||
handler: async (args) => {
|
||||
console.log("No args action");
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
import { useCopilotAction } from "@copilotkit/react-core";
|
||||
|
||||
useCopilotAction({
|
||||
name: "object",
|
||||
parameters: [
|
||||
{
|
||||
name: "arg",
|
||||
type: "object",
|
||||
description: "The object argument to display.",
|
||||
attributes: [
|
||||
{
|
||||
name: "x",
|
||||
type: "string",
|
||||
description: "The x attribute.",
|
||||
},
|
||||
{
|
||||
name: "y",
|
||||
type: "number",
|
||||
description: "The y attribute.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
handler: async ({ arg }) => {
|
||||
const x: string = arg.x;
|
||||
const y: number = arg.y;
|
||||
const z: boolean = arg.z;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
import { useCopilotAction } from "@copilotkit/react-core";
|
||||
|
||||
useCopilotAction({
|
||||
name: "optional",
|
||||
parameters: [
|
||||
{
|
||||
name: "arg",
|
||||
type: "string",
|
||||
description: "The optional argument to display.",
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
handler: async ({ arg }) => {
|
||||
// TODO this should fail
|
||||
let x: string = arg;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
import { useCopilotAction } from "@copilotkit/react-core";
|
||||
|
||||
useCopilotAction({
|
||||
name: "array",
|
||||
parameters: [
|
||||
{
|
||||
name: "arg",
|
||||
type: "object[]",
|
||||
description: "The object argument to display.",
|
||||
attributes: [
|
||||
{
|
||||
name: "x",
|
||||
type: "string",
|
||||
description: "The x attribute.",
|
||||
},
|
||||
{
|
||||
name: "y",
|
||||
type: "number",
|
||||
description: "The y attribute.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
handler: async ({ arg }) => {
|
||||
const x: string = arg[0].x;
|
||||
const y: number = arg[0].y;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
import { useCopilotAction } from "@copilotkit/react-core";
|
||||
|
||||
useCopilotAction({
|
||||
name: "enum",
|
||||
parameters: [
|
||||
{
|
||||
name: "arg",
|
||||
type: "string",
|
||||
description: "The enum to display.",
|
||||
enum: ["one", "two", "three"],
|
||||
},
|
||||
],
|
||||
handler: async ({ arg }) => {
|
||||
switch (arg) {
|
||||
case "one":
|
||||
console.log("One");
|
||||
break;
|
||||
case "two":
|
||||
console.log("Two");
|
||||
break;
|
||||
case "three":
|
||||
console.log("Three");
|
||||
break;
|
||||
default:
|
||||
const exhaustiveCheck: never = arg;
|
||||
}
|
||||
console.log("No args action");
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import { useCopilotAction } from "@copilotkit/react-core";
|
||||
|
||||
useCopilotAction({
|
||||
name: "noargs",
|
||||
handler: async () => {
|
||||
console.log("No args action");
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
import { useCopilotAction } from "@copilotkit/react-core";
|
||||
|
||||
useCopilotAction({
|
||||
name: "object",
|
||||
parameters: [
|
||||
{
|
||||
name: "arg",
|
||||
type: "object",
|
||||
description: "The object argument to display.",
|
||||
attributes: [
|
||||
{
|
||||
name: "x",
|
||||
type: "string",
|
||||
description: "The x attribute.",
|
||||
},
|
||||
{
|
||||
name: "y",
|
||||
type: "number",
|
||||
description: "The y attribute.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
handler: async ({ arg }) => {
|
||||
const x: string = arg.x;
|
||||
const y: number = arg.y;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
import { useCopilotAction } from "@copilotkit/react-core";
|
||||
|
||||
useCopilotAction({
|
||||
name: "optional",
|
||||
parameters: [
|
||||
{
|
||||
name: "arg",
|
||||
type: "string",
|
||||
description: "The optional argument to display.",
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
handler: async ({ arg }) => {
|
||||
let x: string = "y";
|
||||
|
||||
if (arg !== undefined) {
|
||||
x = arg;
|
||||
}
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user