chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"projects": {
|
||||
"default": "copilotkit-test-12345"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"functions": [
|
||||
{
|
||||
"source": "functions",
|
||||
"codebase": "default",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
".git",
|
||||
"firebase-debug.log",
|
||||
"firebase-debug.*.log"
|
||||
],
|
||||
"predeploy": [
|
||||
"npm --prefix \"$RESOURCE_DIR\" run lint",
|
||||
"npm --prefix \"$RESOURCE_DIR\" run build"
|
||||
]
|
||||
}
|
||||
],
|
||||
"emulators": {
|
||||
"functions": {
|
||||
"port": 5001
|
||||
},
|
||||
"ui": {
|
||||
"enabled": true
|
||||
},
|
||||
"singleProjectMode": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Import function triggers from their respective submodules:
|
||||
*
|
||||
* import {onCall} from "firebase-functions/v2/https";
|
||||
* import {onDocumentWritten} from "firebase-functions/v2/firestore";
|
||||
*
|
||||
* See a full list of supported triggers at https://firebase.google.com/docs/functions
|
||||
*/
|
||||
|
||||
import { onRequest } from "firebase-functions/v2/https";
|
||||
// import * as logger from "firebase-functions/logger";
|
||||
import { CopilotRuntime, OpenAIAdapter } from "@copilotkit/runtime";
|
||||
|
||||
// Start writing functions
|
||||
// https://firebase.google.com/docs/functions/typescript
|
||||
|
||||
export const copilotKit = onRequest((request, response) => {
|
||||
const copilotKit = new CopilotRuntime();
|
||||
copilotKit.streamHttpServerResponse(request, response, new OpenAIAdapter({}));
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "functions",
|
||||
"private": true,
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build:watch": "tsc --watch",
|
||||
"serve": "npm run build && firebase emulators:start --only functions",
|
||||
"shell": "npm run build && firebase functions:shell",
|
||||
"start": "npm run shell",
|
||||
"deploy": "firebase deploy --only functions",
|
||||
"logs": "firebase functions:log"
|
||||
},
|
||||
"dependencies": {
|
||||
"@copilotkit/backend": "^0.7.0-mme-firebase-fixes.0",
|
||||
"@copilotkit/react-core": "^0.23.0-mme-firebase-fixes.0",
|
||||
"@copilotkit/react-textarea": "^0.33.0-mme-firebase-fixes.0",
|
||||
"@copilotkit/react-ui": "^0.20.0-mme-firebase-fixes.0",
|
||||
"@copilotkit/shared": "^0.7.0-mme-firebase-fixes.0",
|
||||
"firebase-admin": "^12.0.0",
|
||||
"firebase-functions": "^4.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"firebase-functions-test": "^3.1.0",
|
||||
"firebase-tools": "^13.6.0",
|
||||
"typescript": "^5.4.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "18"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
"use client";
|
||||
import {
|
||||
CopilotKit,
|
||||
useCopilotAction,
|
||||
useCopilotReadable,
|
||||
} from "@copilotkit/react-core";
|
||||
import { CopilotTextarea } from "@copilotkit/react-textarea";
|
||||
import { CopilotSidebar } from "@copilotkit/react-ui";
|
||||
import "@copilotkit/react-ui/styles.css";
|
||||
import { useState } from "react";
|
||||
import "@copilotkit/react-textarea/styles.css";
|
||||
import "@copilotkit/react-ui/styles.css";
|
||||
function InsideHome() {
|
||||
const [message, setMessage] = useState("Hello World!");
|
||||
const [text, setText] = useState("");
|
||||
useCopilotReadable({
|
||||
description: "This is the current message",
|
||||
value: message,
|
||||
});
|
||||
useCopilotAction(
|
||||
{
|
||||
name: "displayMessage",
|
||||
description: "Display a message.",
|
||||
parameters: [
|
||||
{
|
||||
name: "message",
|
||||
type: "string",
|
||||
description: "The message to display.",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
handler: async ({ message }) => {
|
||||
setMessage(message);
|
||||
},
|
||||
},
|
||||
[],
|
||||
);
|
||||
return (
|
||||
<div className="h-screen w-full flex items-center justify-center text-2xl">
|
||||
{message}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default function Home() {
|
||||
return (
|
||||
<CopilotKit url="http://127.0.0.1:5001/copilotkit-test-12345/us-central1/copilotKit">
|
||||
<CopilotSidebar
|
||||
defaultOpen={true}
|
||||
labels={{
|
||||
title: "Presentation Copilot",
|
||||
initial: "Hi you! 👋 I can give you a presentation on any topic.",
|
||||
}}
|
||||
clickOutsideToClose={false}
|
||||
>
|
||||
<InsideHome />
|
||||
</CopilotSidebar>
|
||||
</CopilotKit>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"noImplicitReturns": true,
|
||||
"noUnusedLocals": true,
|
||||
"outDir": "lib",
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "es2017"
|
||||
},
|
||||
"compileOnSave": true,
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user