Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/MOC-204_chat'
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathankap committed Sep 9, 2024
2 parents 2b6a219 + e5aab9d commit 82c0130
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion apps/mocksi-lite-next/src/pages/content/mocksi-extension.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ chrome.runtime.onMessage.addListener((request) => {
}
if (
request.message === "STOP_EDITING" ||
request.message === "STOP_PLAYING"
request.message === "STOP_PLAYING" ||
request.message === "STOP_CHAT"
) {
reactor.detach();
}
Expand All @@ -222,6 +223,20 @@ chrome.runtime.onMessage.addListener((request) => {
});
}

if (request.message === "CHAT") {
reactor.attach(document, getHighlighter());
}

if (request.message === "CHAT_MESSAGE") {
data = reactor.exportDOM();
}
if (request.message === "CHAT_RESPONSE") {
await reactor.pushModification(request.data);
data = Array.from(reactor.getAppliedModifications()).map(
(mod) => mod.modificationRequest,
);
}

sendResponse({
data,
message: request.message,
Expand Down
2 changes: 1 addition & 1 deletion packages/reactor/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { generateRandomString } from "./utils";

export interface Modification {
export type Modification = {
selector?: string;
xpath?: string;
action:
Expand Down

0 comments on commit 82c0130

Please sign in to comment.