87 | >(({ className, ...props }, ref) => (
88 | | [role=checkbox]]:translate-y-[2px]",
92 | className,
93 | )}
94 | {...props}
95 | />
96 | ));
97 | TableCell.displayName = "TableCell";
98 |
99 | const TableCaption = React.forwardRef<
100 | HTMLTableCaptionElement,
101 | React.HTMLAttributes
102 | >(({ className, ...props }, ref) => (
103 |
108 | ));
109 | TableCaption.displayName = "TableCaption";
110 |
111 | export {
112 | Table,
113 | TableHeader,
114 | TableBody,
115 | TableFooter,
116 | TableHead,
117 | TableRow,
118 | TableCell,
119 | TableCaption,
120 | };
121 |
--------------------------------------------------------------------------------
/backend/app/sandbox/integrations/g_sheets.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from dotenv import load_dotenv
4 |
5 | load_dotenv()
6 |
7 | SHEETS_ACCESS_TOKEN = os.getenv("SHEETS_ACCESS_TOKEN")
8 | SHEETS_REFRESH_TOKEN = os.getenv("SHEETS_REFRESH_TOKEN")
9 | SHEETS_CLIENT_ID = os.getenv("SHEETS_CLIENT_ID")
10 | SHEETS_CLIENT_SECRET = os.getenv("SHEETS_CLIENT_SECRET")
11 |
12 |
13 | def main():
14 | from app.connectors.client.sheets import GoogleSheetsClient
15 | from app.models.integrations.sheets import SheetsGetRequest
16 |
17 | client = GoogleSheetsClient(
18 | access_token=SHEETS_ACCESS_TOKEN,
19 | refresh_token=SHEETS_REFRESH_TOKEN,
20 | client_id=SHEETS_CLIENT_ID,
21 | client_secret=SHEETS_CLIENT_SECRET,
22 | )
23 |
24 | # HARD CODE TEST
25 |
26 | ## AGENT TEST
27 | # chat_history: list[Message] = []
28 | # message = Message(
29 | # role=Role.USER,
30 | # content="I want get all emails from hugeewhale@gmail.com that are unread. There should be one in particular that asks for my address. I live at 91 Yishun Ave 1, S(769135) so please send a reply to that email containing the information",
31 | # ).model_dump()
32 | # chat_history.append(message)
33 | # response = AgentResponse(agent=GMAIL_TRIAGE_AGENT, message=message)
34 | # while response.agent:
35 | # response = response.agent.query(
36 | # chat_history=chat_history,
37 | # access_token=GMAIL_ACCESS_TOKEN,
38 | # refresh_token=GMAIL_REFRESH_TOKEN,
39 | # client_id=GMAIL_CLIENT_ID,
40 | # client_secret=GMAIL_CLIENT_SECRET,
41 | # )
42 | # chat_history.append(Message(role=Role.ASSISTANT, content=str(response.message)))
43 | # print(chat_history)
44 |
45 |
46 | if __name__ == "__main__":
47 | main()
48 |
49 | ### HARD CODE TEST
50 | ## Read Sheets
51 | # print(
52 | # client.read_sheet(
53 | # request=SheetsGetRequest(
54 | # spreadsheet_id="1YVgOzMDESAGBaAjXlvB941HDzyrFvNqzcHOnwEifzoY",
55 | # sheet_name="Controllers",
56 | # )
57 | # )
58 | # )
59 |
60 | ### AGENT TEST
61 | ## Send Email
62 | # messages = [
63 | # Message(role="user", content="I want to send an email to hugeewhale@gmail.com with the subject. For the content body, crack a funny joke that an aspiring entrepreneur would relate with. You can come up with an appropriate subject title").model_dump()
64 | # ]
65 | # agent = GMAIL_TRIAGE_AGENT.query(
66 | # messages=messages,
67 | # access_token=GMAIL_ACCESS_TOKEN,
68 | # refresh_token=GMAIL_REFRESH_TOKEN,
69 | # client_id=GMAIL_CLIENT_ID,
70 | # client_secret=GMAIL_CLIENT_SECRET
71 | # )
72 | # agent.query(
73 | # messages=messages,
74 | # access_token=GMAIL_ACCESS_TOKEN,
75 | # refresh_token=GMAIL_REFRESH_TOKEN,
76 | # client_id=GMAIL_CLIENT_ID,
77 | # client_secret=GMAIL_CLIENT_SECRET
78 | # )
79 |
80 | ## Get Emails
81 | # messages = [
82 | # Message(role="user", content="I want get all emails from apply@ycombinator.com that are unread").model_dump()
83 | # ]
84 | # agent = GMAIL_TRIAGE_AGENT.query(
85 | # messages=messages,
86 | # access_token=GMAIL_ACCESS_TOKEN,
87 | # refresh_token=GMAIL_REFRESH_TOKEN,
88 | # client_id=GMAIL_CLIENT_ID,
89 | # client_secret=GMAIL_CLIENT_SECRET
90 | # )
91 | # response = agent.query(
92 | # messages=messages,
93 | # access_token=GMAIL_ACCESS_TOKEN,
94 | # refresh_token=GMAIL_REFRESH_TOKEN,
95 | # client_id=GMAIL_CLIENT_ID,
96 | # client_secret=GMAIL_CLIENT_SECRET
97 | # )
98 | # print(response)
99 |
--------------------------------------------------------------------------------
/frontend/src/components/home/input-container.tsx:
--------------------------------------------------------------------------------
1 | import Loader from "@/components/accessory/loader";
2 | import VerificationOption from "@/components/home/input/verification-option";
3 | import { Button } from "@/components/ui/button";
4 | import { Textarea } from "@/components/ui/textarea";
5 | import { userVerificationSchema } from "@/types/actions/query/confirm";
6 | import { useEffect, useRef, useState } from "react";
7 |
8 | type InputContainerProps = {
9 | isApiKeyLoading: boolean;
10 | isResponseFetching: boolean;
11 | functionToVerify: string | null;
12 | sendMessage: (inputText: string) => void;
13 | };
14 |
15 | export default function InputContainer({
16 | isApiKeyLoading,
17 | isResponseFetching,
18 | functionToVerify,
19 | sendMessage,
20 | }: InputContainerProps) {
21 | const [inputText, setInputText] = useState("");
22 | const textareaRef = useRef(null);
23 |
24 | useEffect(() => {
25 | if (textareaRef.current) {
26 | if (functionToVerify !== null || isResponseFetching) {
27 | textareaRef.current.blur();
28 | return;
29 | }
30 | textareaRef.current.focus();
31 | }
32 | }, [functionToVerify, isResponseFetching]);
33 |
34 | const handleSendMessage = () => {
35 | const trimmedInputText: string = inputText.trim();
36 | setInputText("");
37 | sendMessage(trimmedInputText);
38 | };
39 |
40 | const canSendMessage = () => {
41 | return (
42 | inputText.trim().length > 0 && !isResponseFetching && !isApiKeyLoading
43 | );
44 | };
45 |
46 | const isTextAreaDisabled = () => {
47 | return isResponseFetching || functionToVerify !== null;
48 | };
49 |
50 | useEffect(() => {
51 | const handleKeyDown = async (event: KeyboardEvent) => {
52 | if (
53 | event.key === "Enter" &&
54 | document.activeElement?.id === "input-text-area"
55 | ) {
56 | event.preventDefault();
57 | handleSendMessage();
58 | }
59 | };
60 |
61 | document.addEventListener("keydown", handleKeyDown);
62 | return () => {
63 | document.removeEventListener("keydown", handleKeyDown);
64 | };
65 | }, [inputText]);
66 |
67 | return (
68 | <>
69 | |