diff --git a/.yarn/cache/playroom-patch-4adfcfbe79-afc8c31a5a.zip b/.yarn/cache/playroom-patch-296f85d480-4519b01e0b.zip similarity index 99% rename from .yarn/cache/playroom-patch-4adfcfbe79-afc8c31a5a.zip rename to .yarn/cache/playroom-patch-296f85d480-4519b01e0b.zip index ca9946ea0..5a4c13f4a 100644 Binary files a/.yarn/cache/playroom-patch-4adfcfbe79-afc8c31a5a.zip and b/.yarn/cache/playroom-patch-296f85d480-4519b01e0b.zip differ diff --git a/.yarn/patches/playroom-npm-0.39.0-24448abd08.patch b/.yarn/patches/playroom-npm-0.39.0-24448abd08.patch index 6ab6c10e1..acd67d325 100644 --- a/.yarn/patches/playroom-npm-0.39.0-24448abd08.patch +++ b/.yarn/patches/playroom-npm-0.39.0-24448abd08.patch @@ -149,7 +149,7 @@ index 0000000000000000000000000000000000000000..21d14ae14f317c051123f269242ee58d +]); diff --git a/src/Playroom/AiPanel/AiPanel.tsx b/src/Playroom/AiPanel/AiPanel.tsx new file mode 100644 -index 0000000000000000000000000000000000000000..dd60b29783442680768eba84b600c2f5a90b6a5d +index 0000000000000000000000000000000000000000..57e123e4dfc28dbd4154d2c7bb62d47596ecbf25 --- /dev/null +++ b/src/Playroom/AiPanel/AiPanel.tsx @@ -0,0 +1,506 @@ @@ -187,7 +187,7 @@ index 0000000000000000000000000000000000000000..dd60b29783442680768eba84b600c2f5 +// export const aiBaseUrl = `http://localhost:3000`; +export const aiBaseUrl = `https://mistica-playroom-api.tooling-dev.svc.dev.tuenti.io`; + -+const fetchApi = (path: string, options?: RequestInit): Promise => ++const fetchApi = (path: string, options?: RequestInit): Promise => + fetch(`${aiBaseUrl}${path}`, { + credentials: 'include', + method: 'POST', @@ -202,42 +202,42 @@ index 0000000000000000000000000000000000000000..dd60b29783442680768eba84b600c2f5 + window.location.assign('/oauth2/sign_in'); + return new Promise(() => {}); // never resolve, as we are redirecting to login + } -+ return response; ++ return response.json(); + }); + -+const sendMessageToAi = (conversationId: string, message: string) => ++const sendMessageToAi = ( ++ conversationId: string, ++ message: string ++): Promise => + fetchApi('/send-message', { + body: JSON.stringify({ conversationId, message }), -+ }) -+ .then((response) => response.json()) -+ .then((data) => { -+ if (!data.success) { -+ throw new Error(data.error); -+ } -+ return data.source; -+ }); ++ }).then((data) => { ++ if (!data.success) { ++ throw new Error(data.error); ++ } ++ return data.source; ++ }); + +const createConversation = (): Promise => -+ fetchApi('/create-conversation') -+ .then((response) => response.json()) -+ .then((data) => data.conversationId); ++ fetchApi('/create-conversation').then((data) => data.conversationId); + -+const deleteConversation = (conversationId: string) => ++const deleteConversation = (conversationId: string): Promise => + fetchApi('/delete-conversation', { + body: JSON.stringify({ conversationId }), -+ }); ++ }).then(() => {}); + -+const regenerateMessage = (conversationId: string, messageIndex: number) => ++const regenerateMessage = ( ++ conversationId: string, ++ messageIndex: number ++): Promise => + fetchApi('/regenerate-message', { + body: JSON.stringify({ conversationId, messageIndex }), -+ }) -+ .then((response) => response.json()) -+ .then((data) => { -+ if (!data.success) { -+ throw new Error(data.error); -+ } -+ return data.source; -+ }); ++ }).then((data) => { ++ if (!data.success) { ++ throw new Error(data.error); ++ } ++ return data.source; ++ }); + +export const EmptyState = ({ + onImagePaste, diff --git a/package.json b/package.json index 5e66c852d..84522eb35 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "detect-circular-dependencies": "npx dpdm --circular src/index.tsx", "audit-accessibility": "node .github/actions/audit-accessibility/main.js", "circular-dependencies": "yarn dpdm src/index.tsx --tree=false --warning=false --exit-code circular:1", - "prepare": "husky install" + "prepare": "husky install", + "edit-playroom-patch": "playroom/patch-playroom.sh" }, "browserslist": [ "chrome >= 51", diff --git a/yarn.lock b/yarn.lock index 0d59b9699..90a277102 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17966,7 +17966,7 @@ __metadata: "playroom@patch:playroom@npm%3A0.39.0#./.yarn/patches/playroom-npm-0.39.0-24448abd08.patch::locator=%40telefonica%2Fmistica%40workspace%3A.": version: 0.39.0 - resolution: "playroom@patch:playroom@npm%3A0.39.0#./.yarn/patches/playroom-npm-0.39.0-24448abd08.patch::version=0.39.0&hash=bc8505&locator=%40telefonica%2Fmistica%40workspace%3A." + resolution: "playroom@patch:playroom@npm%3A0.39.0#./.yarn/patches/playroom-npm-0.39.0-24448abd08.patch::version=0.39.0&hash=2ce33c&locator=%40telefonica%2Fmistica%40workspace%3A." dependencies: "@babel/core": ^7.20.5 "@babel/parser": ^7.23.4 @@ -18028,7 +18028,7 @@ __metadata: react-dom: ^17 || ^18 bin: playroom: bin/cli.cjs - checksum: afc8c31a5a94c624f9011f0c825f8ae0e7a3958139c750f0d7f55c2e95c60ed492b2b31a40261eeea2f9bae5d6bd1c544f53f5e6985e36c522c3a857b6f80ac3 + checksum: 4519b01e0bbf62650671841a75c935e0f26e91f55380816d6f9f85e843c25672c039d43f7eb1a0f289cd19253bb08e7fb73f9f5b214e76b20d8636fe219c5bf1 languageName: node linkType: hard