Skip to content

Commit eb32cb1

Browse files
committed
Merge branch 'main' into mme/assistant-api
2 parents 03b7088 + aa3bbe9 commit eb32cb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1945
-967
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"eslint-config-custom": minor
3+
"tailwind-config": minor
4+
"@copilotkit/react-textarea": minor
5+
"next-openai": minor
6+
"@copilotkit/react-core": minor
7+
"@copilotkit/react-ui": minor
8+
"tsconfig": minor
9+
"@copilotkit/backend": minor
10+
"@copilotkit/shared": minor
11+
"node": minor
12+
---
13+
14+
Alpha

CopilotKit/.changeset/pre.json

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
{
22
"mode": "exit",
3-
"tag": "mme-assistant-api",
3+
"tag": "mme-experimental-actions",
44
"initialVersions": {
5-
"next-openai": "1.16.1",
6-
"node": "1.16.1",
7-
"@copilotkit/backend": "0.4.1",
8-
"eslint-config-custom": "0.5.1",
9-
"@copilotkit/react-core": "0.20.1",
10-
"@copilotkit/react-textarea": "0.30.1",
11-
"@copilotkit/react-ui": "0.17.1",
12-
"@copilotkit/shared": "0.4.1",
13-
"tailwind-config": "0.4.1",
14-
"tsconfig": "0.9.1"
5+
"next-openai": "1.17.0-mme-experimental-actions.0",
6+
"node": "1.17.0-mme-experimental-actions.0",
7+
"@copilotkit/backend": "0.5.0-mme-experimental-actions.0",
8+
"eslint-config-custom": "0.6.0-mme-experimental-actions.0",
9+
"@copilotkit/react-core": "0.21.0-mme-experimental-actions.0",
10+
"@copilotkit/react-textarea": "0.31.0-mme-experimental-actions.0",
11+
"@copilotkit/react-ui": "0.18.0-mme-experimental-actions.0",
12+
"@copilotkit/shared": "0.5.0-mme-experimental-actions.0",
13+
"tailwind-config": "0.5.0-mme-experimental-actions.0",
14+
"tsconfig": "0.10.0-mme-experimental-actions.0"
1515
},
16-
"changesets": [
17-
"dirty-zebras-divide"
18-
]
16+
"changesets": ["funny-spies-unite", "tall-buttons-occur"]
1917
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"eslint-config-custom": minor
3+
"@copilotkit/react-textarea": minor
4+
"next-openai": minor
5+
"@copilotkit/react-core": minor
6+
"@copilotkit/react-ui": minor
7+
"@copilotkit/backend": minor
8+
"@copilotkit/shared": minor
9+
"node": minor
10+
"tailwind-config": minor
11+
"tsconfig": minor
12+
---
13+
14+
QA new action type

CopilotKit/.prettierignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ README.md
22
.next
33
.nuxt
44
node_modules
5-
dist
5+
dist
6+
packages/react-core/src/hooks/use-copilot-action.ts
7+
packages/backend/src/lib/copilotkit-backend.ts

CopilotKit/examples/next-openai/CHANGELOG.md

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# web
22

3-
## 1.17.0-mme-assistant-api.0
3+
## 1.17.0-mme-experimental-actions.1
44

55
### Minor Changes
66

@@ -9,11 +9,26 @@
99
### Patch Changes
1010

1111
- Updated dependencies
12-
- @copilotkit/react-core@0.21.0-mme-assistant-api.0
13-
- @copilotkit/backend@0.5.0-mme-assistant-api.0
14-
- @copilotkit/shared@0.5.0-mme-assistant-api.0
15-
- @copilotkit/react-textarea@0.31.0-mme-assistant-api.0
16-
- @copilotkit/react-ui@0.18.0-mme-assistant-api.0
12+
- @copilotkit/react-textarea@0.31.0-mme-experimental-actions.1
13+
- @copilotkit/react-core@0.21.0-mme-experimental-actions.1
14+
- @copilotkit/react-ui@0.18.0-mme-experimental-actions.1
15+
- @copilotkit/backend@0.5.0-mme-experimental-actions.1
16+
- @copilotkit/shared@0.5.0-mme-experimental-actions.1
17+
18+
## 1.17.0-mme-experimental-actions.0
19+
20+
### Minor Changes
21+
22+
- QA new action type
23+
24+
### Patch Changes
25+
26+
- Updated dependencies
27+
- @copilotkit/react-textarea@0.31.0-mme-experimental-actions.0
28+
- @copilotkit/react-core@0.21.0-mme-experimental-actions.0
29+
- @copilotkit/react-ui@0.18.0-mme-experimental-actions.0
30+
- @copilotkit/backend@0.5.0-mme-experimental-actions.0
31+
- @copilotkit/shared@0.5.0-mme-experimental-actions.0
1732

1833
## 1.16.1
1934

CopilotKit/examples/next-openai/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "next-openai",
3-
"version": "1.17.0-mme-assistant-api.0",
3+
"version": "1.17.0-mme-experimental-actions.1",
44
"private": true,
55
"scripts": {
66
"dev": "NODE_OPTIONS='--inspect' next dev",
@@ -35,6 +35,6 @@
3535
"tailwind-config": "workspace:*",
3636
"tailwindcss": "^3.2.4",
3737
"tsconfig": "workspace:*",
38-
"typescript": "^5.1.3"
38+
"typescript": "^5.2.3"
3939
}
4040
}

