MCPcopy Create free account
hub / github.com/aircloud/sync-to-github / tryConvert

Function tryConvert

apps/chrome-ext/src/content_script.ts:9–31  ·  view source on GitHub ↗
(command: ConvertInstructions)

Source from the content-addressed store, hash-verified

7const ConvertLists: BaseConverter[] = [new ChatGPTConverter(), new ShareGPTConverter()]
8
9const tryConvert = (command: ConvertInstructions): ConvertResult => {
10 try {
11 for (const converter of ConvertLists) {
12 if (converter.isActive) {
13 const content = command === 'CONVERT' ? converter.convert() : converter.currentFileName
14 return {
15 success: true,
16 content,
17 }
18 }
19 }
20 } catch (e) {
21 return {
22 success: false,
23 error: `${e}`,
24 }
25 }
26
27 return {
28 success: false,
29 error: 'no convert found',
30 }
31}
32
33// get popup2content info
34chrome.runtime.onMessage.addListener((request: ConvertInstructionRequest, sender, sendResponse) => {

Callers 1

content_script.tsFile · 0.85

Calls 1

convertMethod · 0.45

Tested by

no test coverage detected