create-blocklet 0.9.16 → 0.9.17

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.
Files changed (49) hide show
  1. package/index.js +5 -0
  2. package/package.json +1 -1
  3. package/templates/did-connect-dapp/package.json +1 -1
  4. package/templates/did-wallet-dapp/package.json +1 -1
  5. package/templates/react-aigne-dapp/.eslintrc.js +13 -0
  6. package/templates/react-aigne-dapp/README.md +34 -0
  7. package/templates/react-aigne-dapp/api/dev.ts +7 -0
  8. package/templates/react-aigne-dapp/api/src/agents/chatbot.ts +30 -0
  9. package/templates/react-aigne-dapp/api/src/agents/index.ts +1 -0
  10. package/templates/react-aigne-dapp/api/src/agents/runtime.ts +16 -0
  11. package/templates/react-aigne-dapp/api/src/agents/type.ts +4 -0
  12. package/templates/react-aigne-dapp/api/src/index.ts +51 -0
  13. package/templates/react-aigne-dapp/api/src/libs/auth.ts +17 -0
  14. package/templates/react-aigne-dapp/api/src/libs/env.ts +6 -0
  15. package/templates/react-aigne-dapp/api/src/libs/logger.ts +3 -0
  16. package/templates/react-aigne-dapp/api/third.d.ts +17 -0
  17. package/templates/react-aigne-dapp/blocklet.md +3 -0
  18. package/templates/react-aigne-dapp/blocklet.yml +55 -0
  19. package/templates/react-aigne-dapp/index.html +17 -0
  20. package/templates/react-aigne-dapp/package.json +122 -0
  21. package/templates/react-aigne-dapp/src/app.tsx +28 -0
  22. package/templates/react-aigne-dapp/src/assets/blocklet.svg +16 -0
  23. package/templates/react-aigne-dapp/src/components/MarkdownRenderer/index.tsx +102 -0
  24. package/templates/react-aigne-dapp/src/components/ScrollView.tsx +95 -0
  25. package/templates/react-aigne-dapp/src/contexts/session.tsx +11 -0
  26. package/templates/react-aigne-dapp/src/env.d.ts +3 -0
  27. package/templates/react-aigne-dapp/src/index.css +66 -0
  28. package/templates/react-aigne-dapp/src/index.tsx +8 -0
  29. package/templates/react-aigne-dapp/src/pages/home.css +44 -0
  30. package/templates/react-aigne-dapp/src/pages/home.tsx +183 -0
  31. package/templates/react-aigne-dapp/template-info.json +12 -0
  32. package/templates/react-aigne-dapp/tsconfig.api.json +12 -0
  33. package/templates/react-aigne-dapp/tsconfig.eslint.json +9 -0
  34. package/templates/react-aigne-dapp/tsconfig.json +102 -0
  35. package/templates/react-aigne-dapp/vite.config.mts +19 -0
  36. package/templates/react-dapp/package.json +1 -1
  37. package/templates/react-dapp-ts/package.json +1 -1
  38. package/templates/react-gun-dapp/package.json +1 -1
  39. package/templates/react-static/package.json +1 -1
  40. package/templates/solidjs-dapp/package.json +1 -1
  41. package/templates/solidjs-static/package.json +1 -1
  42. package/templates/svelte-dapp/package.json +1 -1
  43. package/templates/svelte-static/package.json +1 -1
  44. package/templates/todo-list-example/package.json +1 -1
  45. package/templates/vue-dapp/package.json +1 -1
  46. package/templates/vue-static/package.json +1 -1
  47. package/templates/vue-ts-static/package.json +1 -1
  48. package/templates/vue2-dapp/package.json +1 -1
  49. package/templates/vue2-static/package.json +1 -1
package/index.js CHANGED
@@ -45,6 +45,11 @@ const templates = [
45
45
  display: '[dapp] react + express + typescript',
46
46
  color: yellow,
47
47
  },
48
+ {
49
+ name: 'react-aigne-dapp',
50
+ display: '[dapp] react + express + AIGNE Framework',
51
+ color: yellow,
52
+ },
48
53
  {
49
54
  name: 'did-wallet-dapp',
50
55
  display: '[dapp: did-wallet] Full stack app (react.js + express.js) with DID Wallet integration',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-blocklet",
3
- "version": "0.9.16",
3
+ "version": "0.9.17",
4
4
  "exports": "./index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:blocklet/create-blocklet.git",
@@ -77,7 +77,7 @@
77
77
  "rimraf": "^5.0.10",
78
78
  "simple-git-hooks": "^2.11.1",
79
79
  "vite": "^5.4.8",
80
- "vite-plugin-blocklet": "^0.9.16",
80
+ "vite-plugin-blocklet": "^0.9.17",
81
81
  "vite-plugin-svgr": "^4.2.0",
82
82
  "zx": "^8.1.8"
83
83
  },