CopilotKit/examples/next-openai/src/app/api/copilotkit/gpt-newspaper/route.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ export async function POST(req: Request): Promise<Response> {
1515
name: "research",
1616
description:
1717
"Call this function when the user requests research on a certain topic. After researching, make a presentation.",
18-
argumentAnnotations: [
18+
parameters: [
1919
{
2020
name: "topic",
2121
type: "string",
2222
description: "The topic to research.",
23-
required: true,
2423
},
2524
],
26-
implementation: async (topic) => {
25+
handler: async ({ topic }) => {
2726
const response = await fetch("http://localhost:8000/generate_newspaper_html", {
2827
method: "POST",
2928
headers: {

CopilotKit/examples/next-openai/src/app/api/copilotkit/langchain/route.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ export async function POST(req: Request): Promise<Response> {
1212
{
1313
name: "sayHello",
1414
description: "Says hello to someone.",
15-
argumentAnnotations: [
15+
parameters: [
1616
{
1717
name: "arg",
1818
type: "string",
1919
description: "The name of the person to say hello to.",
2020
required: true,
2121
},
2222
],
23-
implementation: async (arg) => {
23+
handler: async ({ arg }) => {
2424
console.log("Hello from the server", arg, "!");
2525
},
2626
},

CopilotKit/examples/next-openai/src/app/api/copilotkit/openai/route.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ export async function POST(req: Request): Promise<Response> {
88
// {
99
// name: "sayHello",
1010
// description: "Says hello to someone.",
11-
// argumentAnnotations: [
11+
// parameters: [
1212
// {
1313
// name: "name",
1414
// type: "string",
1515
// description: "The name of the person to say hello to.",
1616
// required: true,
1717
// },
1818
// ],
19-
// implementation: async (name) => {
19+
// handler: async ({ name }) => {
2020
// const prompt = ChatPromptTemplate.fromMessages([
2121
// [
2222
// "system",

CopilotKit/examples/next-openai/src/app/presentation/page.tsx

+52-57
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@
22

33
import { useCopilotContext } from "@copilotkit/react-core";
44
import { CopilotTask } from "@copilotkit/react-core";
5-
import {
6-
CopilotKit,
7-
useMakeCopilotActionable,
8-
useMakeCopilotReadable,
9-
} from "@copilotkit/react-core";
5+
import { CopilotKit, useMakeCopilotReadable } from "@copilotkit/react-core";
106
import { CopilotSidebar } from "@copilotkit/react-ui";
117
import { useEffect, useState } from "react";
128
import Markdown from "react-markdown";
139
import "./styles.css";
10+
import { useCopilotAction } from "@copilotkit/react-core";
1411

1512
let globalAudio: any = undefined;
1613
let globalAudioEnabled = false;
1714

15+
function enableGlobalAudio() {
16+
if (!globalAudioEnabled) {
17+
globalAudio.play();
18+
globalAudio.pause();
19+
}
20+
globalAudioEnabled = true;
21+
}
22+
1823
const Demo = () => {
1924
return (
2025
<CopilotKit url="/api/copilotkit/openai">
@@ -26,11 +31,7 @@ const Demo = () => {
2631
}}
2732
clickOutsideToClose={false}
2833
onSubmitMessage={async (message) => {
29-
if (!globalAudioEnabled) {
30-
globalAudio.play();
31-
globalAudio.pause();
32-
}
33-
globalAudioEnabled = true;
34+
enableGlobalAudio();
3435
}}
3536
>
3637
<Presentation />
@@ -53,55 +54,48 @@ const Presentation = () => {
5354

5455
useMakeCopilotReadable("This is the current slide: " + JSON.stringify(state));
5556

56-
useMakeCopilotActionable(
57-
{
58-
name: "presentSlide",
59-
description:
60-
"Present a slide in the presentation you are giving. Call this function multiple times to present multiple slides.",
61-
argumentAnnotations: [
62-
{
63-
name: "markdown",
64-
type: "string",
65-
description:
66-
"The text to display in the presentation slide. Use simple markdown to outline your speech, like a headline, lists, paragraphs, etc.",
67-
required: true,
68-
},
69-
{
70-
name: "backgroundImage",
71-
type: "string",
72-
description: "What to display in the background of the slide (i.e. 'dog' or 'house').",
73-
required: true,
74-
},
75-
{
76-
name: "speech",
77-
type: "string",
78-
description: "An informative speech about the current slide.",
79-
required: true,
80-
},
81-
],
82-
83-
implementation: async (markdown, backgroundImage, speech) => {
84-
setState({
85-
markdown,
86-
backgroundImage,
87-
});
88-
89-
console.log("Presenting slide: ", markdown, backgroundImage, speech);
90-
91-
const encodedText = encodeURIComponent(speech);
92-
const url = `/api/tts?text=${encodedText}`;
93-
globalAudio.src = url;
94-
await globalAudio.play();
95-
await new Promise<void>((resolve) => {
96-
globalAudio.onended = function () {
97-
resolve();
98-
};
99-
});
100-
await new Promise((resolve) => setTimeout(resolve, 500));
57+
useCopilotAction({
58+
name: "presentSlide",
59+
description:
60+
"Present a slide in the presentation you are giving. Call this function multiple times to present multiple slides.",
61+
parameters: [
62+
{
63+
name: "markdown",
64+
type: "string",
65+
description:
66+
"The text to display in the presentation slide. Use simple markdown to outline your speech, like a headline, lists, paragraphs, etc.",
67+
},
68+
{
69+
name: "backgroundImage",
70+
type: "string",
71+
description: "What to display in the background of the slide (i.e. 'dog' or 'house').",
72+
},
73+
{
74+
name: "speech",
75+
type: "string",
76+
description: "An informative speech about the current slide.",
10177
},
78+
],
79+
handler: async ({ markdown, speech, backgroundImage }) => {
80+
setState({
81+
markdown,
82+
backgroundImage,
83+
});
84+
85+
console.log("Presenting slide: ", markdown, backgroundImage, speech);
86+
87+
const encodedText = encodeURIComponent(speech);
88+
const url = `/api/tts?text=${encodedText}`;
89+
globalAudio.src = url;
90+
await globalAudio.play();
91+
await new Promise<void>((resolve) => {
92+
globalAudio.onended = function () {
93+
resolve();
94+
};
95+
});
96+
await new Promise((resolve) => setTimeout(resolve, 500));
10297
},
103-
[],
104-
);
98+
});
10599

106100
const randomSlideTask = new CopilotTask({
107101
instructions: "Make a random slide related to the current topic",
@@ -119,6 +113,7 @@ const Presentation = () => {
119113
className={`absolute bottom-0 left-0 mb-4 ml-4 bg-blue-500 text-white font-bold py-2 px-4 rounded
120114
${randomSlideTaskRunning ? "opacity-50 cursor-not-allowed" : "hover:bg-blue-700"}`}
121115
onClick={async () => {
116+
enableGlobalAudio();
122117
try {
123118
setRandomSlideTaskRunning(true);
124119
await randomSlideTask.run(context);

CopilotKit/examples/node/CHANGELOG.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# node
22

3-
## 1.17.0-mme-assistant-api.0
3+
## 1.17.0-mme-experimental-actions.1
44

55
### Minor Changes
66

@@ -9,8 +9,20 @@
99
### Patch Changes
1010

1111
- Updated dependencies
12-
- @copilotkit/backend@0.5.0-mme-assistant-api.0
13-
- @copilotkit/shared@0.5.0-mme-assistant-api.0
12+
- @copilotkit/backend@0.5.0-mme-experimental-actions.1
13+
- @copilotkit/shared@0.5.0-mme-experimental-actions.1
14+
15+
## 1.17.0-mme-experimental-actions.0
16+
17+
### Minor Changes
18+
19+
- QA new action type
20+
21+
### Patch Changes
22+
23+
- Updated dependencies
24+
- @copilotkit/backend@0.5.0-mme-experimental-actions.0
25+
- @copilotkit/shared@0.5.0-mme-experimental-actions.0
1426

1527
## 1.16.1
1628

CopilotKit/examples/node/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node",
3-
"version": "1.17.0-mme-assistant-api.0",
3+
"version": "1.17.0-mme-experimental-actions.1",
44
"private": true,
55
"scripts": {
66
"start": "node dist/index.js",
@@ -15,6 +15,6 @@
1515
"@types/node": "^18.11.17",
1616
"eslint-config-custom": "workspace:*",
1717
"tsconfig": "workspace:*",
18-
"typescript": "^5.1.3"
18+
"typescript": "^5.2.3"
1919
}
2020
}

CopilotKit/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"freshbuild": "pnpm clean && pnpm install && pnpm build"
1414
},
1515
"devDependencies": {
16-
"eslint": "^7.32.0",
16+
"eslint": "^8.56.0",
1717
"eslint-config-custom": "workspace:*",
1818
"prettier": "^2.7.1",
1919
"prettier-plugin-tailwindcss": "^0.1.11",

0 commit comments

Comments
 (0)