@canmingir/link 1.2.54 → 1.2.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +6 -1
- package/bun.lock +20 -30
- package/package.json +3 -1
- package/src/components/logo/logo.jsx +12 -48
- package/src/lib/ChatMessage/AIMessage.tsx +163 -0
- package/src/lib/ChatMessage/ErrorMessage.tsx +63 -0
- package/src/lib/ChatMessage/HumanMessage.tsx +142 -0
- package/src/lib/ChatMessage/LoadingMessage.tsx +27 -0
- package/src/lib/ChatMessage/MessageList.tsx +81 -0
- package/src/lib/ChatMessage/ToolMessage.tsx +346 -0
- package/src/lib/ChatMessage/index.js +6 -0
- package/src/lib/Flow/core/Flow.jsx +2 -0
- package/src/lib/Flow/core/FlowNode.jsx +2 -0
- package/src/lib/Flow/core/FlowViewport.jsx +6 -3
- package/src/lib/PresetSelector/PresetSelector.tsx +112 -0
- package/src/lib/PresetSelector/index.js +1 -0
- package/src/lib/SidebarChat/ChatDrawer.tsx +407 -0
- package/src/lib/SidebarChat/SessionPopover.tsx +221 -0
- package/src/lib/SidebarChat/SidebarChat.tsx +222 -0
- package/src/lib/SidebarChat/SidebarSessionList.tsx +304 -0
- package/src/lib/SidebarChat/assets.d.ts +4 -0
- package/src/lib/SidebarChat/cleanIconName.ts +4 -0
- package/src/lib/SidebarChat/index.js +1 -0
- package/src/lib/SidebarChat/messageSFX.mp3 +0 -0
- package/src/lib/SidebarChat/types.ts +14 -0
- package/src/lib/index.js +11 -0
- package/vite/vite.js +8 -1
|
@@ -34,13 +34,18 @@ jobs:
|
|
|
34
34
|
node-version: '20'
|
|
35
35
|
registry-url: 'https://registry.npmjs.org'
|
|
36
36
|
|
|
37
|
+
- name: Setup Bun
|
|
38
|
+
uses: oven-sh/setup-bun@v2
|
|
39
|
+
with:
|
|
40
|
+
bun-version: latest
|
|
41
|
+
|
|
37
42
|
- name: Configure Git
|
|
38
43
|
run: |
|
|
39
44
|
git config user.name "github-actions[bot]"
|
|
40
45
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
41
46
|
|
|
42
47
|
- name: Install dependencies
|
|
43
|
-
run:
|
|
48
|
+
run: bun install --frozen-lockfile
|
|
44
49
|
|
|
45
50
|
- name: Bump version
|
|
46
51
|
id: version_bump
|
package/bun.lock
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"@emoji-mart/react": "^1.1.1",
|
|
12
12
|
"@emotion/react": "^11.14.0",
|
|
13
13
|
"@iconify/react": "^5.0.1",
|
|
14
|
+
"@monaco-editor/react": "^4.7.0",
|
|
14
15
|
"@mui/icons-material": "^7.3.9",
|
|
15
16
|
"@mui/lab": "^7.0.1-beta.23",
|
|
16
17
|
"@mui/material": "^7.3.9",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
"stylis": "^4.3.2",
|
|
60
61
|
"stylis-plugin-rtl": "^2.1.1",
|
|
61
62
|
"swr": "^2.2.5",
|
|
63
|
+
"use-sound": "^4.0.1",
|
|
62
64
|
"yet-another-react-lightbox": "^3.21.1",
|
|
63
65
|
},
|
|
64
66
|
"devDependencies": {
|
|
@@ -616,6 +618,10 @@
|
|
|
616
618
|
|
|
617
619
|
"@mdx-js/react": ["@mdx-js/react@3.1.1", "", { "dependencies": { "@types/mdx": "^2.0.0" }, "peerDependencies": { "@types/react": ">=16", "react": ">=16" } }, "sha512-f++rKLQgUVYDAtECQ6fn/is15GkEH9+nZPM3MS0RcxVqoTfawHvDlSCH7JbMhAM6uJ32v3eXLvLmLvjGu7PTQw=="],
|
|
618
620
|
|
|
621
|
+
"@monaco-editor/loader": ["@monaco-editor/loader@1.7.0", "", { "dependencies": { "state-local": "^1.0.6" } }, "sha512-gIwR1HrJrrx+vfyOhYmCZ0/JcWqG5kbfG7+d3f/C1LXk2EvzAbHSg3MQ5lO2sMlo9izoAZ04shohfKLVT6crVA=="],
|
|
622
|
+
|
|
623
|
+
"@monaco-editor/react": ["@monaco-editor/react@4.7.0", "", { "dependencies": { "@monaco-editor/loader": "^1.5.0" }, "peerDependencies": { "monaco-editor": ">= 0.25.0 < 1", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-cyzXQCtO47ydzxpQtCGSQGOC8Gk3ZUeBXFAxD+CWXYFo5OqZyZUonFl0DwUlTyAfRHntBfw2p3w4s9R6oe1eCA=="],
|
|
624
|
+
|
|
619
625
|
"@mui/core-downloads-tracker": ["@mui/core-downloads-tracker@7.3.9", "", {}, "sha512-MOkOCTfbMJwLshlBCKJ59V2F/uaLYfmKnN76kksj6jlGUVdI25A9Hzs08m+zjBRdLv+sK7Rqdsefe8X7h/6PCw=="],
|
|
620
626
|
|
|
621
627
|
"@mui/icons-material": ["@mui/icons-material@7.3.9", "", { "dependencies": { "@babel/runtime": "^7.28.6" }, "peerDependencies": { "@mui/material": "^7.3.9", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-BT+zPJXss8Hg/oEMRmHl17Q97bPACG4ufFSfGEdhiE96jOyR5Dz1ty7ZWt1fVGR0y1p+sSgEwQT/MNZQmoWDCw=="],
|
|
@@ -950,6 +956,8 @@
|
|
|
950
956
|
|
|
951
957
|
"@types/tough-cookie": ["@types/tough-cookie@4.0.5", "", {}, "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA=="],
|
|
952
958
|
|
|
959
|
+
"@types/trusted-types": ["@types/trusted-types@2.0.7", "", {}, "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="],
|
|
960
|
+
|
|
953
961
|
"@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="],
|
|
954
962
|
|
|
955
963
|
"@types/uuid": ["@types/uuid@9.0.8", "", {}, "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="],
|
|
@@ -1314,6 +1322,8 @@
|
|
|
1314
1322
|
|
|
1315
1323
|
"domexception": ["domexception@4.0.0", "", { "dependencies": { "webidl-conversions": "^7.0.0" } }, "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw=="],
|
|
1316
1324
|
|
|
1325
|
+
"dompurify": ["dompurify@3.4.8", "", { "optionalDependencies": { "@types/trusted-types": "^2.0.7" } }, "sha512-yb1cEmaOum7wFvOCSQxyfgVlv5D47Rc30iZWoMpbDIWTnJ6grDDQyu2KFJzB2k7u0pMuJcQ1zphH//fFnw2tjQ=="],
|
|
1326
|
+
|
|
1317
1327
|
"dot-case": ["dot-case@3.0.4", "", { "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" } }, "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w=="],
|
|
1318
1328
|
|
|
1319
1329
|
"dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
|
|
@@ -1572,6 +1582,8 @@
|
|
|
1572
1582
|
|
|
1573
1583
|
"hoist-non-react-statics": ["hoist-non-react-statics@3.3.2", "", { "dependencies": { "react-is": "^16.7.0" } }, "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw=="],
|
|
1574
1584
|
|
|
1585
|
+
"howler": ["howler@2.2.4", "", {}, "sha512-iARIBPgcQrwtEr+tALF+rapJ8qSc+Set2GJQl7xT1MQzWaVkFebdJhR3alVlSiUf5U7nAANKuj3aWpwerocD5w=="],
|
|
1586
|
+
|
|
1575
1587
|
"html-encoding-sniffer": ["html-encoding-sniffer@3.0.0", "", { "dependencies": { "whatwg-encoding": "^2.0.0" } }, "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA=="],
|
|
1576
1588
|
|
|
1577
1589
|
"html-escaper": ["html-escaper@2.0.2", "", {}, "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg=="],
|
|
@@ -1886,6 +1898,8 @@
|
|
|
1886
1898
|
|
|
1887
1899
|
"markdown-table": ["markdown-table@3.0.4", "", {}, "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw=="],
|
|
1888
1900
|
|
|
1901
|
+
"marked": ["marked@14.0.0", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ=="],
|
|
1902
|
+
|
|
1889
1903
|
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
|
|
1890
1904
|
|
|
1891
1905
|
"mdast-util-find-and-replace": ["mdast-util-find-and-replace@3.0.2", "", { "dependencies": { "@types/mdast": "^4.0.0", "escape-string-regexp": "^5.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg=="],
|
|
@@ -1992,6 +2006,8 @@
|
|
|
1992
2006
|
|
|
1993
2007
|
"minipass": ["minipass@7.1.3", "", {}, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="],
|
|
1994
2008
|
|
|
2009
|
+
"monaco-editor": ["monaco-editor@0.56.0", "", { "dependencies": { "dompurify": "3.4.8", "marked": "14.0.0" } }, "sha512-sXboRm3BeBeLm938eaiyLMe0OxzfXIlZvbv4ir/jVgQy1zDhWjgmny0WoN45fuDKhCCQsYMbBJrv/A6jd8aCUg=="],
|
|
2010
|
+
|
|
1995
2011
|
"motion-dom": ["motion-dom@11.18.1", "", { "dependencies": { "motion-utils": "^11.18.1" } }, "sha512-g76KvA001z+atjfxczdRtw/RXOM3OMSdd1f4DL77qCTF/+avrRJiawSG4yDibEQ215sr9kpinSlX2pCTJ9zbhw=="],
|
|
1996
2012
|
|
|
1997
2013
|
"motion-utils": ["motion-utils@11.18.1", "", {}, "sha512-49Kt+HKjtbJKLtgO/LKj9Ld+6vw9BjH5d9sc40R/kVyH8GLAXgT42M2NnuPcJNuA3s9ZfZBUcwIgpmZWGEE+hA=="],
|
|
@@ -2366,6 +2382,8 @@
|
|
|
2366
2382
|
|
|
2367
2383
|
"stackback": ["stackback@0.0.2", "", {}, "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw=="],
|
|
2368
2384
|
|
|
2385
|
+
"state-local": ["state-local@1.0.7", "", {}, "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w=="],
|
|
2386
|
+
|
|
2369
2387
|
"std-env": ["std-env@3.10.0", "", {}, "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg=="],
|
|
2370
2388
|
|
|
2371
2389
|
"stop-iteration-iterator": ["stop-iteration-iterator@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "internal-slot": "^1.1.0" } }, "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ=="],
|
|
@@ -2558,6 +2576,8 @@
|
|
|
2558
2576
|
|
|
2559
2577
|
"url-parse": ["url-parse@1.5.10", "", { "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" } }, "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ=="],
|
|
2560
2578
|
|
|
2579
|
+
"use-sound": ["use-sound@4.0.4", "", { "dependencies": { "howler": "^2.2.4" }, "peerDependencies": { "react": ">=16.8" } }, "sha512-SW81yRUu3K0rJHW0WVANCAK581A2qgD97+QrLxPhlAhvdIAIgw2J9d1VThdbHmPHjzCbwKE/is82V88sgFdjCg=="],
|
|
2580
|
+
|
|
2561
2581
|
"use-sync-external-store": ["use-sync-external-store@1.6.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w=="],
|
|
2562
2582
|
|
|
2563
2583
|
"uuid": ["uuid@9.0.1", "", { "bin": "dist/bin/uuid" }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="],
|
|
@@ -2698,8 +2718,6 @@
|
|
|
2698
2718
|
|
|
2699
2719
|
"@emotion/cache/stylis": ["stylis@4.2.0", "", {}, "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw=="],
|
|
2700
2720
|
|
|
2701
|
-
"@eslint/eslintrc/js-yaml": ["js-yaml@4.1.1", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": "bin/js-yaml.js" }, "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA=="],
|
|
2702
|
-
|
|
2703
2721
|
"@isaacs/cliui/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
|
|
2704
2722
|
|
|
2705
2723
|
"@isaacs/cliui/wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
|
|
@@ -2770,24 +2788,16 @@
|
|
|
2770
2788
|
|
|
2771
2789
|
"cliui/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
|
2772
2790
|
|
|
2773
|
-
"cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
|
|
2774
|
-
|
|
2775
2791
|
"concurrently/date-fns": ["date-fns@2.30.0", "", { "dependencies": { "@babel/runtime": "^7.21.0" } }, "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw=="],
|
|
2776
2792
|
|
|
2777
|
-
"cosmiconfig/js-yaml": ["js-yaml@4.1.1", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": "bin/js-yaml.js" }, "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA=="],
|
|
2778
|
-
|
|
2779
2793
|
"cssstyle/cssom": ["cssom@0.3.8", "", {}, "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg=="],
|
|
2780
2794
|
|
|
2781
2795
|
"cypress/proxy-from-env": ["proxy-from-env@1.0.0", "", {}, "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A=="],
|
|
2782
2796
|
|
|
2783
|
-
"cypress/supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
|
|
2784
|
-
|
|
2785
2797
|
"cypress/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="],
|
|
2786
2798
|
|
|
2787
2799
|
"enquirer/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
|
2788
2800
|
|
|
2789
|
-
"escodegen/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
|
|
2790
|
-
|
|
2791
2801
|
"eslint/find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="],
|
|
2792
2802
|
|
|
2793
2803
|
"eslint/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
|
@@ -2844,12 +2854,8 @@
|
|
|
2844
2854
|
|
|
2845
2855
|
"jest-util/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],
|
|
2846
2856
|
|
|
2847
|
-
"jest-validate/camelcase": ["camelcase@6.3.0", "", {}, "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA=="],
|
|
2848
|
-
|
|
2849
2857
|
"jest-validate/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
|
2850
2858
|
|
|
2851
|
-
"jest-worker/supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
|
|
2852
|
-
|
|
2853
2859
|
"log-update/slice-ansi": ["slice-ansi@4.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", "is-fullwidth-code-point": "^3.0.0" } }, "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ=="],
|
|
2854
2860
|
|
|
2855
2861
|
"log-update/wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="],
|
|
@@ -2898,12 +2904,8 @@
|
|
|
2898
2904
|
|
|
2899
2905
|
"rollup/fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
|
2900
2906
|
|
|
2901
|
-
"safe-push-apply/isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],
|
|
2902
|
-
|
|
2903
2907
|
"simple-update-notifier/semver": ["semver@7.7.4", "", { "bin": "bin/semver.js" }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
|
2904
2908
|
|
|
2905
|
-
"source-map-support/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
|
|
2906
|
-
|
|
2907
2909
|
"split-string/extend-shallow": ["extend-shallow@3.0.2", "", { "dependencies": { "assign-symbols": "^1.0.0", "is-extendable": "^1.0.1" } }, "sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q=="],
|
|
2908
2910
|
|
|
2909
2911
|
"stack-utils/escape-string-regexp": ["escape-string-regexp@2.0.0", "", {}, "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w=="],
|
|
@@ -2932,8 +2934,6 @@
|
|
|
2932
2934
|
|
|
2933
2935
|
"vite-plugin-checker/chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="],
|
|
2934
2936
|
|
|
2935
|
-
"which-builtin-type/isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],
|
|
2936
|
-
|
|
2937
2937
|
"wrap-ansi/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
|
2938
2938
|
|
|
2939
2939
|
"wrap-ansi-cjs/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
|
@@ -2952,14 +2952,10 @@
|
|
|
2952
2952
|
|
|
2953
2953
|
"@aws-crypto/util/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="],
|
|
2954
2954
|
|
|
2955
|
-
"@eslint/eslintrc/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
|
|
2956
|
-
|
|
2957
2955
|
"@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
|
|
2958
2956
|
|
|
2959
2957
|
"@isaacs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="],
|
|
2960
2958
|
|
|
2961
|
-
"@isaacs/cliui/wrap-ansi/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
|
|
2962
|
-
|
|
2963
2959
|
"@istanbuljs/load-nyc-config/find-up/locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],
|
|
2964
2960
|
|
|
2965
2961
|
"@istanbuljs/load-nyc-config/find-up/path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="],
|
|
@@ -2972,8 +2968,6 @@
|
|
|
2972
2968
|
|
|
2973
2969
|
"@jest/reporters/istanbul-lib-instrument/semver": ["semver@7.7.4", "", { "bin": "bin/semver.js" }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
|
2974
2970
|
|
|
2975
|
-
"@jest/reporters/istanbul-lib-source-maps/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
|
|
2976
|
-
|
|
2977
2971
|
"@jest/reporters/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
|
2978
2972
|
|
|
2979
2973
|
"@smithy/md5-js/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="],
|
|
@@ -2986,8 +2980,6 @@
|
|
|
2986
2980
|
|
|
2987
2981
|
"cliui/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
|
2988
2982
|
|
|
2989
|
-
"cosmiconfig/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
|
|
2990
|
-
|
|
2991
2983
|
"enquirer/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
|
2992
2984
|
|
|
2993
2985
|
"eslint/find-up/locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="],
|
|
@@ -3118,8 +3110,6 @@
|
|
|
3118
3110
|
|
|
3119
3111
|
"@aws-crypto/util/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="],
|
|
3120
3112
|
|
|
3121
|
-
"@isaacs/cliui/wrap-ansi/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
|
|
3122
|
-
|
|
3123
3113
|
"@istanbuljs/load-nyc-config/find-up/locate-path/p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="],
|
|
3124
3114
|
|
|
3125
3115
|
"@smithy/md5-js/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canmingir/link",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.56",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"link-server": "./server/server.ts"
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"@emoji-mart/react": "^1.1.1",
|
|
31
31
|
"@emotion/react": "^11.14.0",
|
|
32
32
|
"@iconify/react": "^5.0.1",
|
|
33
|
+
"@monaco-editor/react": "^4.7.0",
|
|
33
34
|
"@mui/icons-material": "^7.3.9",
|
|
34
35
|
"@mui/lab": "^7.0.1-beta.23",
|
|
35
36
|
"@mui/material": "^7.3.9",
|
|
@@ -78,6 +79,7 @@
|
|
|
78
79
|
"stylis": "^4.3.2",
|
|
79
80
|
"stylis-plugin-rtl": "^2.1.1",
|
|
80
81
|
"swr": "^2.2.5",
|
|
82
|
+
"use-sound": "^4.0.1",
|
|
81
83
|
"yet-another-react-lightbox": "^3.21.1"
|
|
82
84
|
},
|
|
83
85
|
"devDependencies": {
|
|
@@ -1,66 +1,30 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
|
|
3
3
|
import Box from "@mui/material/Box";
|
|
4
4
|
import Link from "@mui/material/Link";
|
|
5
5
|
import { RouterLink } from "../../routes/components";
|
|
6
6
|
import config from "../../config/config";
|
|
7
7
|
|
|
8
|
-
const resolvedDimensions = {};
|
|
9
|
-
|
|
10
8
|
const Logo = ({ disabledLink = false, sx, maxSize = 65, isLogin = false }) => {
|
|
11
9
|
const { icon } = config().template.login;
|
|
12
|
-
const key = `${icon}_${maxSize}_${isLogin}`;
|
|
13
|
-
|
|
14
|
-
const [dimensions, setDimensions] = useState(
|
|
15
|
-
resolvedDimensions[key] || { width: maxSize, height: maxSize },
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (!icon || resolvedDimensions[key]) return;
|
|
20
10
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const { naturalWidth, naturalHeight } = img;
|
|
24
|
-
const isSquare = naturalWidth === naturalHeight;
|
|
25
|
-
let newDimensions;
|
|
26
|
-
|
|
27
|
-
if (naturalWidth > maxSize || naturalHeight > maxSize) {
|
|
28
|
-
if (isSquare) {
|
|
29
|
-
newDimensions = {
|
|
30
|
-
width: isLogin ? maxSize : 40,
|
|
31
|
-
height: isLogin ? maxSize : 40,
|
|
32
|
-
};
|
|
33
|
-
} else {
|
|
34
|
-
const aspectRatio = naturalWidth / naturalHeight;
|
|
35
|
-
if (naturalWidth >= naturalHeight) {
|
|
36
|
-
newDimensions = {
|
|
37
|
-
width: maxSize,
|
|
38
|
-
height: Math.round(maxSize / aspectRatio),
|
|
39
|
-
};
|
|
40
|
-
} else {
|
|
41
|
-
newDimensions = {
|
|
42
|
-
width: Math.round(maxSize * aspectRatio),
|
|
43
|
-
height: maxSize,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
newDimensions = { width: naturalWidth, height: naturalHeight };
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
resolvedDimensions[key] = newDimensions;
|
|
52
|
-
setDimensions(newDimensions);
|
|
53
|
-
};
|
|
54
|
-
img.src = icon;
|
|
55
|
-
}, [icon, maxSize, key]);
|
|
11
|
+
const [isSquare, setIsSquare] = useState(false);
|
|
12
|
+
const squareCap = isSquare && !isLogin ? 40 : maxSize;
|
|
56
13
|
|
|
57
14
|
const logo = (
|
|
58
15
|
<Box
|
|
59
16
|
component="img"
|
|
60
17
|
src={icon}
|
|
18
|
+
onLoad={(e) => {
|
|
19
|
+
const { naturalWidth, naturalHeight } = e.currentTarget;
|
|
20
|
+
setIsSquare(naturalWidth === naturalHeight);
|
|
21
|
+
}}
|
|
61
22
|
sx={{
|
|
62
|
-
|
|
63
|
-
|
|
23
|
+
maxWidth: squareCap,
|
|
24
|
+
maxHeight: squareCap,
|
|
25
|
+
width: "auto",
|
|
26
|
+
height: "auto",
|
|
27
|
+
objectFit: "contain",
|
|
64
28
|
cursor: "pointer",
|
|
65
29
|
...sx,
|
|
66
30
|
}}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import Editor from "@monaco-editor/react";
|
|
2
|
+
import ReactMarkdown from "react-markdown";
|
|
3
|
+
import { alpha } from "@mui/material/styles";
|
|
4
|
+
|
|
5
|
+
import remarkGfm from "remark-gfm";
|
|
6
|
+
|
|
7
|
+
import { Box, Stack } from "@mui/material";
|
|
8
|
+
|
|
9
|
+
import React, { memo, useMemo } from "react";
|
|
10
|
+
|
|
11
|
+
function tryParseJson(content: string): object | null {
|
|
12
|
+
const trimmed = content.trim();
|
|
13
|
+
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return null;
|
|
14
|
+
try {
|
|
15
|
+
return JSON.parse(trimmed);
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const JsonViewer: React.FC<{ content: string }> = memo(({ content }) => {
|
|
22
|
+
const formatted = useMemo(() => {
|
|
23
|
+
try {
|
|
24
|
+
return JSON.stringify(JSON.parse(content), null, 2);
|
|
25
|
+
} catch {
|
|
26
|
+
return content;
|
|
27
|
+
}
|
|
28
|
+
}, [content]);
|
|
29
|
+
|
|
30
|
+
const lineCount = formatted.split("\n").length;
|
|
31
|
+
const height = Math.min(Math.max(lineCount * 19 + 24, 60), 300);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Box
|
|
35
|
+
sx={{
|
|
36
|
+
border: (theme) =>
|
|
37
|
+
`1px solid ${alpha(theme.palette.primary.main, 0.25)}`,
|
|
38
|
+
borderRadius: 1,
|
|
39
|
+
overflow: "hidden",
|
|
40
|
+
bgcolor: "#1e1e1e",
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<Editor
|
|
44
|
+
height={`${height}px`}
|
|
45
|
+
defaultLanguage="json"
|
|
46
|
+
value={formatted}
|
|
47
|
+
theme="vs-dark"
|
|
48
|
+
options={{
|
|
49
|
+
readOnly: true,
|
|
50
|
+
minimap: { enabled: false },
|
|
51
|
+
fontSize: 12,
|
|
52
|
+
lineNumbers: "off",
|
|
53
|
+
scrollBeyondLastLine: false,
|
|
54
|
+
wordWrap: "on",
|
|
55
|
+
tabSize: 2,
|
|
56
|
+
folding: false,
|
|
57
|
+
glyphMargin: false,
|
|
58
|
+
lineDecorationsWidth: 0,
|
|
59
|
+
lineNumbersMinChars: 0,
|
|
60
|
+
padding: { top: 8, bottom: 8 },
|
|
61
|
+
scrollbar: { vertical: "hidden", horizontal: "hidden" },
|
|
62
|
+
renderLineHighlight: "none",
|
|
63
|
+
selectionHighlight: false,
|
|
64
|
+
occurrencesHighlight: "off",
|
|
65
|
+
cursorStyle: "line",
|
|
66
|
+
contextmenu: false,
|
|
67
|
+
domReadOnly: true,
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
</Box>
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const AIMessage: React.FC<{
|
|
75
|
+
content: string;
|
|
76
|
+
messageRef?: React.RefObject<HTMLDivElement>;
|
|
77
|
+
}> = memo(({ content, messageRef }) => {
|
|
78
|
+
const parsedJson = useMemo(() => tryParseJson(content), [content]);
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Stack
|
|
82
|
+
ref={messageRef}
|
|
83
|
+
sx={{
|
|
84
|
+
p: 2,
|
|
85
|
+
alignContent: "flex-start",
|
|
86
|
+
justifyContent: "flex-start",
|
|
87
|
+
backgroundColor: (theme) => alpha(theme.palette.primary.dark, 0.4),
|
|
88
|
+
borderRadius: 2,
|
|
89
|
+
height: "auto",
|
|
90
|
+
mt: 1.5,
|
|
91
|
+
boxShadow: 1,
|
|
92
|
+
border: (theme) =>
|
|
93
|
+
`1px solid ${alpha(theme.palette.primary.light, 0.2)}`,
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
{parsedJson ? (
|
|
97
|
+
<JsonViewer content={content} />
|
|
98
|
+
) : (
|
|
99
|
+
<Box
|
|
100
|
+
sx={{
|
|
101
|
+
width: "100%",
|
|
102
|
+
"& p": {
|
|
103
|
+
margin: "0.5em 0",
|
|
104
|
+
fontSize: "0.95rem",
|
|
105
|
+
lineHeight: 1.6,
|
|
106
|
+
color: (theme) => theme.palette.text.primary,
|
|
107
|
+
},
|
|
108
|
+
"& p:first-of-type": { marginTop: 0 },
|
|
109
|
+
"& p:last-of-type": { marginBottom: 0 },
|
|
110
|
+
"& code": {
|
|
111
|
+
backgroundColor: (theme) => alpha(theme.palette.grey[900], 0.6),
|
|
112
|
+
padding: "2px 6px",
|
|
113
|
+
borderRadius: "4px",
|
|
114
|
+
fontSize: "0.9em",
|
|
115
|
+
fontFamily: "monospace",
|
|
116
|
+
},
|
|
117
|
+
"& pre": {
|
|
118
|
+
backgroundColor: (theme) => alpha(theme.palette.grey[900], 0.7),
|
|
119
|
+
padding: "12px",
|
|
120
|
+
borderRadius: "6px",
|
|
121
|
+
overflow: "auto",
|
|
122
|
+
margin: "0.75em 0",
|
|
123
|
+
},
|
|
124
|
+
"& pre code": { backgroundColor: "transparent", padding: 0 },
|
|
125
|
+
"& ul, & ol": {
|
|
126
|
+
marginLeft: "1.5em",
|
|
127
|
+
marginTop: "0.5em",
|
|
128
|
+
marginBottom: "0.5em",
|
|
129
|
+
},
|
|
130
|
+
"& li": { marginBottom: "0.25em", lineHeight: 1.6 },
|
|
131
|
+
"& blockquote": {
|
|
132
|
+
borderLeft: (theme) => `3px solid ${theme.palette.primary.main}`,
|
|
133
|
+
paddingLeft: "1em",
|
|
134
|
+
marginLeft: 0,
|
|
135
|
+
fontStyle: "italic",
|
|
136
|
+
opacity: 0.9,
|
|
137
|
+
},
|
|
138
|
+
"& strong": { fontWeight: 600 },
|
|
139
|
+
"& a": {
|
|
140
|
+
color: (theme) => theme.palette.primary.light,
|
|
141
|
+
textDecoration: "underline",
|
|
142
|
+
},
|
|
143
|
+
"& h1, & h2, & h3, & h4, & h5, & h6": {
|
|
144
|
+
marginTop: "0.75em",
|
|
145
|
+
marginBottom: "0.5em",
|
|
146
|
+
fontWeight: 600,
|
|
147
|
+
},
|
|
148
|
+
"& hr": {
|
|
149
|
+
border: "none",
|
|
150
|
+
borderTop: (theme) =>
|
|
151
|
+
`1px solid ${alpha(theme.palette.grey[500], 0.3)}`,
|
|
152
|
+
margin: "1em 0",
|
|
153
|
+
},
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
<ReactMarkdown remarkPlugins={[remarkGfm]}>{content}</ReactMarkdown>
|
|
157
|
+
</Box>
|
|
158
|
+
)}
|
|
159
|
+
</Stack>
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export { AIMessage };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Iconify } from "@canmingir/link/platform/components";
|
|
2
|
+
import { alpha } from "@mui/material/styles";
|
|
3
|
+
|
|
4
|
+
import { Box, IconButton, Stack } from "@mui/material";
|
|
5
|
+
import React, { memo } from "react";
|
|
6
|
+
|
|
7
|
+
const ErrorMessage: React.FC<{
|
|
8
|
+
content: string;
|
|
9
|
+
messageRef?: React.RefObject<HTMLDivElement>;
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
}> = memo(({ content, messageRef, onClose }) => (
|
|
12
|
+
<Stack
|
|
13
|
+
ref={messageRef}
|
|
14
|
+
sx={{
|
|
15
|
+
p: 2.5,
|
|
16
|
+
alignContent: "flex-start",
|
|
17
|
+
justifyContent: "flex-start",
|
|
18
|
+
backgroundColor: (theme) => alpha(theme.palette.error.dark, 0.2),
|
|
19
|
+
borderRadius: 2,
|
|
20
|
+
height: "auto",
|
|
21
|
+
mt: 1.5,
|
|
22
|
+
boxShadow: 1,
|
|
23
|
+
border: (theme) => `1px solid ${alpha(theme.palette.error.light, 0.4)}`,
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<Stack direction="row" spacing={1} alignItems="center">
|
|
27
|
+
<Iconify
|
|
28
|
+
icon="solar:danger-triangle-bold"
|
|
29
|
+
sx={{
|
|
30
|
+
width: 20,
|
|
31
|
+
height: 20,
|
|
32
|
+
color: (theme) => theme.palette.error.main,
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
<Box
|
|
36
|
+
sx={{
|
|
37
|
+
width: "100%",
|
|
38
|
+
color: (theme) => theme.palette.error.light,
|
|
39
|
+
fontSize: "0.95rem",
|
|
40
|
+
lineHeight: 1.6,
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{content}
|
|
44
|
+
</Box>
|
|
45
|
+
{onClose && (
|
|
46
|
+
<IconButton
|
|
47
|
+
onClick={onClose}
|
|
48
|
+
size="small"
|
|
49
|
+
sx={{
|
|
50
|
+
color: (theme) => theme.palette.error.light,
|
|
51
|
+
"&:hover": {
|
|
52
|
+
backgroundColor: (theme) => alpha(theme.palette.error.main, 0.1),
|
|
53
|
+
},
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<Iconify icon="mdi:close" sx={{ width: 18, height: 18 }} />
|
|
57
|
+
</IconButton>
|
|
58
|
+
)}
|
|
59
|
+
</Stack>
|
|
60
|
+
</Stack>
|
|
61
|
+
));
|
|
62
|
+
|
|
63
|
+
export { ErrorMessage };
|