@@ -52,7 +52,7 @@
52
52
  "simple-git-hooks": "^2.11.1",
53
53
  "vite": "^5.4.8",
54
54
  "vite-node": "^2.1.1",
55
- "vite-plugin-blocklet": "^0.9.16",
55
+ "vite-plugin-blocklet": "^0.9.17",
56
56
  "vite-plugin-require": "^1.2.14",
57
57
  "vite-plugin-svgr": "^4.2.0",
58
58
  "zx": "^8.1.8"
@@ -0,0 +1,13 @@
1
+ const { join } = require('path');
2
+
3
+ module.exports = {
4
+ root: true,
5
+ extends: '@arcblock/eslint-config-ts',
6
+ parserOptions: {
7
+ project: [join(__dirname, 'tsconfig.eslint.json'), join(__dirname, 'tsconfig.json')],
8
+ },
9
+ rules: {
10
+ 'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
11
+ 'no-await-in-loop': 'warn',
12
+ },
13
+ };
@@ -0,0 +1,34 @@
1
+ ## PROJECT_DESCRIPTION
2
+ This blocklet is a dapp project, which means this is a full-stack application. It's contained both `server` and `client` code.
3
+
4
+ ## Launch on Blocklet Server
5
+
6
+ [![Launch on Blocklet Server](https://assets.arcblock.io/icons/launch_on_blocklet_server.svg)](https://install.arcblock.io/launch?action=blocklet-install&meta_url=https%3A%2F%2Fgithub.com%2Fblocklet%2Fpages-kit%2Freleases%2Fdownload%2Fv0.1.33%2Fblocklet.json)
7
+
8
+ ## FILE_STRUCTURE
9
+
10
+ - public/ - static files
11
+ - favicon.ico - favicon
12
+ - favicon.svg - favicon
13
+ - index.html - main html file, template for react
14
+ - screenshots/ - Screenshots
15
+ - api/
16
+ - src/ - Api side code
17
+ - hooks/ - blocklet lifecycle hooks
18
+ - libs/ - Api side libraries
19
+ - middlewares/ - Api side middlewares
20
+ - routes/ - Api side routes
21
+ - index.ts - Api side entry point
22
+ - src/ - Client side code (A standard react app structure)
23
+ - .env - Environment variables
24
+ - .env.local - Local environment variables
25
+ - .eslintrc.js - ESLint configuration
26
+ - .gitignore - Git ignore file
27
+ - .prettierrc - Prettier configuration
28
+ - blocklet.md - Blocklet README
29
+ - blocklet.yml - Blocklet configuration
30
+ - LICENSE - License file
31
+ - logo.png - Blocklet logo file
32
+ - package.json - Npm package file
33
+ - README.md - A guide for this blocklet
34
+ - version - Version file
@@ -0,0 +1,7 @@
1
+ import { app, server } from './src';
2
+
3
+ import('vite-plugin-blocklet').then(({ setupClient }) => {
4
+ setupClient(app, {
5
+ server,
6
+ });
7
+ });
@@ -0,0 +1,30 @@
1
+ import { LLMAgent } from '@aigne/core';
2
+ import { runtime } from './runtime';
3
+
4
+ const chatbot = LLMAgent.create({
5
+ context: runtime,
6
+ name: 'chatbot',
7
+ inputs: {
8
+ question: {
9
+ type: 'string',
10
+ required: true,
11
+ },
12
+ },
13
+ modelOptions: {
14
+ model: 'gpt-4o',
15
+ temperature: 0.1,
16
+ },
17
+ messages: [
18
+ { role: 'system', content: 'You are a AI chat bot' },
19
+ { role: 'user', content: '{{question}}' },
20
+ ],
21
+ outputs: {
22
+ $text: {
23
+ type: 'string',
24
+ required: true,
25
+ },
26
+ },
27
+ });
28
+
29
+ // eslint-disable-next-line import/prefer-default-export
30
+ export { chatbot };
@@ -0,0 +1 @@
1
+ export * from './chatbot';
@@ -0,0 +1,16 @@
1
+ import { OpenaiLLMModel } from '@aigne/core';
2
+ import { AIGNERuntime } from '@aigne/runtime';
3
+ import config from '@blocklet/sdk/lib/config';
4
+
5
+ export const llmModel = new OpenaiLLMModel({
6
+ model: 'gpt-4o-mini',
7
+ apiKey: config.env.OPENAI_API_KEY || '',
8
+ });
9
+
10
+ export const runtime = new AIGNERuntime({
11
+ llmModel,
12
+ });
13
+
14
+ config.events.on(config.Events.envUpdate, () => {
15
+ llmModel.setApiKey(config.env.OPENAI_API_KEY || '');
16
+ });
@@ -0,0 +1,4 @@
1
+ export interface ChatbotResponse {
2
+ $text: string;
3
+ status?: { loading?: boolean; message?: string };
4
+ }
@@ -0,0 +1,51 @@
1
+ import 'express-async-errors';
2
+ import 'reflect-metadata';
3
+ import path from 'path';
4
+
5
+ import cookieParser from 'cookie-parser';
6
+ import cors from 'cors';
7
+ import dotenv from 'dotenv-flow';
8
+ import express, { ErrorRequestHandler } from 'express';
9
+ import fallback from '@blocklet/sdk/lib/middlewares/fallback';
10
+ import { createMiddleware } from '@aigne/runtime/middleware';
11
+ import logger from './libs/logger';
12
+ import { runtime } from './agents/runtime';
13
+ import './agents';
14
+
15
+ dotenv.config();
16
+
17
+ const { name, version } = require('../../package.json');
18
+
19
+ export const app = express();
20
+
21
+ app.set('trust proxy', true);
22
+ app.use(cookieParser());
23
+ app.use(express.json({ limit: '1 mb' }));
24
+ app.use(express.urlencoded({ extended: true, limit: '1 mb' }));
25
+ app.use(cors());
26
+
27
+ app.use(createMiddleware(runtime));
28
+
29
+ const router = express.Router();
30
+ app.use(router);
31
+
32
+ const isProduction = process.env.NODE_ENV === 'production' || process.env.ABT_NODE_SERVICE_ENV === 'production';
33
+
34
+ if (isProduction) {
35
+ const staticDir = path.resolve(process.env.BLOCKLET_APP_DIR!, 'dist');
36
+ app.use(express.static(staticDir, { maxAge: '30d', index: false }));
37
+ app.use(fallback('index.html', { root: staticDir }));
38
+
39
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
40
+ app.use(<ErrorRequestHandler>((err, _req, res, _next) => {
41
+ logger.error(err.stack);
42
+ res.status(500).send('Something broke!');
43
+ }));
44
+ }
45
+
46
+ const port = parseInt(process.env.BLOCKLET_PORT!, 10);
47
+
48
+ export const server = app.listen(port, (err?: any) => {
49
+ if (err) throw err;
50
+ logger.info(`> ${name} v${version} ready on ${port}`);
51
+ });
@@ -0,0 +1,17 @@
1
+ import path from 'path';
2
+
3
+ import AuthStorage from '@arcblock/did-auth-storage-nedb';
4
+ import getWallet from '@blocklet/sdk/lib/wallet';
5
+ import WalletAuthenticator from '@blocklet/sdk/lib/wallet-authenticator';
6
+ import WalletHandler from '@blocklet/sdk/lib/wallet-handler';
7
+
8
+ import env from './env';
9
+
10
+ export const wallet = getWallet();
11
+ export const authenticator = new WalletAuthenticator();
12
+ export const handlers = new WalletHandler({
13
+ authenticator,
14
+ tokenStorage: new AuthStorage({
15
+ dbPath: path.join(env.dataDir, 'auth.db'),
16
+ }),
17
+ });
@@ -0,0 +1,6 @@
1
+ import env from '@blocklet/sdk/lib/env';
2
+
3
+ export default {
4
+ ...env,
5
+ chainHost: process.env.CHAIN_HOST || '',
6
+ };
@@ -0,0 +1,3 @@
1
+ const logger = console;
2
+
3
+ export default logger;
@@ -0,0 +1,17 @@
1
+ declare module 'vite-plugin-blocklet';
2
+
3
+ declare module 'express-history-api-fallback';
4
+
5
+ declare module 'express-async-errors';
6
+
7
+ namespace Express {
8
+ interface Request {
9
+ user?: {
10
+ did: string;
11
+ role: string;
12
+ fullName: string;
13
+ provider: string;
14
+ walletOS: string;
15
+ };
16
+ }
17
+ }
@@ -0,0 +1,3 @@
1
+ # template-aigne-react
2
+
3
+ A react template for creating a new blocklet project.
@@ -0,0 +1,55 @@
1
+ title: Blocklet Template React AIGNE Framework
2
+ description: A Blocklet DAPP blocklet with AIGNE Framework
3
+ keywords:
4
+ - blocklet
5
+ - react
6
+ - aigne
7
+ group: dapp
8
+ name: react-aigne-dapp
9
+ did: 'z8ia3pSfT7UZVjCjGq9PD78GQrdwzptd6iRDG'
10
+ main: api/dist/index.js
11
+ author:
12
+ name: Blocklet
13
+ email: blocklet@arcblock.io
14
+ repository:
15
+ type: git
16
+ url: 'git+https://github.com/blocklet/create-blocklet.git'
17
+ specVersion: 1.2.8
18
+ version: 0.1.0
19
+ logo: logo.png
20
+ files:
21
+ - dist
22
+ - logo.png
23
+ - screenshots
24
+ interfaces:
25
+ - type: web
26
+ name: publicUrl
27
+ path: /
28
+ prefix: '*'
29
+ port: BLOCKLET_PORT
30
+ protocol: http
31
+ community: ''
32
+ documentation: ''
33
+ homepage: ''
34
+ license: ''
35
+ payment:
36
+ price: []
37
+ share: []
38
+ timeout:
39
+ start: 60
40
+ requirements:
41
+ server: '>=1.16.28'
42
+ os: '*'
43
+ cpu: '*'
44
+ scripts:
45
+ dev: npm run start
46
+ capabilities: {}
47
+ screenshots: []
48
+ components: []
49
+ environments:
50
+ - name: OPENAI_API_KEY
51
+ description: 'OpenAI API Key'
52
+ required: true
53
+ default: ''
54
+ secure: true
55
+ shared: false
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <link rel="icon" href="/favicon.ico?imageFilter=convert&f=png&w=32" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
8
+ <meta name="theme-color" content="#4F6AF5" />
9
+ </head>
10
+
11
+ <body>
12
+ <noscript> You need to enable JavaScript to run this app. </noscript>
13
+ <div id="app"></div>
14
+ <script type="module" src="/src/index.tsx"></script>
15
+ </body>
16
+
17
+ </html>
@@ -0,0 +1,122 @@
1
+ {
2
+ "name": "template-react-aigne-dapp",
3
+ "private": true,
4
+ "version": "0.1.0",
5
+ "scripts": {
6
+ "dev": "blocklet dev",
7
+ "lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
8
+ "lint:fix": "npm run lint -- --fix",
9
+ "start": "cross-env NODE_ENV=development nodemon api/dev.ts -w api",
10
+ "clean": "node scripts/build-clean.mjs",
11
+ "bundle": "tsc --noEmit && npm run bundle:client && npm run bundle:api",
12
+ "bundle:client": "vite build",
13
+ "bundle:api": "npm run clean && tsc -p tsconfig.api.json && blocklet bundle --compact --create-release",
14
+ "deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
15
+ "upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
16
+ "prepare": "npx simple-git-hooks",
17
+ "bump-version": "zx --quiet scripts/bump-version.mjs"
18
+ },
19
+ "lint-staged": {
20
+ "*.{mjs,js,jsx,ts,tsx}": [
21
+ "prettier --write",
22
+ "eslint"
23
+ ],
24
+ "*.{css,less,scss,json,graphql}": [
25
+ "prettier --write"
26
+ ]
27
+ },
28
+ "browserslist": {
29
+ "production": [
30
+ ">0.2%",
31
+ "not dead",
32
+ "not op_mini all"
33
+ ],
34
+ "development": [
35
+ "last 1 chrome version",
36
+ "last 1 firefox version",
37
+ "last 1 safari version"
38
+ ]
39
+ },
40
+ "dependencies": {
41
+ "@arcblock/did-connect": "^2.11.23",
42
+ "@aigne/core": "1.0.8",
43
+ "@aigne/memory": "1.0.8",
44
+ "@aigne/runtime": "1.0.8",
45
+ "@arcblock/did-auth": "^1.19.2",
46
+ "@arcblock/did-auth-storage-nedb": "^1.7.1",
47
+ "@blocklet/sdk": "^1.16.37",
48
+ "@ocap/client": "^1.19.2",
49
+ "@ocap/mcrypto": "^1.19.2",
50
+ "@ocap/wallet": "^1.19.2",
51
+ "axios": "^1.7.7",
52
+ "cookie-parser": "^1.4.6",
53
+ "cors": "^2.8.5",
54
+ "dotenv-flow": "^4.1.0",
55
+ "express": "^4.21.0",
56
+ "express-async-errors": "^3.1.1",
57
+ "immer": "^10.1.1",
58
+ "@mui/icons-material": "^5.16.7",
59
+ "@mui/material": "^6.2.1",
60
+ "nanoid": "^3.3.7",
61
+ "react-markdown": "^9.0.1",
62
+ "react-scroll-to-bottom": "^4.2.0",
63
+ "react-syntax-highlighter": "^15.6.1",
64
+ "reflect-metadata": "^0.2.2",
65
+ "remark-gfm": "^4.0.0",
66
+ "ufo": "^1.5.4",
67
+ "@blocklet/ui-react": "^2.11.29"
68
+ },
69
+ "devDependencies": {
70
+ "@arcblock/eslint-config": "^0.3.3",
71
+ "@arcblock/eslint-config-ts": "^0.3.3",
72
+ "@trivago/prettier-plugin-sort-imports": "^4.3.0",
73
+ "@types/cookie-parser": "^1.4.7",
74
+ "@types/cors": "^2.8.17",
75
+ "@types/dotenv-flow": "^3.3.3",
76
+ "@types/express": "^4.17.21",
77
+ "@types/node": "^20.16.10",
78
+ "@types/react": "^18.3.10",
79
+ "@types/react-dom": "^18.3.0",
80
+ "@vitejs/plugin-react": "^4.3.2",
81
+ "@types/react-scroll-to-bottom": "^4.2.5",
82
+ "@types/react-syntax-highlighter": "^15.5.13",
83
+ "bumpp": "^9.6.1",
84
+ "cross-env": "^7.0.3",
85
+ "eslint": "^8.57.1",
86
+ "import-sort-style-module": "^6.0.0",
87
+ "lint-staged": "^15.2.10",
88
+ "nodemon": "^3.1.7",
89
+ "npm-run-all": "^4.1.5",
90
+ "prettier": "^3.3.3",
91
+ "prettier-plugin-import-sort": "^0.0.7",
92
+ "react": "~18.2.0",
93
+ "react-dom": "~18.2.0",
94
+ "react-router-dom": "^6.26.2",
95
+ "rimraf": "^5.0.10",
96
+ "simple-git-hooks": "^2.11.1",
97
+ "ts-node": "^10.9.2",
98
+ "typescript": "^5.6.2",
99
+ "vite": "^5.4.8",
100
+ "vite-plugin-blocklet": "^0.9.17",
101
+ "vite-plugin-svgr": "^4.2.0",
102
+ "zx": "^8.1.8"
103
+ },
104
+ "resolutions": {
105
+ "@aigne/core": "1.0.8",
106
+ "@aigne/memory": "1.0.8",
107
+ "@aigne/runtime": "1.0.8"
108
+ },
109
+ "importSort": {
110
+ ".js, .jsx, .mjs": {
111
+ "parser": "babylon",
112
+ "style": "module"
113
+ },
114
+ ".ts, .tsx": {
115
+ "style": "module",
116
+ "parser": "typescript"
117
+ }
118
+ },
119
+ "simple-git-hooks": {
120
+ "pre-commit": "npx lint-staged"
121
+ }
122
+ }
@@ -0,0 +1,28 @@
1
+ import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
2
+
3
+ import Home from './pages/home';
4
+ import { SessionProvider } from './contexts/session';
5
+
6
+ function App() {
7
+ return (
8
+ <div className="app">
9
+ <Routes>
10
+ <Route path="/" element={<Home />} />
11
+ <Route path="*" element={<Navigate to="/" />} />
12
+ </Routes>
13
+ </div>
14
+ );
15
+ }
16
+
17
+ export default function WrappedApp() {
18
+ // While the blocklet is deploy to a sub path, this will be work properly.
19
+ const basename = window?.blocklet?.prefix || '/';
20
+
21
+ return (
22
+ <Router basename={basename}>
23
+ <SessionProvider>
24
+ <App />
25
+ </SessionProvider>
26
+ </Router>
27
+ );
28
+ }
@@ -0,0 +1,16 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" fill="none">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M50.152 10.6417L31.72 0L13.288 10.6417V24.7942L1 31.8887V53.1722L19.432 63.8139L31.6902 56.7366L31.72 56.7538L31.7498 56.7366L44.008 63.8139L62.44 53.1722V31.8887L50.152 24.7942V10.6417ZM60.52 32.9972L48.232 25.9027V11.7502L31.72 2.21703L15.208 11.7502V25.9028L2.92 32.9972V52.0636L19.432 61.5968L31.6902 54.5196L31.72 54.5368L31.7498 54.5196L44.008 61.5968L60.52 52.0636V32.9972Z" fill="url(#paint0_linear_2412_13557)"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M50.1521 24.8307L31.7201 14.189L13.2881 24.8307V46.1141L31.7201 56.7558L50.1521 46.1141V24.8307ZM15.2081 25.9392L31.7201 16.406L48.2321 25.9392V45.0056L31.7201 54.5388L15.2081 45.0056V25.9392ZM28.5464 23.0464C28.6641 22.6342 29.0408 22.3501 29.4695 22.3501H33.9707C34.3993 22.3501 34.776 22.6342 34.8938 23.0464L35.7504 26.0447L37.8696 27.2681L40.8945 26.5109C41.3103 26.4068 41.7447 26.591 41.959 26.9622L44.2096 30.8604C44.424 31.2316 44.3662 31.6998 44.0682 32.0079L41.8999 34.2489V36.6959L44.0682 38.9369C44.3662 39.245 44.424 39.7133 44.2096 40.0845L41.959 43.9827C41.7447 44.3539 41.3103 44.538 40.8945 44.4339L37.8696 43.6767L35.7504 44.9002L34.8938 47.8984C34.776 48.3106 34.3993 48.5947 33.9707 48.5947H29.4695C29.0408 48.5947 28.6641 48.3106 28.5464 47.8984L27.6897 44.9002L25.5706 43.6767L22.5457 44.4339C22.1299 44.538 21.6955 44.3539 21.4812 43.9827L19.2305 40.0845C19.0162 39.7133 19.0739 39.245 19.372 38.9369L21.5402 36.6959V34.2489L19.372 32.0079C19.0739 31.6998 19.0162 31.2316 19.2305 30.8604L21.4812 26.9622C21.6955 26.591 22.1299 26.4068 22.5457 26.5109L25.5706 27.2681L27.6897 26.0447L28.5464 23.0464ZM28.9861 27.5132C29.2018 27.3887 29.3607 27.1851 29.4292 26.9456L30.1936 24.2701H33.2466L34.011 26.9456C34.0794 27.1851 34.2383 27.3887 34.4541 27.5132L37.2459 29.1251C37.4617 29.2497 37.7174 29.2855 37.9591 29.225L40.6583 28.5493L42.1848 31.1932L40.25 33.193C40.0768 33.372 39.9799 33.6114 39.9799 33.8605V37.0843C39.9799 37.3334 40.0768 37.5728 40.25 37.7518L42.1848 39.7516L40.6583 42.3955L37.9591 41.7198C37.7174 41.6593 37.4617 41.6951 37.2459 41.8197L34.4541 43.4316C34.2383 43.5561 34.0794 43.7597 34.011 43.9992L33.2466 46.6747H30.1936L29.4292 43.9992C29.3607 43.7597 29.2018 43.5561 28.9861 43.4316L26.1942 41.8197C25.9785 41.6951 25.7228 41.6593 25.4811 41.7198L22.7819 42.3955L21.2554 39.7516L23.1902 37.7518C23.3634 37.5728 23.4602 37.3334 23.4602 37.0843V33.8605C23.4602 33.6114 23.3634 33.372 23.1902 33.193L21.2554 31.1932L22.7819 28.5493L25.4811 29.225C25.7228 29.2855 25.9785 29.2497 26.1942 29.1251L28.9861 27.5132ZM31.7201 41.6407C28.3134 41.6407 25.5517 38.8791 25.5517 35.4724C25.5517 32.0657 28.3134 29.3041 31.7201 29.3041C35.1268 29.3041 37.8884 32.0657 37.8884 35.4724C37.8884 38.8791 35.1268 41.6407 31.7201 41.6407ZM35.9684 35.4724C35.9684 37.8187 34.0664 39.7207 31.7201 39.7207C29.3738 39.7207 27.4717 37.8187 27.4717 35.4724C27.4717 33.1261 29.3738 31.2241 31.7201 31.2241C34.0664 31.2241 35.9684 33.1261 35.9684 35.4724Z" fill="url(#paint1_linear_2412_13557)"/>
4
+ <defs>
5
+ <linearGradient id="paint0_linear_2412_13557" x1="31.72" y1="95.7208" x2="95.488" y2="34.3249" gradientUnits="userSpaceOnUse">
6
+ <stop stop-color="#0FA4B7"/>
7
+ <stop offset="0.494757" stop-color="#1DC1C7"/>
8
+ <stop offset="1" stop-color="#2BE0D7"/>
9
+ </linearGradient>
10
+ <linearGradient id="paint1_linear_2412_13557" x1="28.4374" y1="99.2464" x2="98.7613" y2="44.9372" gradientUnits="userSpaceOnUse">
11
+ <stop stop-color="#0FA4B7"/>
12
+ <stop offset="0.494757" stop-color="#1DC1C7"/>
13
+ <stop offset="1" stop-color="#2BE0D7"/>
14
+ </linearGradient>
15
+ </defs>
16
+ <div xmlns="" mx-name="view-image-info"/></svg>
@@ -0,0 +1,102 @@
1
+ import { Box, styled } from '@mui/material';
2
+ import { ComponentProps } from 'react';
3
+ import Markdown from 'react-markdown';
4
+ import remarkGfm from 'remark-gfm';
5
+
6
+ const MarkdownRenderer = styled(
7
+ (props: ComponentProps<typeof Markdown> & { citations?: { title?: string; url: string }[] }) => (
8
+ <Markdown
9
+ {...props}
10
+ remarkPlugins={[remarkGfm]}
11
+ components={{
12
+ table: ({ className, children }) => {
13
+ return (
14
+ <Box sx={{ overflow: 'auto', my: 1 }}>
15
+ <table className={className}>{children}</table>
16
+ </Box>
17
+ );
18
+ },
19
+ a: ({ href, children }) => {
20
+ return <a href={href}>{children}</a>;
21
+ },
22
+ }}>
23
+ {props.children}
24
+ </Markdown>
25
+ ),
26
+ )`
27
+ width: 100%;
28
+ overflow: hidden;
29
+ word-break: break-word;
30
+ font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
31
+
32
+ > * {
33
+ &:first-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
34
+ margin-top: 0;
35
+ }
36
+ &:last-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
37
+ margin-bottom: 0;
38
+ }
39
+ }
40
+
41
+ pre {
42
+ overflow: auto;
43
+ }
44
+
45
+ li {
46
+ margin: 0;
47
+ padding: 0;
48
+ }
49
+
50
+ li p {
51
+ display: inline-block;
52
+ vertical-align: top;
53
+ margin: 0;
54
+ padding: 0;
55
+ }
56
+
57
+ table {
58
+ border-collapse: collapse;
59
+ white-space: nowrap;
60
+
61
+ th,
62
+ td {
63
+ border: 1px solid grey;
64
+ padding: 4px 8px;
65
+ }
66
+ }
67
+
68
+ a {
69
+ color: ${({ theme }) => theme.palette.primary.main};
70
+
71
+ :hover {
72
+ text-decoration: underline;
73
+ }
74
+ }
75
+
76
+ &.writing:empty,
77
+ &.writing > *:last-child {
78
+ &:after {
79
+ content: '';
80
+ display: inline-block;
81
+ vertical-align: middle;
82
+ height: 1.2em;
83
+ margin-top: -0.2em;
84
+ margin-left: 0.1em;
85
+ border-right: 0.2em solid orange;
86
+ border-radius: 10px;
87
+ animation: blink-caret 0.75s step-end infinite;
88
+
89
+ @keyframes blink-caret {
90
+ from,
91
+ to {
92
+ border-color: transparent;
93
+ }
94
+ 50% {
95
+ border-color: ${({ theme }) => theme.palette.secondary.main};
96
+ }
97
+ }
98
+ }
99
+ }
100
+ `;
101
+
102
+ export default MarkdownRenderer;