├── .dockerignore ├── .gitignore ├── Dockerfile ├── README.md ├── demo-front ├── .eslintignore ├── .eslintrc.js ├── .travis.yml ├── LICENSE ├── babel.config.js ├── build │ └── index.js ├── jsconfig.json ├── package-lock.json ├── package.json ├── postcss.config.js ├── public │ ├── favicon.ico │ ├── index.html │ └── tinymce │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── bower.json │ │ ├── composer.json │ │ ├── icons │ │ └── default │ │ │ ├── icons.js │ │ │ ├── icons.min.js │ │ │ └── index.js │ │ ├── jquery.tinymce.js │ │ ├── jquery.tinymce.min.js │ │ ├── langs │ │ └── zh_CN.js │ │ ├── license.txt │ │ ├── package.json │ │ ├── plugins │ │ ├── advlist │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── anchor │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── autolink │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── autoresize │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── autosave │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── bbcode │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── charmap │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── code │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── codesample │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── colorpicker │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── contextmenu │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── directionality │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── emoticons │ │ │ ├── index.js │ │ │ ├── js │ │ │ │ ├── emojiimages.js │ │ │ │ ├── emojiimages.min.js │ │ │ │ ├── emojis.js │ │ │ │ └── emojis.min.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── fullpage │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── fullscreen │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── help │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── hr │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── image │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── imagetools │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── importcss │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── insertdatetime │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── legacyoutput │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── link │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── lists │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── media │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── nonbreaking │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── noneditable │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── pagebreak │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── paste │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── preview │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── print │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── quickbars │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── save │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── searchreplace │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── spellchecker │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── tabfocus │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── table │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── template │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── textcolor │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── textpattern │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── toc │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── visualblocks │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── visualchars │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ └── wordcount │ │ │ ├── index.js │ │ │ ├── plugin.js │ │ │ └── plugin.min.js │ │ ├── skins │ │ ├── content │ │ │ ├── dark │ │ │ │ ├── content.css │ │ │ │ └── content.min.css │ │ │ ├── default │ │ │ │ ├── content.css │ │ │ │ └── content.min.css │ │ │ ├── document │ │ │ │ ├── content.css │ │ │ │ └── content.min.css │ │ │ └── writer │ │ │ │ ├── content.css │ │ │ │ └── content.min.css │ │ └── ui │ │ │ ├── oxide-dark │ │ │ ├── content.css │ │ │ ├── content.inline.css │ │ │ ├── content.inline.min.css │ │ │ ├── content.min.css │ │ │ ├── content.mobile.css │ │ │ ├── content.mobile.min.css │ │ │ ├── fonts │ │ │ │ └── tinymce-mobile.woff │ │ │ ├── skin.css │ │ │ ├── skin.min.css │ │ │ ├── skin.mobile.css │ │ │ ├── skin.mobile.min.css │ │ │ ├── skin.shadowdom.css │ │ │ └── skin.shadowdom.min.css │ │ │ └── oxide │ │ │ ├── content.css │ │ │ ├── content.inline.css │ │ │ ├── content.inline.min.css │ │ │ ├── content.min.css │ │ │ ├── content.mobile.css │ │ │ ├── content.mobile.min.css │ │ │ ├── fonts │ │ │ └── tinymce-mobile.woff │ │ │ ├── skin.css │ │ │ ├── skin.min.css │ │ │ ├── skin.mobile.css │ │ │ ├── skin.mobile.min.css │ │ │ ├── skin.shadowdom.css │ │ │ └── skin.shadowdom.min.css │ │ ├── themes │ │ ├── mobile │ │ │ ├── index.js │ │ │ ├── theme.js │ │ │ └── theme.min.js │ │ └── silver │ │ │ ├── index.js │ │ │ ├── theme.js │ │ │ └── theme.min.js │ │ ├── tinymce.d.ts │ │ ├── tinymce.js │ │ └── tinymce.min.js ├── src │ ├── App.vue │ ├── assets │ │ └── images │ │ │ ├── fail.jpg │ │ │ └── load.gif │ ├── components │ │ └── header.vue │ ├── main.js │ ├── plugins │ │ ├── component.js │ │ ├── element.js │ │ ├── index.js │ │ └── prototype.js │ ├── router │ │ └── index.js │ ├── settings.js │ └── views │ │ ├── Home.vue │ │ └── secondarylist │ │ ├── dialog.vue │ │ ├── story.vue │ │ ├── style │ │ └── home.scss │ │ └── text.vue └── vue.config.js ├── demo_adapter.py ├── demos ├── dialogue │ └── __init__.py ├── fillblank │ └── __init__.py └── generatestory │ └── __init__.py ├── demotomodel.py ├── gpu_info.py ├── images ├── .DS_Store ├── demo1.jpg ├── demo2.jpg └── demo3.jpg ├── main.py └── requirements.txt /.dockerignore: -------------------------------------------------------------------------------- 1 | venv 2 | images -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | 131 | # Logs 132 | logs 133 | *.log 134 | npm-debug.log* 135 | yarn-debug.log* 136 | yarn-error.log* 137 | lerna-debug.log* 138 | 139 | # Diagnostic reports (https://nodejs.org/api/report.html) 140 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 141 | 142 | # Runtime data 143 | pids 144 | *.pid 145 | *.seed 146 | *.pid.lock 147 | 148 | # Directory for instrumented libs generated by jscoverage/JSCover 149 | lib-cov 150 | 151 | # Coverage directory used by tools like istanbul 152 | coverage 153 | *.lcov 154 | 155 | # nyc test coverage 156 | .nyc_output 157 | 158 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 159 | .grunt 160 | 161 | # Bower dependency directory (https://bower.io/) 162 | bower_components 163 | 164 | # node-waf configuration 165 | .lock-wscript 166 | 167 | # Compiled binary addons (https://nodejs.org/api/addons.html) 168 | build/Release 169 | 170 | # Dependency directories 171 | node_modules/ 172 | jspm_packages/ 173 | 174 | # TypeScript v1 declaration files 175 | typings/ 176 | 177 | # TypeScript cache 178 | *.tsbuildinfo 179 | 180 | # Optional npm cache directory 181 | .npm 182 | 183 | # Optional eslint cache 184 | .eslintcache 185 | 186 | # Microbundle cache 187 | .rpt2_cache/ 188 | .rts2_cache_cjs/ 189 | .rts2_cache_es/ 190 | .rts2_cache_umd/ 191 | 192 | # Optional REPL history 193 | .node_repl_history 194 | 195 | # Output of 'npm pack' 196 | *.tgz 197 | 198 | # Yarn Integrity file 199 | .yarn-integrity 200 | 201 | # dotenv environment variables file 202 | .env 203 | .env.test 204 | 205 | # parcel-bundler cache (https://parceljs.org/) 206 | .cache 207 | 208 | # Next.js build output 209 | .next 210 | 211 | # Nuxt.js build / generate output 212 | .nuxt 213 | dist 214 | 215 | # Gatsby files 216 | .cache/ 217 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 218 | # https://nextjs.org/blog/next-9-1#public-directory-support 219 | # public 220 | 221 | # vuepress build output 222 | .vuepress/dist 223 | 224 | # Serverless directories 225 | .serverless/ 226 | 227 | # FuseBox cache 228 | .fusebox/ 229 | 230 | # DynamoDB Local files 231 | .dynamodb/ 232 | 233 | # TernJS port file 234 | .tern-port 235 | 236 | .DS_Store -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-alpine 2 | WORKDIR /build 3 | COPY demo-front demo-front 4 | RUN cd demo-front && npm install --registry=https://registry.npm.taobao.org && npm run build 5 | 6 | FROM openbmb/bminf:latest 7 | WORKDIR /app 8 | COPY --from=0 /build/demo-front/dist statics 9 | ADD requirements.txt requirements.txt 10 | RUN pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --no-cache-dir 11 | ADD . . 12 | ENTRYPOINT ["python3", "main.py"] 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # **Introduction** 2 | 3 | BMInf(Big Model Inference)-Demos is three examples designed according to three models in BMInf. These three examples are: 4 | 5 | + **Fill Blank.** It is a use case designed according to CPM2.1 model. It can support arbitrary input of a paragraph of text and generate corresponding blank content according to context semantics. 6 | 7 | + **Generate Story.** It is an example based on CPM1 model. You only need to write the beginning of a paragraph, and it can create a beautiful essay for you。 8 | 9 | + **Dialogue.** It is an example we created based on EVA model. Here, you can talk freely with the machine. 10 | 11 | # Usage 12 | 13 | 14 | ### Step1: 15 | Run following commands with `nvidia-docker2`. 16 | 17 | ```console 18 | $ docker run -it --gpus 1 -v $HOME/.cache/bigmodels:/root/.cache/bigmodels -p 0.0.0.0:8000:8000 --rm openbmb/bminf-demos 19 | ``` 20 | 21 | ### Step2: 22 | 23 | Visit http://localhost:8000/ with your browser. 24 | 25 | 26 | # **Demonstration** 27 | + Fill Blank 28 |
29 | 30 |
31 | 32 | 33 | + Generate Story 34 | 35 |
36 | 37 |
38 | 39 | + Dialogue 40 | 41 |
42 | 43 |
44 | 45 | -------------------------------------------------------------------------------- /demo-front/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | src/assets 3 | public 4 | dist 5 | *.vue 6 | *.js -------------------------------------------------------------------------------- /demo-front/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parserOptions: { 4 | parser: 'babel-eslint', 5 | sourceType: 'module' 6 | }, 7 | env: { 8 | browser: true, 9 | node: true, 10 | es6: true, 11 | }, 12 | extends: ['plugin:vue/recommended', 'eslint:recommended'], 13 | 14 | // add your custom rules here 15 | //it is base on https://github.com/vuejs/eslint-config-vue 16 | rules: { 17 | "vue/max-attributes-per-line": [2, { 18 | "singleline": 10, 19 | "multiline": { 20 | "max": 1, 21 | "allowFirstLine": false 22 | } 23 | }], 24 | "vue/singleline-html-element-content-newline": "off", 25 | "vue/multiline-html-element-content-newline":"off", 26 | "vue/name-property-casing": ["error", "PascalCase"], 27 | "vue/no-v-html": "off", 28 | 'accessor-pairs': 2, 29 | 'arrow-spacing': [2, { 30 | 'before': true, 31 | 'after': true 32 | }], 33 | 'block-spacing': [2, 'always'], 34 | 'brace-style': [2, '1tbs', { 35 | 'allowSingleLine': true 36 | }], 37 | 'camelcase': [0, { 38 | 'properties': 'always' 39 | }], 40 | 'comma-dangle': [2, 'never'], 41 | 'comma-spacing': [2, { 42 | 'before': false, 43 | 'after': true 44 | }], 45 | 'comma-style': [2, 'last'], 46 | 'constructor-super': 2, 47 | 'curly': [2, 'multi-line'], 48 | 'dot-location': [2, 'property'], 49 | 'eol-last': 2, 50 | 'eqeqeq': ["error", "always", {"null": "ignore"}], 51 | 'generator-star-spacing': [2, { 52 | 'before': true, 53 | 'after': true 54 | }], 55 | 'handle-callback-err': [2, '^(err|error)$'], 56 | 'indent': [2, 2, { 57 | 'SwitchCase': 1 58 | }], 59 | 'jsx-quotes': [2, 'prefer-single'], 60 | 'key-spacing': [2, { 61 | 'beforeColon': false, 62 | 'afterColon': true 63 | }], 64 | 'keyword-spacing': [2, { 65 | 'before': true, 66 | 'after': true 67 | }], 68 | 'new-cap': [2, { 69 | 'newIsCap': true, 70 | 'capIsNew': false 71 | }], 72 | 'new-parens': 2, 73 | 'no-array-constructor': 2, 74 | 'no-caller': 2, 75 | 'no-console': 'off', 76 | 'no-class-assign': 2, 77 | 'no-cond-assign': 2, 78 | 'no-const-assign': 2, 79 | 'no-control-regex': 0, 80 | 'no-delete-var': 2, 81 | 'no-dupe-args': 2, 82 | 'no-dupe-class-members': 2, 83 | 'no-dupe-keys': 2, 84 | 'no-duplicate-case': 2, 85 | 'no-empty-character-class': 2, 86 | 'no-empty-pattern': 2, 87 | 'no-eval': 2, 88 | 'no-ex-assign': 2, 89 | 'no-extend-native': 2, 90 | 'no-extra-bind': 2, 91 | 'no-extra-boolean-cast': 2, 92 | 'no-extra-parens': [2, 'functions'], 93 | 'no-fallthrough': 2, 94 | 'no-floating-decimal': 2, 95 | 'no-func-assign': 2, 96 | 'no-implied-eval': 2, 97 | 'no-inner-declarations': [2, 'functions'], 98 | 'no-invalid-regexp': 2, 99 | 'no-irregular-whitespace': 2, 100 | 'no-iterator': 2, 101 | 'no-label-var': 2, 102 | 'no-labels': [2, { 103 | 'allowLoop': false, 104 | 'allowSwitch': false 105 | }], 106 | 'no-lone-blocks': 2, 107 | 'no-mixed-spaces-and-tabs': 2, 108 | 'no-multi-spaces': 2, 109 | 'no-multi-str': 2, 110 | 'no-multiple-empty-lines': [2, { 111 | 'max': 1 112 | }], 113 | 'no-native-reassign': 2, 114 | 'no-negated-in-lhs': 2, 115 | 'no-new-object': 2, 116 | 'no-new-require': 2, 117 | 'no-new-symbol': 2, 118 | 'no-new-wrappers': 2, 119 | 'no-obj-calls': 2, 120 | 'no-octal': 2, 121 | 'no-octal-escape': 2, 122 | 'no-path-concat': 2, 123 | 'no-proto': 2, 124 | 'no-redeclare': 2, 125 | 'no-regex-spaces': 2, 126 | 'no-return-assign': [2, 'except-parens'], 127 | 'no-self-assign': 2, 128 | 'no-self-compare': 2, 129 | 'no-sequences': 2, 130 | 'no-shadow-restricted-names': 2, 131 | 'no-spaced-func': 2, 132 | 'no-sparse-arrays': 2, 133 | 'no-this-before-super': 2, 134 | 'no-throw-literal': 2, 135 | 'no-trailing-spaces': 2, 136 | 'no-undef': 2, 137 | 'no-undef-init': 2, 138 | 'no-unexpected-multiline': 2, 139 | 'no-unmodified-loop-condition': 2, 140 | 'no-unneeded-ternary': [2, { 141 | 'defaultAssignment': false 142 | }], 143 | 'no-unreachable': 2, 144 | 'no-unsafe-finally': 2, 145 | 'no-unused-vars': [2, { 146 | 'vars': 'all', 147 | 'args': 'none' 148 | }], 149 | 'no-useless-call': 2, 150 | 'no-useless-computed-key': 2, 151 | 'no-useless-constructor': 2, 152 | 'no-useless-escape': 0, 153 | 'no-whitespace-before-property': 2, 154 | 'no-with': 2, 155 | 'one-var': [2, { 156 | 'initialized': 'never' 157 | }], 158 | 'operator-linebreak': [2, 'after', { 159 | 'overrides': { 160 | '?': 'before', 161 | ':': 'before' 162 | } 163 | }], 164 | 'padded-blocks': [2, 'never'], 165 | 'quotes': [2, 'single', { 166 | 'avoidEscape': true, 167 | 'allowTemplateLiterals': true 168 | }], 169 | 'semi': [2, 'never'], 170 | 'semi-spacing': [2, { 171 | 'before': false, 172 | 'after': true 173 | }], 174 | 'space-before-blocks': [2, 'always'], 175 | 'space-before-function-paren': [2, 'never'], 176 | 'space-in-parens': [2, 'never'], 177 | 'space-infix-ops': 2, 178 | 'space-unary-ops': [2, { 179 | 'words': true, 180 | 'nonwords': false 181 | }], 182 | 'spaced-comment': [2, 'always', { 183 | 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] 184 | }], 185 | 'template-curly-spacing': [2, 'never'], 186 | 'use-isnan': 2, 187 | 'valid-typeof': 2, 188 | 'wrap-iife': [2, 'any'], 189 | 'yield-star-spacing': [2, 'both'], 190 | 'yoda': [2, 'never'], 191 | 'prefer-const': 2, 192 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 193 | 'object-curly-spacing': [2, 'always', { 194 | objectsInObjects: false 195 | }], 196 | 'array-bracket-spacing': [2, 'never'] 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /demo-front/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 10 3 | script: npm run test 4 | notifications: 5 | email: false 6 | -------------------------------------------------------------------------------- /demo-front/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-present PanJiaChen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /demo-front/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | ['import', { 4 | libraryName: 'vant', 5 | libraryDirectory: 'es', 6 | style: true 7 | }, 'vant'] 8 | ], 9 | presets: [ 10 | // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app 11 | '@vue/cli-plugin-babel/preset' 12 | ], 13 | 'env': { 14 | 'development': { 15 | // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). 16 | // This plugin can significantly increase the speed of hot updates, when you have a large number of pages. 17 | // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html 18 | 'plugins': ['dynamic-import-node'] 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /demo-front/build/index.js: -------------------------------------------------------------------------------- 1 | const { run } = require('runjs') 2 | const chalk = require('chalk') 3 | const config = require('../vue.config.js') 4 | const rawArgv = process.argv.slice(2) 5 | const args = rawArgv.join(' ') 6 | 7 | if (process.env.npm_config_preview || rawArgv.includes('--preview')) { 8 | const report = rawArgv.includes('--report') 9 | 10 | run(`vue-cli-service build ${args}`) 11 | 12 | const port = 9526 13 | const publicPath = config.publicPath 14 | 15 | var connect = require('connect') 16 | var serveStatic = require('serve-static') 17 | const app = connect() 18 | 19 | app.use( 20 | publicPath, 21 | serveStatic('./dist', { 22 | index: ['index.html', '/'] 23 | }) 24 | ) 25 | 26 | app.listen(port, function () { 27 | console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`)) 28 | if (report) { 29 | console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`)) 30 | } 31 | 32 | }) 33 | } else { 34 | run(`vue-cli-service build ${args}`) 35 | } 36 | -------------------------------------------------------------------------------- /demo-front/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "paths": { 5 | "@/*": ["src/*"] 6 | } 7 | }, 8 | "exclude": ["node_modules", "dist"] 9 | } 10 | -------------------------------------------------------------------------------- /demo-front/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "admin", 3 | "version": "4.4.0", 4 | "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint", 5 | "author": "Pan ", 6 | "scripts": { 7 | "serve": "vue-cli-service serve", 8 | "gulp": "gulp css-wrap", 9 | "build": "vue-cli-service build", 10 | "build:stage": "vue-cli-service build --mode staging", 11 | "preview": "node build/index.js --preview", 12 | "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml", 13 | "lint": "eslint --ext .js,.vue src", 14 | "test:unit": "jest --clearCache && vue-cli-service test:unit", 15 | "test:ci": "npm run lint && npm run test:unit" 16 | }, 17 | "dependencies": { 18 | "@antv/g6": "^4.3.6", 19 | "@packy-tang/vue-tinymce": "^1.1.2", 20 | "axios": "0.18.1", 21 | "core-js": "3.6.5", 22 | "echarts": "^4.8.0", 23 | "echarts-wordcloud": "^1.1.3", 24 | "element-ui": "2.13.2", 25 | "eslint": "^7.32.0", 26 | "gulp-clean-css": "^4.3.0", 27 | "gulp-css-wrap": "^0.1.2", 28 | "jquery": "^3.5.1", 29 | "js-cookie": "2.2.0", 30 | "moment": "^2.27.0", 31 | "normalize.css": "7.0.0", 32 | "nprogress": "0.2.0", 33 | "path-to-regexp": "2.4.0", 34 | "qs": "^6.9.4", 35 | "tinymce": "^5.9.1", 36 | "vue": "2.6.10", 37 | "vue-bus": "^1.2.1", 38 | "vue-clipboard2": "^0.3.1", 39 | "vue-concise-slider": "^3.4.4", 40 | "vue-router": "3.0.6", 41 | "vuex": "3.1.0" 42 | }, 43 | "devDependencies": { 44 | "@vue/cli-plugin-babel": "4.4.4", 45 | "@vue/cli-plugin-eslint": "4.4.4", 46 | "@vue/cli-plugin-unit-jest": "4.4.4", 47 | "@vue/cli-service": "4.4.4", 48 | "@vue/test-utils": "1.0.0-beta.29", 49 | "autoprefixer": "9.5.1", 50 | "babel-eslint": "10.1.0", 51 | "babel-jest": "23.6.0", 52 | "babel-loader": "^7.1.5", 53 | "babel-plugin-dynamic-import-node": "2.3.3", 54 | "babel-plugin-import": "^1.13.1", 55 | "chalk": "2.4.2", 56 | "connect": "3.6.6", 57 | "element-theme-chalk": "^2.15.1", 58 | "eslint-plugin-vue": "6.2.2", 59 | "gulp": "^4.0.2", 60 | "html-webpack-plugin": "3.2.0", 61 | "mockjs": "1.0.1-beta3", 62 | "node-sass": "^4.14.1", 63 | "runjs": "4.3.2", 64 | "sass-loader": "^7.3.1", 65 | "sass-resources-loader": "^2.1.0", 66 | "script-ext-html-webpack-plugin": "2.1.3", 67 | "serve-static": "1.13.2", 68 | "style-loader": "^3.2.1", 69 | "svg-sprite-loader": "4.1.3", 70 | "svgo": "1.2.2", 71 | "vue-template-compiler": "2.6.10" 72 | }, 73 | "browserslist": [ 74 | "> 1%", 75 | "last 2 versions" 76 | ], 77 | "engines": { 78 | "node": ">=8.9", 79 | "npm": ">= 3.0.0" 80 | }, 81 | "license": "MIT" 82 | } 83 | -------------------------------------------------------------------------------- /demo-front/postcss.config.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | 'plugins': { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | 'autoprefixer': {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /demo-front/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenBMB/BMInf-demos/0a55d22905515c87656d1adb790a8d54017b828e/demo-front/public/favicon.ico -------------------------------------------------------------------------------- /demo-front/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/README.md: -------------------------------------------------------------------------------- 1 | # TinyMCE 2 | 3 | The world's #1 open source rich text editor. 4 | 5 | Used and trusted by millions of developers, TinyMCE is the world’s most customizable, scalable, and flexible rich text editor. We’ve helped launch the likes of Atlassian, Medium, Evernote (and lots more that we can’t tell you), by empowering them to create exceptional content and experiences for their users. 6 | 7 | With more than 350M+ downloads every year, we’re also one of the most trusted enterprise-grade open source HTML editors on the internet. There’s currently more than 100M+ products worldwide, powered by Tiny. As a high powered WYSIWYG editor, TinyMCE is built to scale, designed to innovate, and thrives on delivering results to difficult edge-cases. 8 | 9 | You can access a [full featured demo of TinyMCE](https://www.tiny.cloud/docs/demo/full-featured/) in the docs on the TinyMCE website. 10 | 11 |

12 | Screenshot of the TinyMCE Editor 13 |

14 | 15 | ## Get started with TinyMCE 16 | 17 | Getting started with the TinyMCE rich text editor is easy, and for simple configurations can be done in less than 5 minutes. 18 | 19 | [TinyMCE Cloud Deployment Quick Start Guide](https://www.tiny.cloud/docs/quick-start/) 20 | 21 | [TinyMCE Self-hosted Deployment Guide](https://www.tiny.cloud/docs/general-configuration-guide/advanced-install/) 22 | 23 | TinyMCE provides a range of configuration options that allow you to integrate it into your application. Start customizing with a [basic setup](https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/). 24 | 25 | Configure it for one of three modes of editing: 26 | 27 | - [TinyMCE classic editing mode](https://www.tiny.cloud/docs/general-configuration-guide/use-tinymce-classic/). 28 | - [TinyMCE inline editing mode](https://www.tiny.cloud/docs/general-configuration-guide/use-tinymce-inline/). 29 | - [TinyMCE distraction-free editing mode](https://www.tiny.cloud/docs/general-configuration-guide/use-tinymce-distraction-free/). 30 | 31 | ## Features 32 | 33 | ### Integration 34 | 35 | TinyMCE is easily integrated into your projects with the help of components such as: 36 | 37 | - [tinymce-react](https://github.com/tinymce/tinymce-react) 38 | - [tinymce-vue](https://github.com/tinymce/tinymce-vue) 39 | - [tinymce-angular](https://github.com/tinymce/tinymce-angular) 40 | 41 | With over 29 integrations, and 400+ APIs, see the TinyMCE docs for a full list of editor [integrations](https://www.tiny.cloud/docs/integrations/). 42 | 43 | ### Customization 44 | 45 | It is easy to [configure the UI](https://www.tiny.cloud/docs/general-configuration-guide/customize-ui/) of your rich text editor to match the design of your site, product or application. Due to its flexibility, you can [configure the editor](https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/) with as much or as little functionality as you like, depending on your requirements. 46 | 47 | With [50+ powerful plugins available](https://www.tiny.cloud/apps/), and content editable as the basis of TinyMCE, adding additional functionality is as simple as including a single line of code. 48 | 49 | Realizing the full power of most plugins requires only a few lines more. 50 | 51 | ### Extensibility 52 | 53 | Sometimes your editor requirements can be quite unique, and you need the freedom and flexibility to innovate. Thanks to TinyMCE being open source, you can view the source code and develop your own extensions for custom functionality to meet your own requirements. 54 | 55 | The TinyMCE [API](https://www.tiny.cloud/docs/api/) is exposed to make it easier for you to write custom functionality that fits within the existing framework of TinyMCE [UI components](https://www.tiny.cloud/docs/ui-components/). 56 | 57 | ### Extended Features and Support 58 | 59 | For the professional software teams that require more in-depth efficiency, compliance or collaborative features built to enterprise-grade standards, please [get in touch with our team](https://www.tiny.cloud/contact/). 60 | 61 | Tiny also offers dedicated SLAs and support for professional development teams. 62 | 63 | ## Compiling and contributing 64 | 65 | In 2019 the decision was made to transition our codebase to a monorepo. For information on compiling and contributing, see: [contribution guidelines](https://github.com/tinymce/tinymce/blob/master/CONTRIBUTING.md). 66 | 67 | As an open source product, we encourage and support the active development of our software. 68 | 69 | ## Want more information? 70 | 71 | Visit the [TinyMCE website](https://tiny.cloud/) and check out the [TinyMCE documentation](https://www.tiny.cloud/docs/). 72 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tinymce", 3 | "description": "Web based JavaScript HTML WYSIWYG editor control.", 4 | "license": "LGPL-2.1", 5 | "keywords": [ 6 | "wysiwyg", 7 | "tinymce", 8 | "richtext", 9 | "javascript", 10 | "html", 11 | "text", 12 | "rich editor", 13 | "rich text editor", 14 | "rte", 15 | "rich text", 16 | "contenteditable", 17 | "editing" 18 | ], 19 | "homepage": "https://www.tiny.cloud/", 20 | "ignore": [ 21 | "README.md", 22 | "composer.json", 23 | "package.json", 24 | ".npmignore", 25 | "CHANGELOG.md" 26 | ] 27 | } -------------------------------------------------------------------------------- /demo-front/public/tinymce/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tinymce/tinymce", 3 | "version": "5.9.1", 4 | "description": "Web based JavaScript HTML WYSIWYG editor control.", 5 | "license": [ 6 | "LGPL-2.1-only" 7 | ], 8 | "keywords": [ 9 | "wysiwyg", 10 | "tinymce", 11 | "richtext", 12 | "javascript", 13 | "html", 14 | "text", 15 | "rich editor", 16 | "rich text editor", 17 | "rte", 18 | "rich text", 19 | "contenteditable", 20 | "editing" 21 | ], 22 | "homepage": "https://www.tiny.cloud/", 23 | "type": "component", 24 | "extra": { 25 | "component": { 26 | "scripts": [ 27 | "tinymce.js", 28 | "plugins/*/plugin.js", 29 | "themes/*/theme.js", 30 | "themes/*/icons.js" 31 | ], 32 | "files": [ 33 | "tinymce.min.js", 34 | "plugins/*/plugin.min.js", 35 | "themes/*/theme.min.js", 36 | "skins/**", 37 | "icons/*/icons.min.js" 38 | ] 39 | } 40 | }, 41 | "archive": { 42 | "exclude": [ 43 | "README.md", 44 | "bower.js", 45 | "package.json", 46 | ".npmignore", 47 | "CHANGELOG.md" 48 | ] 49 | } 50 | } -------------------------------------------------------------------------------- /demo-front/public/tinymce/icons/default/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "default" icons for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/icons/default') 5 | // ES2015: 6 | // import 'tinymce/icons/default' 7 | require('./icons.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "tinymce", 3 | "_id": "tinymce@5.9.1", 4 | "_inBundle": false, 5 | "_integrity": "sha512-GaG15OhQB1zR2L63fywhEAViTxkAlhX5JbA+48+O0zCo1FwDuQ8iUVi/FzaOX9Uo7ULp+Y2gu4r3P4ZNueDVPQ==", 6 | "_location": "/tinymce", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "tinymce", 12 | "name": "tinymce", 13 | "escapedName": "tinymce", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/", 21 | "/@packy-tang/vue-tinymce" 22 | ], 23 | "_resolved": "https://registry.npmjs.org/tinymce/-/tinymce-5.9.1.tgz", 24 | "_shasum": "95100cd6748bbe5a5dfaaf8353f129756a0a5372", 25 | "_spec": "tinymce", 26 | "_where": "E:\\xinhuazhang\\microservice-ai-platform-ui", 27 | "author": { 28 | "name": "Tiny Technologies, Inc" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/tinymce/tinymce/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "deprecated": false, 35 | "description": "Web based JavaScript HTML WYSIWYG editor control.", 36 | "homepage": "https://www.tiny.cloud/", 37 | "keywords": [ 38 | "wysiwyg", 39 | "tinymce", 40 | "richtext", 41 | "javascript", 42 | "html", 43 | "text", 44 | "rich editor", 45 | "rich text editor", 46 | "rte", 47 | "rich text", 48 | "contenteditable", 49 | "editing" 50 | ], 51 | "license": "LGPL-2.1", 52 | "main": "tinymce.js", 53 | "name": "tinymce", 54 | "repository": { 55 | "type": "git", 56 | "url": "git+https://github.com/tinymce/tinymce.git", 57 | "directory": "modules/tinymce" 58 | }, 59 | "types": "tinymce.d.ts", 60 | "version": "5.9.1" 61 | } 62 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/advlist/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "advlist" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/advlist') 5 | // ES2015: 6 | // import 'tinymce/plugins/advlist' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/advlist/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";function f(t,e,n){t.execCommand("UL"===e?"InsertUnorderedList":"InsertOrderedList",!1,!1===n?null:{"list-style-type":n})}function i(t){return function(){return t}}function t(t){return t}function e(){return s}var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),g=tinymce.util.Tools.resolve("tinymce.util.Tools"),u=i(!1),l=i(!0),s={fold:function(t,e){return t()},isSome:u,isNone:l,getOr:t,getOrThunk:r,getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:i(null),getOrUndefined:i(void 0),or:t,orThunk:r,map:e,each:function(){},bind:e,exists:u,forall:l,filter:function(){return s},toArray:function(){return[]},toString:i("none()")};function r(t){return t()}function d(t){return t&&/^(TH|TD)$/.test(t.nodeName)}function m(c,a){return function(s){function t(t){var e,n,r,o,i,u,l;s.setActive((e=c,r=a,i=-1!==(o=function(t,e){for(var n=0;n=(y="www.").length&&m.substr(0,0+y.length)===y?C=w+"://"+C:-1===C.indexOf("@")||/^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(C)||(C="mailto:"+C),r=e.selection.getBookmark(),e.selection.setRng(c),e.execCommand("createlink",!1,C),!1!==f&&e.dom.setAttrib(e.selection.getNode(),"target",f),e.selection.moveToBookmark(r),e.nodeChanged())}}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),r=tinymce.util.Tools.resolve("tinymce.Env"),v=new RegExp("^"+/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-+~=.,%()\/\w]*[-+~=%()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source+"$","i");e.add("autolink",function(e){var t,n;(t=e).on("keydown",function(e){13===e.keyCode&&i(t,-1,"")}),r.browser.isIE()?t.on("focus",function(){if(!n){n=!0;try{t.execCommand("AutoUrlDetect",!1,!0)}catch(e){}}}):(t.on("keypress",function(e){41===e.keyCode&&i(t,-1,"(")}),t.on("keyup",function(e){32===e.keyCode&&i(t,0,"")}))})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/autoresize/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "autoresize" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/autoresize') 5 | // ES2015: 6 | // import 'tinymce/plugins/autoresize' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/autoresize/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";function d(e){return e.getParam("min_height",e.getElement().offsetHeight,"number")}function h(e,t){var n=e.getBody();n&&(n.style.overflowY=t?"":"hidden",t||(n.scrollTop=0))}function y(e,t,n,i){var o=parseInt(e.getStyle(t,n,i),10);return isNaN(o)?0:o}var g=Object.hasOwnProperty,e=tinymce.util.Tools.resolve("tinymce.PluginManager"),p=tinymce.util.Tools.resolve("tinymce.Env"),r=tinymce.util.Tools.resolve("tinymce.util.Delay"),u=function(e,t,n,i,o){r.setEditorTimeout(e,function(){v(e,t),n--?u(e,t,n,i,o):o&&o()},i)},v=function(e,t){var n,i,o,r,s,a,g,u,l,c,m=e.dom,f=e.getDoc();f&&(e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen()?h(e,!0):(n=f.documentElement,i=e.getParam("autoresize_bottom_margin",50,"number"),o=d(e),r=y(m,n,"margin-top",!0),s=y(m,n,"margin-bottom",!0),(a=(a=n.offsetHeight+r+s+i)<0?0:a)+(g=e.getContainer().offsetHeight-e.getContentAreaContainer().offsetHeight)>d(e)&&(o=a+g),(u=e.getParam("max_height",0,"number"))&&uo(t.getParam("autosave_retention"),"20m")&&(g(t,!1),1))}function s(t){var e=n(t);!i(t)&&t.isDirty()&&(v.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),v.setItem(e+"time",(new Date).getTime().toString()),t.fire("StoreDraft"))}function f(t){var e=n(t);u(t)&&(t.setContent(v.getItem(e+"draft"),{format:"raw"}),t.fire("RestoreDraft"))}function c(t){t.undoManager.transact(function(){f(t),g(t)}),t.focus()}function m(r){return function(t){function e(){return t.setDisabled(!u(r))}return t.setDisabled(!u(r)),r.on("StoreDraft RestoreDraft RemoveDraft",e),function(){return r.off("StoreDraft RestoreDraft RemoveDraft",e)}}}var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(t){return void 0===t},l=tinymce.util.Tools.resolve("tinymce.util.Delay"),v=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),d=tinymce.util.Tools.resolve("tinymce.util.Tools"),g=function(t,e){var r=n(t);v.removeItem(r+"draft"),v.removeItem(r+"time"),!1!==e&&t.fire("RemoveDraft")},y=tinymce.util.Tools.resolve("tinymce.EditorManager");t.add("autosave",function(t){var e,r,n,a;return t.editorManager.on("BeforeUnload",function(t){var e;d.each(y.get(),function(t){t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&t.getParam("autosave_ask_before_unload",!0)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e&&(t.preventDefault(),t.returnValue=e)}),n=e=t,a=o(n.getParam("autosave_interval"),"30s"),l.setEditorInterval(n,function(){s(n)},a),e.ui.registry.addButton("restoredraft",{tooltip:"Restore last draft",icon:"restore-draft",onAction:function(){c(e)},onSetup:m(e)}),e.ui.registry.addMenuItem("restoredraft",{text:"Restore last draft",icon:"restore-draft",onAction:function(){c(e)},onSetup:m(e)}),t.on("init",function(){t.getParam("autosave_restore_when_empty",!1)&&t.dom.isEmpty(t.getBody())&&f(t)}),r=t,{hasDraft:function(){return u(r)},storeDraft:function(){return s(r)},restoreDraft:function(){return f(r)},removeDraft:function(t){return g(r,t)},isEmpty:function(t){return i(r,t)}}})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/bbcode/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "bbcode" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/bbcode') 5 | // ES2015: 6 | // import 'tinymce/plugins/bbcode' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/bbcode/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | (function () { 10 | 'use strict'; 11 | 12 | var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); 13 | 14 | var global = tinymce.util.Tools.resolve('tinymce.util.Tools'); 15 | 16 | var html2bbcode = function (s) { 17 | s = global.trim(s); 18 | var rep = function (re, str) { 19 | s = s.replace(re, str); 20 | }; 21 | rep(/(.*?)<\/a>/gi, '[url=$1]$2[/url]'); 22 | rep(/(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]'); 23 | rep(/(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]'); 24 | rep(/(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]'); 25 | rep(/(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]'); 26 | rep(/(.*?)<\/span>/gi, '[color=$1]$2[/color]'); 27 | rep(/(.*?)<\/font>/gi, '[color=$1]$2[/color]'); 28 | rep(/(.*?)<\/span>/gi, '[size=$1]$2[/size]'); 29 | rep(/(.*?)<\/font>/gi, '$1'); 30 | rep(//gi, '[img]$1[/img]'); 31 | rep(/(.*?)<\/span>/gi, '[code]$1[/code]'); 32 | rep(/(.*?)<\/span>/gi, '[quote]$1[/quote]'); 33 | rep(/(.*?)<\/strong>/gi, '[code][b]$1[/b][/code]'); 34 | rep(/(.*?)<\/strong>/gi, '[quote][b]$1[/b][/quote]'); 35 | rep(/(.*?)<\/em>/gi, '[code][i]$1[/i][/code]'); 36 | rep(/(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]'); 37 | rep(/(.*?)<\/u>/gi, '[code][u]$1[/u][/code]'); 38 | rep(/(.*?)<\/u>/gi, '[quote][u]$1[/u][/quote]'); 39 | rep(/<\/(strong|b)>/gi, '[/b]'); 40 | rep(/<(strong|b)>/gi, '[b]'); 41 | rep(/<\/(em|i)>/gi, '[/i]'); 42 | rep(/<(em|i)>/gi, '[i]'); 43 | rep(/<\/u>/gi, '[/u]'); 44 | rep(/(.*?)<\/span>/gi, '[u]$1[/u]'); 45 | rep(//gi, '[u]'); 46 | rep(/]*>/gi, '[quote]'); 47 | rep(/<\/blockquote>/gi, '[/quote]'); 48 | rep(/
/gi, '\n'); 49 | rep(//gi, '\n'); 50 | rep(/
/gi, '\n'); 51 | rep(/

/gi, ''); 52 | rep(/<\/p>/gi, '\n'); 53 | rep(/ |\u00a0/gi, ' '); 54 | rep(/"/gi, '"'); 55 | rep(/</gi, '<'); 56 | rep(/>/gi, '>'); 57 | rep(/&/gi, '&'); 58 | return s; 59 | }; 60 | var bbcode2html = function (s) { 61 | s = global.trim(s); 62 | var rep = function (re, str) { 63 | s = s.replace(re, str); 64 | }; 65 | rep(/\n/gi, '
'); 66 | rep(/\[b\]/gi, ''); 67 | rep(/\[\/b\]/gi, ''); 68 | rep(/\[i\]/gi, ''); 69 | rep(/\[\/i\]/gi, ''); 70 | rep(/\[u\]/gi, ''); 71 | rep(/\[\/u\]/gi, ''); 72 | rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '$2'); 73 | rep(/\[url\](.*?)\[\/url\]/gi, '$1'); 74 | rep(/\[img\](.*?)\[\/img\]/gi, ''); 75 | rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '$2'); 76 | rep(/\[code\](.*?)\[\/code\]/gi, '$1 '); 77 | rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '$1 '); 78 | return s; 79 | }; 80 | 81 | function Plugin () { 82 | global$1.add('bbcode', function (editor) { 83 | console.warn('The bbcode plugin has been deprecated and marked for removal in TinyMCE 6.0'); 84 | editor.on('BeforeSetContent', function (e) { 85 | e.content = bbcode2html(e.content); 86 | }); 87 | editor.on('PostProcess', function (e) { 88 | if (e.set) { 89 | e.content = bbcode2html(e.content); 90 | } 91 | if (e.get) { 92 | e.content = html2bbcode(e.content); 93 | } 94 | }); 95 | }); 96 | } 97 | 98 | Plugin(); 99 | 100 | }()); 101 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/bbcode/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";function i(t){function o(o,e){t=t.replace(o,e)}return t=n.trim(t),o(/\n/gi,"
"),o(/\[b\]/gi,""),o(/\[\/b\]/gi,""),o(/\[i\]/gi,""),o(/\[\/i\]/gi,""),o(/\[u\]/gi,""),o(/\[\/u\]/gi,""),o(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),o(/\[url\](.*?)\[\/url\]/gi,'$1'),o(/\[img\](.*?)\[\/img\]/gi,''),o(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),o(/\[code\](.*?)\[\/code\]/gi,'$1 '),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),t}var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Tools");o.add("bbcode",function(o){console.warn("The bbcode plugin has been deprecated and marked for removal in TinyMCE 6.0"),o.on("BeforeSetContent",function(o){o.content=i(o.content)}),o.on("PostProcess",function(o){function e(o,e){t=t.replace(o,e)}var t;o.set&&(o.content=i(o.content)),o.get&&(o.content=(t=o.content,t=n.trim(t),e(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"),e(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),e(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),e(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),e(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),e(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"),e(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"),e(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"),e(/(.*?)<\/font>/gi,"$1"),e(//gi,"[img]$1[/img]"),e(/(.*?)<\/span>/gi,"[code]$1[/code]"),e(/(.*?)<\/span>/gi,"[quote]$1[/quote]"),e(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),e(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),e(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),e(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),e(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),e(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),e(/<\/(strong|b)>/gi,"[/b]"),e(/<(strong|b)>/gi,"[b]"),e(/<\/(em|i)>/gi,"[/i]"),e(/<(em|i)>/gi,"[i]"),e(/<\/u>/gi,"[/u]"),e(/(.*?)<\/span>/gi,"[u]$1[/u]"),e(//gi,"[u]"),e(/]*>/gi,"[quote]"),e(/<\/blockquote>/gi,"[/quote]"),e(/
/gi,"\n"),e(//gi,"\n"),e(/
/gi,"\n"),e(/

/gi,""),e(/<\/p>/gi,"\n"),e(/ |\u00a0/gi," "),e(/"/gi,'"'),e(/</gi,"<"),e(/>/gi,">"),e(/&/gi,"&"),t))})})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/charmap/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "charmap" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/charmap') 5 | // ES2015: 6 | // import 'tinymce/plugins/charmap' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/code/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "code" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/code') 5 | // ES2015: 6 | // import 'tinymce/plugins/code' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/code/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | (function () { 10 | 'use strict'; 11 | 12 | var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); 13 | 14 | var setContent = function (editor, html) { 15 | editor.focus(); 16 | editor.undoManager.transact(function () { 17 | editor.setContent(html); 18 | }); 19 | editor.selection.setCursorLocation(); 20 | editor.nodeChanged(); 21 | }; 22 | var getContent = function (editor) { 23 | return editor.getContent({ source_view: true }); 24 | }; 25 | 26 | var open = function (editor) { 27 | var editorContent = getContent(editor); 28 | editor.windowManager.open({ 29 | title: 'Source Code', 30 | size: 'large', 31 | body: { 32 | type: 'panel', 33 | items: [{ 34 | type: 'textarea', 35 | name: 'code' 36 | }] 37 | }, 38 | buttons: [ 39 | { 40 | type: 'cancel', 41 | name: 'cancel', 42 | text: 'Cancel' 43 | }, 44 | { 45 | type: 'submit', 46 | name: 'save', 47 | text: 'Save', 48 | primary: true 49 | } 50 | ], 51 | initialData: { code: editorContent }, 52 | onSubmit: function (api) { 53 | setContent(editor, api.getData().code); 54 | api.close(); 55 | } 56 | }); 57 | }; 58 | 59 | var register$1 = function (editor) { 60 | editor.addCommand('mceCodeEditor', function () { 61 | open(editor); 62 | }); 63 | }; 64 | 65 | var register = function (editor) { 66 | var onAction = function () { 67 | return editor.execCommand('mceCodeEditor'); 68 | }; 69 | editor.ui.registry.addButton('code', { 70 | icon: 'sourcecode', 71 | tooltip: 'Source code', 72 | onAction: onAction 73 | }); 74 | editor.ui.registry.addMenuItem('code', { 75 | icon: 'sourcecode', 76 | text: 'Source code', 77 | onAction: onAction 78 | }); 79 | }; 80 | 81 | function Plugin () { 82 | global.add('code', function (editor) { 83 | register$1(editor); 84 | register(editor); 85 | return {}; 86 | }); 87 | } 88 | 89 | Plugin(); 90 | 91 | }()); 92 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/code/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("code",function(e){var t,o;function n(){return o.execCommand("mceCodeEditor")}return(t=e).addCommand("mceCodeEditor",function(){var n,e;e=(n=t).getContent({source_view:!0}),n.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:e},onSubmit:function(e){var t=n,o=e.getData().code;t.focus(),t.undoManager.transact(function(){t.setContent(o)}),t.selection.setCursorLocation(),t.nodeChanged(),e.close()}})}),(o=e).ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:n}),o.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:n}),{}})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/codesample/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "codesample" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/codesample') 5 | // ES2015: 6 | // import 'tinymce/plugins/codesample' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/colorpicker/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "colorpicker" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/colorpicker') 5 | // ES2015: 6 | // import 'tinymce/plugins/colorpicker' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/colorpicker/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | (function () { 10 | 'use strict'; 11 | 12 | var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); 13 | 14 | function Plugin () { 15 | global.add('colorpicker', function () { 16 | console.warn('Color picker plugin is now built in to the core editor, please remove it from your editor configuration'); 17 | }); 18 | } 19 | 20 | Plugin(); 21 | 22 | }()); 23 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/colorpicker/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("colorpicker",function(){console.warn("Color picker plugin is now built in to the core editor, please remove it from your editor configuration")})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/contextmenu/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "contextmenu" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/contextmenu') 5 | // ES2015: 6 | // import 'tinymce/plugins/contextmenu' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/contextmenu/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | (function () { 10 | 'use strict'; 11 | 12 | var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); 13 | 14 | function Plugin () { 15 | global.add('contextmenu', function () { 16 | console.warn('Context menu plugin is now built in to the core editor, please remove it from your editor configuration'); 17 | }); 18 | } 19 | 20 | Plugin(); 21 | 22 | }()); 23 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/contextmenu/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("contextmenu",function(){console.warn("Context menu plugin is now built in to the core editor, please remove it from your editor configuration")})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/directionality/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "directionality" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/directionality') 5 | // ES2015: 6 | // import 'tinymce/plugins/directionality' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/directionality/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";function n(t){return function(n){return typeof n===t}}function u(n){return function(){return n}}function t(n){return n}function r(){return d}var o,e=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(n){return r=typeof(t=n),(null===t?"null":"object"==r&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"==r&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":r)===o;var t,r},c=n("boolean"),f=n("function"),l=n("number"),a=u(!(o="string")),m=u(!0),d={fold:function(n,t){return n()},isSome:a,isNone:m,getOr:t,getOrThunk:s,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:u(null),getOrUndefined:u(void 0),or:t,orThunk:s,map:r,each:function(){},bind:r,exists:a,forall:m,filter:function(){return d},toArray:function(){return[]},toString:u("none()")};function s(n){return n()}function g(n,t){for(var r=0,o=n.length;r'); 17 | }); 18 | }; 19 | 20 | var register = function (editor) { 21 | var onAction = function () { 22 | return editor.execCommand('InsertHorizontalRule'); 23 | }; 24 | editor.ui.registry.addButton('hr', { 25 | icon: 'horizontal-rule', 26 | tooltip: 'Horizontal line', 27 | onAction: onAction 28 | }); 29 | editor.ui.registry.addMenuItem('hr', { 30 | icon: 'horizontal-rule', 31 | text: 'Horizontal line', 32 | onAction: onAction 33 | }); 34 | }; 35 | 36 | function Plugin () { 37 | global.add('hr', function (editor) { 38 | register$1(editor); 39 | register(editor); 40 | }); 41 | } 42 | 43 | Plugin(); 44 | 45 | }()); 46 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/hr/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("hr",function(n){var o,t;function e(){return t.execCommand("InsertHorizontalRule")}(o=n).addCommand("InsertHorizontalRule",function(){o.execCommand("mceInsertContent",!1,"


")}),(t=n).ui.registry.addButton("hr",{icon:"horizontal-rule",tooltip:"Horizontal line",onAction:e}),t.ui.registry.addMenuItem("hr",{icon:"horizontal-rule",text:"Horizontal line",onAction:e})})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/image/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "image" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/image') 5 | // ES2015: 6 | // import 'tinymce/plugins/image' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/imagetools/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "imagetools" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/imagetools') 5 | // ES2015: 6 | // import 'tinymce/plugins/imagetools' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/importcss/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "importcss" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/importcss') 5 | // ES2015: 6 | // import 'tinymce/plugins/importcss' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/importcss/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";function t(n){return function(t){return r=typeof(e=t),(null===e?"null":"object"==r&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"==r&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":r)===n;var e,r}}function y(t){return t.getParam("importcss_selector_converter")}function u(e){return l(e)?function(t){return-1!==t.indexOf(e)}:e instanceof RegExp?function(t){return e.test(t)}:e}function h(t,e){var r,n=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(e);if(n){var o=n[1],i=n[2].substr(1).split(".").join(" "),c=x.makeMap("a,img");return n[1]?(r={title:e},t.schema.getTextBlockElements()[o]?r.block=o:t.schema.getBlockElements()[o]||c[o.toLowerCase()]?r.selector=o:r.inline=o):n[2]&&(r={inline:"span",title:e.substr(1),classes:i}),!1!==t.getParam("importcss_merge_classes")?r.classes=i:r.attributes={class:i},r}}function d(t,e){return null===e||!1!==t.getParam("importcss_exclusive")}function r(v){v.on("init",function(){function o(t,e){if(f=t,p=g,!(d(v,m=e)?f in p:f in m.selectors)){a=t,l=g,d(v,u=e)?l[a]=!0:u.selectors[a]=!0;var r=(i=(o=v).plugins.importcss,c=t,((s=e)&&s.selector_converter?s.selector_converter:y(o)?y(o):function(){return h(o,c)}).call(i,c,s));if(r){var n=r.name||_.DOM.uniqueId();return v.formatter.register(n,r),{title:r.title,format:n}}}var o,i,c,s,a,u,l,f,m,p;return null}var e,r,n,t,i=(e=[],r=[],n={},{addItemToGroup:function(t,e){n[t]?n[t].push(e):(r.push(t),n[t]=[e])},addItem:function(t){e.push(t)},toFormats:function(){return function(t){for(var e=[],r=0,n=t.length;r'+n+"")):e.insertContent(l(e,t))}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),i="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),o="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),u="January February March April May June July August September October November December".split(" "),p=tinymce.util.Tools.resolve("tinymce.util.Tools");e.add("insertdatetime",function(e){var t,n,r,a,i,o,u,c;(t=e).addCommand("mceInsertDate",function(){d(t,t.getParam("insertdatetime_dateformat",t.translate("%Y-%m-%d")))}),t.addCommand("mceInsertTime",function(){d(t,m(t))}),u=s(n=e),r=0<(o=s(i=n)).length?o[0]:m(i),a=r,c={get:function(){return a},set:function(e){a=e}},n.ui.registry.addSplitButton("insertdatetime",{icon:"insert-time",tooltip:"Insert date/time",select:function(e){return e===c.get()},fetch:function(e){e(p.map(u,function(e){return{type:"choiceitem",text:l(n,e),value:e}}))},onAction:function(e){d(n,c.get())},onItemAction:function(e,t){c.set(t),d(n,t)}}),n.ui.registry.addNestedMenuItem("insertdatetime",{icon:"insert-time",text:"Date/time",getSubmenuItems:function(){return p.map(u,function(e){return{type:"menuitem",text:l(n,e),onAction:(t=e,function(){c.set(t),d(n,t)})};var t})}})})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/legacyoutput/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "legacyoutput" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/legacyoutput') 5 | // ES2015: 6 | // import 'tinymce/plugins/legacyoutput' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/legacyoutput/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=tinymce.util.Tools.resolve("tinymce.util.Tools");e.add("legacyoutput",function(e){var s,t;console.warn("The legacyoutput plugin has been deprecated and marked for removal in TinyMCE 6.0"),(t=s=e).settings.inline_styles=!1,t.getParam("fontsize_formats")||(t.settings.fontsize_formats="8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7"),t.getParam("font_formats")||(t.settings.font_formats="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"),s.on("PreInit",function(){var e=s,t="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table",i=l.explode(e.getParam("font_size_style_values","xx-small,x-small,small,medium,large,x-large,xx-large")),a=e.schema;e.formatter.register({alignleft:{selector:t,attributes:{align:"left"}},aligncenter:{selector:t,attributes:{align:"center"}},alignright:{selector:t,attributes:{align:"right"}},alignjustify:{selector:t,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all",preserve_attributes:["class","style"]},{inline:"strong",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all",preserve_attributes:["class","style"]},{inline:"em",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",toggle:!1,attributes:{face:"%value"}},fontsize:{inline:"font",toggle:!1,attributes:{size:function(e){return String(l.inArray(i,e.value)+1)}}},forecolor:{inline:"font",attributes:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0}}),l.each("b,i,u,strike".split(","),function(e){a.addValidElements(e+"[*]")}),a.getElementRule("font")||a.addValidElements("font[face|size|color|style]"),l.each(t.split(","),function(e){var t=a.getElementRule(e);t&&(t.attributes.align||(t.attributes.align={},t.attributesOrder.push("align")))})})})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/link/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "link" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/link') 5 | // ES2015: 6 | // import 'tinymce/plugins/link' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/lists/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "lists" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/lists') 5 | // ES2015: 6 | // import 'tinymce/plugins/lists' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/media/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "media" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/media') 5 | // ES2015: 6 | // import 'tinymce/plugins/media' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/nonbreaking/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "nonbreaking" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/nonbreaking') 5 | // ES2015: 6 | // import 'tinymce/plugins/nonbreaking' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/nonbreaking/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | (function () { 10 | 'use strict'; 11 | 12 | var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); 13 | 14 | var getKeyboardSpaces = function (editor) { 15 | var spaces = editor.getParam('nonbreaking_force_tab', 0); 16 | if (typeof spaces === 'boolean') { 17 | return spaces === true ? 3 : 0; 18 | } else { 19 | return spaces; 20 | } 21 | }; 22 | var wrapNbsps = function (editor) { 23 | return editor.getParam('nonbreaking_wrap', true, 'boolean'); 24 | }; 25 | 26 | var stringRepeat = function (string, repeats) { 27 | var str = ''; 28 | for (var index = 0; index < repeats; index++) { 29 | str += string; 30 | } 31 | return str; 32 | }; 33 | var isVisualCharsEnabled = function (editor) { 34 | return editor.plugins.visualchars ? editor.plugins.visualchars.isEnabled() : false; 35 | }; 36 | var insertNbsp = function (editor, times) { 37 | var classes = function () { 38 | return isVisualCharsEnabled(editor) ? 'mce-nbsp-wrap mce-nbsp' : 'mce-nbsp-wrap'; 39 | }; 40 | var nbspSpan = function () { 41 | return '' + stringRepeat(' ', times) + ''; 42 | }; 43 | var shouldWrap = wrapNbsps(editor); 44 | var html = shouldWrap || editor.plugins.visualchars ? nbspSpan() : stringRepeat(' ', times); 45 | editor.undoManager.transact(function () { 46 | return editor.insertContent(html); 47 | }); 48 | }; 49 | 50 | var register$1 = function (editor) { 51 | editor.addCommand('mceNonBreaking', function () { 52 | insertNbsp(editor, 1); 53 | }); 54 | }; 55 | 56 | var global = tinymce.util.Tools.resolve('tinymce.util.VK'); 57 | 58 | var setup = function (editor) { 59 | var spaces = getKeyboardSpaces(editor); 60 | if (spaces > 0) { 61 | editor.on('keydown', function (e) { 62 | if (e.keyCode === global.TAB && !e.isDefaultPrevented()) { 63 | if (e.shiftKey) { 64 | return; 65 | } 66 | e.preventDefault(); 67 | e.stopImmediatePropagation(); 68 | insertNbsp(editor, spaces); 69 | } 70 | }); 71 | } 72 | }; 73 | 74 | var register = function (editor) { 75 | var onAction = function () { 76 | return editor.execCommand('mceNonBreaking'); 77 | }; 78 | editor.ui.registry.addButton('nonbreaking', { 79 | icon: 'non-breaking', 80 | tooltip: 'Nonbreaking space', 81 | onAction: onAction 82 | }); 83 | editor.ui.registry.addMenuItem('nonbreaking', { 84 | icon: 'non-breaking', 85 | text: 'Nonbreaking space', 86 | onAction: onAction 87 | }); 88 | }; 89 | 90 | function Plugin () { 91 | global$1.add('nonbreaking', function (editor) { 92 | register$1(editor); 93 | register(editor); 94 | setup(editor); 95 | }); 96 | } 97 | 98 | Plugin(); 99 | 100 | }()); 101 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/nonbreaking/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";function o(n,e){for(var a="",o=0;o'+o(" ",e)+"
":o(" ",e);n.undoManager.transact(function(){return n.insertContent(a)})}var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.util.VK");n.add("nonbreaking",function(n){var e,a,o,t,i;function r(){return a.execCommand("mceNonBreaking")}(e=n).addCommand("mceNonBreaking",function(){s(e,1)}),(a=n).ui.registry.addButton("nonbreaking",{icon:"non-breaking",tooltip:"Nonbreaking space",onAction:r}),a.ui.registry.addMenuItem("nonbreaking",{icon:"non-breaking",text:"Nonbreaking space",onAction:r}),0<(i="boolean"==typeof(t=(o=n).getParam("nonbreaking_force_tab",0))?!0===t?3:0:t)&&o.on("keydown",function(n){n.keyCode!==c.TAB||n.isDefaultPrevented()||n.shiftKey||(n.preventDefault(),n.stopImmediatePropagation(),s(o,i))})})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/noneditable/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "noneditable" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/noneditable') 5 | // ES2015: 6 | // import 'tinymce/plugins/noneditable' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/noneditable/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | (function () { 10 | 'use strict'; 11 | 12 | var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); 13 | 14 | var global = tinymce.util.Tools.resolve('tinymce.util.Tools'); 15 | 16 | var getNonEditableClass = function (editor) { 17 | return editor.getParam('noneditable_noneditable_class', 'mceNonEditable'); 18 | }; 19 | var getEditableClass = function (editor) { 20 | return editor.getParam('noneditable_editable_class', 'mceEditable'); 21 | }; 22 | var getNonEditableRegExps = function (editor) { 23 | var nonEditableRegExps = editor.getParam('noneditable_regexp', []); 24 | if (nonEditableRegExps && nonEditableRegExps.constructor === RegExp) { 25 | return [nonEditableRegExps]; 26 | } else { 27 | return nonEditableRegExps; 28 | } 29 | }; 30 | 31 | var hasClass = function (checkClassName) { 32 | return function (node) { 33 | return (' ' + node.attr('class') + ' ').indexOf(checkClassName) !== -1; 34 | }; 35 | }; 36 | var replaceMatchWithSpan = function (editor, content, cls) { 37 | return function (match) { 38 | var args = arguments, index = args[args.length - 2]; 39 | var prevChar = index > 0 ? content.charAt(index - 1) : ''; 40 | if (prevChar === '"') { 41 | return match; 42 | } 43 | if (prevChar === '>') { 44 | var findStartTagIndex = content.lastIndexOf('<', index); 45 | if (findStartTagIndex !== -1) { 46 | var tagHtml = content.substring(findStartTagIndex, index); 47 | if (tagHtml.indexOf('contenteditable="false"') !== -1) { 48 | return match; 49 | } 50 | } 51 | } 52 | return '' + editor.dom.encode(typeof args[1] === 'string' ? args[1] : args[0]) + ''; 53 | }; 54 | }; 55 | var convertRegExpsToNonEditable = function (editor, nonEditableRegExps, e) { 56 | var i = nonEditableRegExps.length, content = e.content; 57 | if (e.format === 'raw') { 58 | return; 59 | } 60 | while (i--) { 61 | content = content.replace(nonEditableRegExps[i], replaceMatchWithSpan(editor, content, getNonEditableClass(editor))); 62 | } 63 | e.content = content; 64 | }; 65 | var setup = function (editor) { 66 | var contentEditableAttrName = 'contenteditable'; 67 | var editClass = ' ' + global.trim(getEditableClass(editor)) + ' '; 68 | var nonEditClass = ' ' + global.trim(getNonEditableClass(editor)) + ' '; 69 | var hasEditClass = hasClass(editClass); 70 | var hasNonEditClass = hasClass(nonEditClass); 71 | var nonEditableRegExps = getNonEditableRegExps(editor); 72 | editor.on('PreInit', function () { 73 | if (nonEditableRegExps.length > 0) { 74 | editor.on('BeforeSetContent', function (e) { 75 | convertRegExpsToNonEditable(editor, nonEditableRegExps, e); 76 | }); 77 | } 78 | editor.parser.addAttributeFilter('class', function (nodes) { 79 | var i = nodes.length, node; 80 | while (i--) { 81 | node = nodes[i]; 82 | if (hasEditClass(node)) { 83 | node.attr(contentEditableAttrName, 'true'); 84 | } else if (hasNonEditClass(node)) { 85 | node.attr(contentEditableAttrName, 'false'); 86 | } 87 | } 88 | }); 89 | editor.serializer.addAttributeFilter(contentEditableAttrName, function (nodes) { 90 | var i = nodes.length, node; 91 | while (i--) { 92 | node = nodes[i]; 93 | if (!hasEditClass(node) && !hasNonEditClass(node)) { 94 | continue; 95 | } 96 | if (nonEditableRegExps.length > 0 && node.attr('data-mce-content')) { 97 | node.name = '#text'; 98 | node.type = 3; 99 | node.raw = true; 100 | node.value = node.attr('data-mce-content'); 101 | } else { 102 | node.attr(contentEditableAttrName, null); 103 | } 104 | } 105 | }); 106 | }); 107 | }; 108 | 109 | function Plugin () { 110 | global$1.add('noneditable', function (editor) { 111 | setup(editor); 112 | }); 113 | } 114 | 115 | Plugin(); 116 | 117 | }()); 118 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/noneditable/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";function l(t){return t.getParam("noneditable_noneditable_class","mceNonEditable")}function u(e){return function(t){return-1!==(" "+t.attr("class")+" ").indexOf(e)}}function e(e){var t,r="contenteditable",n=" "+f.trim(e.getParam("noneditable_editable_class","mceEditable"))+" ",a=" "+f.trim(l(e))+" ",i=u(n),o=u(a),c=(t=e.getParam("noneditable_regexp",[]))&&t.constructor===RegExp?[t]:t;e.on("PreInit",function(){0"===r){var a=o.lastIndexOf("<",n);if(-1!==a&&-1!==o.substring(a,n).indexOf('contenteditable="false"'))return t}return''+i.dom.encode("string"==typeof e[1]?e[1]:e[0])+""}}(t,a,l(t)));n.content=a}}(e,c,t)}),e.parser.addAttributeFilter("class",function(t){for(var e,n=t.length;n--;)e=t[n],i(e)?e.attr(r,"true"):o(e)&&e.attr(r,"false")}),e.serializer.addAttributeFilter(r,function(t){for(var e,n=t.length;n--;)e=t[n],(i(e)||o(e))&&(0'); 18 | }; 19 | var shouldSplitBlock = function (editor) { 20 | return editor.getParam('pagebreak_split_block', false); 21 | }; 22 | 23 | var pageBreakClass = 'mce-pagebreak'; 24 | var getPlaceholderHtml = function (shouldSplitBlock) { 25 | var html = ''; 26 | return shouldSplitBlock ? '

' + html + '

' : html; 27 | }; 28 | var setup$1 = function (editor) { 29 | var separatorHtml = getSeparatorHtml(editor); 30 | var shouldSplitBlock$1 = function () { 31 | return shouldSplitBlock(editor); 32 | }; 33 | var pageBreakSeparatorRegExp = new RegExp(separatorHtml.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function (a) { 34 | return '\\' + a; 35 | }), 'gi'); 36 | editor.on('BeforeSetContent', function (e) { 37 | e.content = e.content.replace(pageBreakSeparatorRegExp, getPlaceholderHtml(shouldSplitBlock$1())); 38 | }); 39 | editor.on('PreInit', function () { 40 | editor.serializer.addNodeFilter('img', function (nodes) { 41 | var i = nodes.length, node, className; 42 | while (i--) { 43 | node = nodes[i]; 44 | className = node.attr('class'); 45 | if (className && className.indexOf(pageBreakClass) !== -1) { 46 | var parentNode = node.parent; 47 | if (editor.schema.getBlockElements()[parentNode.name] && shouldSplitBlock$1()) { 48 | parentNode.type = 3; 49 | parentNode.value = separatorHtml; 50 | parentNode.raw = true; 51 | node.remove(); 52 | continue; 53 | } 54 | node.type = 3; 55 | node.value = separatorHtml; 56 | node.raw = true; 57 | } 58 | } 59 | }); 60 | }); 61 | }; 62 | 63 | var register$1 = function (editor) { 64 | editor.addCommand('mcePageBreak', function () { 65 | editor.insertContent(getPlaceholderHtml(shouldSplitBlock(editor))); 66 | }); 67 | }; 68 | 69 | var setup = function (editor) { 70 | editor.on('ResolveName', function (e) { 71 | if (e.target.nodeName === 'IMG' && editor.dom.hasClass(e.target, pageBreakClass)) { 72 | e.name = 'pagebreak'; 73 | } 74 | }); 75 | }; 76 | 77 | var register = function (editor) { 78 | var onAction = function () { 79 | return editor.execCommand('mcePageBreak'); 80 | }; 81 | editor.ui.registry.addButton('pagebreak', { 82 | icon: 'page-break', 83 | tooltip: 'Page break', 84 | onAction: onAction 85 | }); 86 | editor.ui.registry.addMenuItem('pagebreak', { 87 | text: 'Page break', 88 | icon: 'page-break', 89 | onAction: onAction 90 | }); 91 | }; 92 | 93 | function Plugin () { 94 | global$1.add('pagebreak', function (editor) { 95 | register$1(editor); 96 | register(editor); 97 | setup$1(editor); 98 | setup(editor); 99 | }); 100 | } 101 | 102 | Plugin(); 103 | 104 | }()); 105 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/pagebreak/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";function u(e){return e.getParam("pagebreak_split_block",!1)}function l(e){var a='';return e?"

"+a+"

":a}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.Env"),m="mce-pagebreak";e.add("pagebreak",function(e){var a,n,o,i,t,r;function c(){return n.execCommand("mcePageBreak")}function g(){return u(o)}(a=e).addCommand("mcePageBreak",function(){a.insertContent(l(u(a)))}),(n=e).ui.registry.addButton("pagebreak",{icon:"page-break",tooltip:"Page break",onAction:c}),n.ui.registry.addMenuItem("pagebreak",{text:"Page break",icon:"page-break",onAction:c}),i=(o=e).getParam("pagebreak_separator","\x3c!-- pagebreak --\x3e"),t=new RegExp(i.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(e){return"\\"+e}),"gi"),o.on("BeforeSetContent",function(e){e.content=e.content.replace(t,l(g()))}),o.on("PreInit",function(){o.serializer.addNodeFilter("img",function(e){for(var a,n,t,r=e.length;r--;)(t=(n=e[r]).attr("class"))&&-1!==t.indexOf(m)&&(a=n.parent,o.schema.getBlockElements()[a.name]&&g()?(a.type=3,a.value=i,a.raw=!0,n.remove()):(n.type=3,n.value=i,n.raw=!0))})}),(r=e).on("ResolveName",function(e){"IMG"===e.target.nodeName&&r.dom.hasClass(e.target,m)&&(e.name="pagebreak")})})}(); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/paste/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "paste" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/paste') 5 | // ES2015: 6 | // import 'tinymce/plugins/paste' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/preview/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "preview" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/preview') 5 | // ES2015: 6 | // import 'tinymce/plugins/preview' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/preview/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | (function () { 10 | 'use strict'; 11 | 12 | var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager'); 13 | 14 | var global$1 = tinymce.util.Tools.resolve('tinymce.Env'); 15 | 16 | var global = tinymce.util.Tools.resolve('tinymce.util.Tools'); 17 | 18 | var getContentStyle = function (editor) { 19 | return editor.getParam('content_style', '', 'string'); 20 | }; 21 | var shouldUseContentCssCors = function (editor) { 22 | return editor.getParam('content_css_cors', false, 'boolean'); 23 | }; 24 | var getBodyClassByHash = function (editor) { 25 | var bodyClass = editor.getParam('body_class', '', 'hash'); 26 | return bodyClass[editor.id] || ''; 27 | }; 28 | var getBodyClass = function (editor) { 29 | var bodyClass = editor.getParam('body_class', '', 'string'); 30 | if (bodyClass.indexOf('=') === -1) { 31 | return bodyClass; 32 | } else { 33 | return getBodyClassByHash(editor); 34 | } 35 | }; 36 | var getBodyIdByHash = function (editor) { 37 | var bodyId = editor.getParam('body_id', '', 'hash'); 38 | return bodyId[editor.id] || bodyId; 39 | }; 40 | var getBodyId = function (editor) { 41 | var bodyId = editor.getParam('body_id', 'tinymce', 'string'); 42 | if (bodyId.indexOf('=') === -1) { 43 | return bodyId; 44 | } else { 45 | return getBodyIdByHash(editor); 46 | } 47 | }; 48 | 49 | var getPreviewHtml = function (editor) { 50 | var headHtml = ''; 51 | var encode = editor.dom.encode; 52 | var contentStyle = getContentStyle(editor); 53 | headHtml += ''; 54 | var cors = shouldUseContentCssCors(editor) ? ' crossorigin="anonymous"' : ''; 55 | global.each(editor.contentCSS, function (url) { 56 | headHtml += ''; 57 | }); 58 | if (contentStyle) { 59 | headHtml += ''; 60 | } 61 | var bodyId = getBodyId(editor); 62 | var bodyClass = getBodyClass(editor); 63 | var isMetaKeyPressed = global$1.mac ? 'e.metaKey' : 'e.ctrlKey && !e.altKey'; 64 | var preventClicksOnLinksScript = ' '; 65 | var directionality = editor.getBody().dir; 66 | var dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : ''; 67 | var previewHtml = '' + '' + '' + headHtml + '' + '' + editor.getContent() + preventClicksOnLinksScript + '' + ''; 68 | return previewHtml; 69 | }; 70 | 71 | var open = function (editor) { 72 | var content = getPreviewHtml(editor); 73 | var dataApi = editor.windowManager.open({ 74 | title: 'Preview', 75 | size: 'large', 76 | body: { 77 | type: 'panel', 78 | items: [{ 79 | name: 'preview', 80 | type: 'iframe', 81 | sandboxed: true 82 | }] 83 | }, 84 | buttons: [{ 85 | type: 'cancel', 86 | name: 'close', 87 | text: 'Close', 88 | primary: true 89 | }], 90 | initialData: { preview: content } 91 | }); 92 | dataApi.focus('close'); 93 | }; 94 | 95 | var register$1 = function (editor) { 96 | editor.addCommand('mcePreview', function () { 97 | open(editor); 98 | }); 99 | }; 100 | 101 | var register = function (editor) { 102 | var onAction = function () { 103 | return editor.execCommand('mcePreview'); 104 | }; 105 | editor.ui.registry.addButton('preview', { 106 | icon: 'preview', 107 | tooltip: 'Preview', 108 | onAction: onAction 109 | }); 110 | editor.ui.registry.addMenuItem('preview', { 111 | icon: 'preview', 112 | text: 'Preview', 113 | onAction: onAction 114 | }); 115 | }; 116 | 117 | function Plugin () { 118 | global$2.add('preview', function (editor) { 119 | register$1(editor); 120 | register(editor); 121 | }); 122 | } 123 | 124 | Plugin(); 125 | 126 | }()); 127 | -------------------------------------------------------------------------------- /demo-front/public/tinymce/plugins/preview/plugin.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 | * Licensed under the LGPL or a commercial license. 4 | * For LGPL see License.txt in the project root for license information. 5 | * For commercial licenses see https://www.tiny.cloud/ 6 | * 7 | * Version: 5.9.1 (2021-08-27) 8 | */ 9 | !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),f=tinymce.util.Tools.resolve("tinymce.Env"),w=tinymce.util.Tools.resolve("tinymce.util.Tools");e.add("preview",function(e){var n,t;function i(){return t.execCommand("mcePreview")}(n=e).addCommand("mcePreview",function(){var e,t;t=function(t){var n="",i=t.dom.encode,e=t.getParam("content_style","","string");n+='';var o=t.getParam("content_css_cors",!1,"boolean")?' crossorigin="anonymous"':"";w.each(t.contentCSS,function(e){n+='"}),e&&(n+='");var a,r,s,c,d,l,m,y=-1===(c=(a=t).getParam("body_id","tinymce","string")).indexOf("=")?c:(s=(r=a).getParam("body_id","","hash"))[r.id]||s,u=-1===(m=(d=t).getParam("body_class","","string")).indexOf("=")?m:(l=d).getParam("body_class","","hash")[l.id]||"",v=' 47 | 48 | 143 | -------------------------------------------------------------------------------- /demo-front/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | import router from './router' 4 | 5 | // elementui 6 | import ElementUI from 'element-ui'; 7 | import 'element-ui/lib/theme-chalk/index.css'; 8 | 9 | Vue.use(ElementUI); 10 | Vue.config.productionTip = false 11 | 12 | new Vue({ 13 | el: '#app', 14 | router, 15 | render: h => h(App) 16 | }) 17 | -------------------------------------------------------------------------------- /demo-front/src/plugins/component.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | import emptyStatus from '@/components/emptyStatus' 4 | import ellipsisTooltip from '@/components/ellipsisTooltip' 5 | 6 | // 暂无数据 7 | Vue.component('empty-status', emptyStatus) 8 | // Tooltip 二次封装 (超出显示,不超出不显示) 9 | Vue.component('ellipsis-tooltip', ellipsisTooltip) 10 | -------------------------------------------------------------------------------- /demo-front/src/plugins/element.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import ElementUI from 'element-ui' 3 | import 'element-ui/lib/theme-chalk/index.css' 4 | 5 | // element css 6 | import '@/styles/element-ui.scss' 7 | 8 | // import locale from 'element-ui/lib/locale/lang/en' // lang i18n 9 | 10 | // set ElementUI lang to EN 11 | // Vue.use(ElementUI, { locale }) 12 | // 如果想要中文版 element-ui,按如下方式声明 13 | Vue.use(ElementUI) 14 | -------------------------------------------------------------------------------- /demo-front/src/plugins/index.js: -------------------------------------------------------------------------------- 1 | // 公共引入 2 | import Vue from 'vue' 3 | 4 | // Element-ui 5 | import './element' 6 | // global prototype 7 | import './prototype' 8 | // global components 9 | import './component' 10 | // A modern alternative to CSS resets 11 | import 'normalize.css/normalize.css' 12 | -------------------------------------------------------------------------------- /demo-front/src/plugins/prototype.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | // qs 4 | import qs from 'qs' 5 | Vue.prototype.qs = qs 6 | 7 | // common 8 | import common from '@/utils/common' 9 | Vue.prototype.$common = common 10 | 11 | // 引入echarts 12 | import echarts from 'echarts' 13 | Vue.prototype.$echarts = echarts 14 | 15 | // 引入全局css变量 16 | import themes_style from '@/styles/themes.scss' 17 | Vue.prototype.$themes_style = themes_style 18 | 19 | // 时间格式转换 20 | import moment from 'moment/moment' 21 | Vue.prototype.$moment = moment 22 | -------------------------------------------------------------------------------- /demo-front/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | 4 | 5 | Vue.use(VueRouter) 6 | 7 | const routes = [ 8 | 9 | { 10 | path: '/', 11 | name: 'Home', 12 | component: () => import('../views/Home.vue'), 13 | children:[ 14 | { 15 | // 文本填写 16 | path: '/text', 17 | name: 'text', 18 | component: () => import('../views/secondarylist/text.vue'), 19 | }, 20 | { 21 | // 对话 22 | path: '/dialog', 23 | name: 'dialog', 24 | component: () => import('../views/secondarylist/dialog.vue'), 25 | }, 26 | { 27 | // 故事 28 | path: '/story', 29 | name: 'story', 30 | component: () => import('../views/secondarylist/story.vue'), 31 | }, 32 | ] 33 | } 34 | ] 35 | 36 | const router = new VueRouter({ 37 | routes 38 | }) 39 | 40 | export default router 41 | -------------------------------------------------------------------------------- /demo-front/src/settings.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 3 | title: 'Admin', 4 | 5 | /** 6 | * @type {boolean} true | false 7 | * @description Whether fix the header 8 | */ 9 | fixedHeader: true, 10 | 11 | /** 12 | * @type {boolean} true | false 13 | * @description Whether show the logo in sidebar 14 | */ 15 | sidebarLogo: true, 16 | 17 | /** 18 | * @type {string} 19 | * @description 本地存储前缀 20 | */ 21 | prefix: 'default' 22 | } 23 | -------------------------------------------------------------------------------- /demo-front/src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 97 | 172 | -------------------------------------------------------------------------------- /demo-front/src/views/secondarylist/story.vue: -------------------------------------------------------------------------------- 1 | 33 | 129 | 209 | -------------------------------------------------------------------------------- /demo-front/src/views/secondarylist/style/home.scss: -------------------------------------------------------------------------------- 1 | *{ 2 | margin: 0; 3 | padding: 0; 4 | } 5 | input,textarea,a{ 6 | outline: none; 7 | border: 0; 8 | text-decoration: none !important; 9 | color: black; 10 | } 11 | .home{ 12 | 13 | width: 100vw; 14 | height: 100vh; 15 | display: flex; 16 | flex-direction: column; 17 | } 18 | 19 | .content{ 20 | flex:1; 21 | display: flex; 22 | } 23 | .nav{ 24 | box-shadow: 2px 0 20px 0 rgba(0,0,0,0.10); 25 | position: absolute; 26 | top: 0; 27 | z-index: 1000; 28 | height: 100%; 29 | background-color: #FFF; 30 | } 31 | /deep/ .el-icon-arrow-down:before{ 32 | content:"\e791"; 33 | } 34 | /deep/ .el-submenu.is-opened>.el-submenu__title .el-submenu__icon-arrow{ 35 | transform: rotateZ(90deg); 36 | } 37 | /deep/ .el-submenu__title>span{ 38 | font-size: 14px; 39 | margin-left: 8px; 40 | font-family: Source Han Sans CN; 41 | font-weight: 600; 42 | color: #030B1D; 43 | } 44 | /deep/ .is-active{ 45 | background-color: #E8EEFC !important; 46 | } 47 | /deep/ .el-menu{ 48 | border-right: none; 49 | } 50 | /deep/ .el-menu-item-group__title{ 51 | padding: 0; 52 | } 53 | .nav>>>.el-submenu .el-menu-item{ 54 | min-width: 224px !important; 55 | } 56 | /deep/ .el-menu-vertical-demo{ 57 | // height: 100%; 58 | box-sizing: border-box; 59 | padding-top: 24px; 60 | } 61 | /deep/ .el-submenu__title{ 62 | width: 224px; 63 | } 64 | /deep/ .el-menu-item{ 65 | padding-left: 68px !important; 66 | text-align: left; 67 | } 68 | .el-icon-cpu:before{ 69 | color: #909399; 70 | } 71 | .cont{ 72 | flex: 1; 73 | display: flex; 74 | flex-direction: column; 75 | padding-left: 226px; 76 | // background-color: #F7FAFF; 77 | .breadcrumb{ 78 | width: 100%; 79 | height: 36px; 80 | display: flex; 81 | align-items: center; 82 | padding: 0 18px; 83 | box-sizing: border-box; 84 | background: #FFFFFF; 85 | } 86 | 87 | } 88 | 89 | // 面包屑 90 | 91 | /deep/ .bread1>span:nth-of-type(1){ 92 | // color: red !important; 93 | font-size: 12px; 94 | font-family: Source Han Sans CN; 95 | font-weight: 400; 96 | 97 | } 98 | /deep/ .el-breadcrumb__separator{ 99 | display: none; 100 | } 101 | /deep/ .bread2>span:nth-of-type(1){ 102 | font-size: 12px; 103 | font-family: Source Han Sans CN; 104 | font-weight: 400; 105 | color: #2F3033 !important; 106 | } -------------------------------------------------------------------------------- /demo-front/src/views/secondarylist/text.vue: -------------------------------------------------------------------------------- 1 | 31 | 154 | 215 | -------------------------------------------------------------------------------- /demo-front/vue.config.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const defaultSettings = require('./src/settings.js') 4 | function resolve(dir) { 5 | return path.join(__dirname, dir) 6 | } 7 | 8 | const port = process.env.port || process.env.npm_config_port || 8080 // dev port 9 | 10 | // All configuration item explanations can be find in https://cli.vuejs.org/config/ 11 | module.exports = { 12 | /** 13 | * You will need to set publicPath if you plan to deploy your site under a sub path, 14 | * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/, 15 | * then publicPath should be set to "/bar/". 16 | * In most cases please use '/' !!! 17 | * Detail: https://cli.vuejs.org/config/#publicpath 18 | */ 19 | runtimeCompiler: true, 20 | publicPath: './', 21 | outputDir: 'dist', 22 | assetsDir: 'static', 23 | lintOnSave: process.env.NODE_ENV === 'development', 24 | productionSourceMap: false, 25 | devServer: { 26 | hot:true, 27 | port: port, 28 | open: true, 29 | overlay: { 30 | warnings: false, 31 | errors: true 32 | }, 33 | 34 | proxy: { 35 | '/api': { 36 | target: "http://localhost:29100/", 37 | changeOrigin: true, 38 | }, 39 | } 40 | }, 41 | configureWebpack: { 42 | // provide the app's title in webpack's name field, so that 43 | // it can be accessed in index.html to inject the correct title. 44 | name: 'BMInf Demos', 45 | resolve: { 46 | modules: [path.resolve('node_modules'), 'node_modules'], 47 | alias: { 48 | '@': resolve('src') 49 | } 50 | }, 51 | entry: './src/main.js' 52 | }, 53 | chainWebpack(config) { 54 | // it can improve the speed of the first screen, it is recommended to turn on preload 55 | config.plugin('preload').tap(() => [ 56 | { 57 | rel: 'preload', 58 | // to ignore runtime.js 59 | // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171 60 | fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/], 61 | include: 'initial' 62 | } 63 | ]) 64 | 65 | // when there are many pages, it will cause too many meaningless requests 66 | config.plugins.delete('prefetch') 67 | 68 | // set svg-sprite-loader 69 | config.module 70 | .rule('svg') 71 | .exclude.add(resolve('src/icons')) 72 | .end() 73 | config.module 74 | .rule('icons') 75 | .test(/\.svg$/) 76 | .include.add(resolve('src/icons')) 77 | .end() 78 | .use('svg-sprite-loader') 79 | .loader('svg-sprite-loader') 80 | .options({ 81 | symbolId: 'icon-[name]' 82 | }) 83 | .end() 84 | 85 | config 86 | .when(process.env.NODE_ENV !== 'development', 87 | config => { 88 | config 89 | .plugin('ScriptExtHtmlWebpackPlugin') 90 | .after('html') 91 | .use('script-ext-html-webpack-plugin', [{ 92 | // `runtime` must same as runtimeChunk name. default is `runtime` 93 | inline: /runtime\..*\.js$/ 94 | }]) 95 | .end() 96 | config 97 | .optimization.splitChunks({ 98 | chunks: 'all', 99 | cacheGroups: { 100 | libs: { 101 | name: 'chunk-libs', 102 | test: /[\\/]node_modules[\\/]/, 103 | priority: 10, 104 | chunks: 'initial' // only package third parties that are initially dependent 105 | }, 106 | elementUI: { 107 | name: 'chunk-elementUI', // split elementUI into a single package 108 | priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app 109 | test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm 110 | }, 111 | commons: { 112 | name: 'chunk-commons', 113 | test: resolve('src/components'), // can customize your rules 114 | minChunks: 3, // minimum common number 115 | priority: 5, 116 | reuseExistingChunk: true 117 | } 118 | } 119 | }) 120 | // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk 121 | config.optimization.runtimeChunk('single') 122 | } 123 | ) 124 | 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /demo_adapter.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | import importlib 3 | 4 | def demo_adapter(demoname, model, req_json): 5 | package = find_packages('demos') 6 | for i in range(len(package)): 7 | if package[i] == demoname: 8 | path='demos.'+package[i] 9 | module = importlib.import_module(path) 10 | return module.demoImpl(model, req_json) 11 | 12 | -------------------------------------------------------------------------------- /demos/dialogue/__init__.py: -------------------------------------------------------------------------------- 1 | def demoImpl(model, req_json): 2 | text = req_json.get('text') 3 | max_tokens1 = req_json.get('max_tokens') 4 | top_p1 = req_json.get('top_p') 5 | top_n1 = req_json.get('top_n') 6 | temperature1 = req_json.get('temperature') 7 | frequency_penalty1 = req_json.get('frequency_penalty') 8 | presence_penalty1 = req_json.get('presence_penalty') 9 | result = model.dialogue(text, 10 | max_tokens = max_tokens1, 11 | top_p = top_p1, 12 | top_n = top_n1, 13 | temperature = temperature1, 14 | frequency_penalty = frequency_penalty1, 15 | presence_penalty = presence_penalty1) 16 | return result -------------------------------------------------------------------------------- /demos/fillblank/__init__.py: -------------------------------------------------------------------------------- 1 | def demoImpl(model,req_json): 2 | TOKEN_SPAN = "" 3 | text = req_json.get('text') 4 | top_p1 = req_json.get('top_p') 5 | top_n1 = req_json.get('top_n') 6 | temperature1 = req_json.get('temperature') 7 | frequency_penalty1 = req_json.get('frequency_penalty') 8 | presence_penalty1 = req_json.get('presence_penalty') 9 | result = model.fill_blank(text, 10 | top_p = top_p1, 11 | top_n = top_n1, 12 | temperature = temperature1, 13 | frequency_penalty = frequency_penalty1, 14 | presence_penalty = presence_penalty1) 15 | 16 | for v in result: 17 | value = v["text"] 18 | text = text.replace(TOKEN_SPAN, value , 1) 19 | res = {"list":result,"resp_text":text} 20 | return res 21 | 22 | 23 | -------------------------------------------------------------------------------- /demos/generatestory/__init__.py: -------------------------------------------------------------------------------- 1 | def demoImpl(model, req_json): 2 | text = req_json.get('text') 3 | max_tokens = req_json.get('max_tokens') 4 | top_p1 = req_json.get('top_p') 5 | top_n1 = req_json.get('top_n') 6 | temperature1 = req_json.get('temperature') 7 | frequency_penalty1 = req_json.get('frequency_penalty') 8 | presence_penalty1 = req_json.get('presence_penalty') 9 | 10 | result=[] 11 | for _ in range(3): 12 | resp = model.generate(text,max_tokens = max_tokens,top_n = top_n1,top_p = top_p1,temperature = temperature1,frequency_penalty = frequency_penalty1,presence_penalty = presence_penalty1) 13 | result.append(resp) 14 | return result -------------------------------------------------------------------------------- /demotomodel.py: -------------------------------------------------------------------------------- 1 | # 1 --> cpm1 model 2 | # 2 --> cpm2 model 3 | # 3 --> eva model 4 | 5 | demotomodel = {'generatestory':1,'fillblank':2,'dialogue':3} 6 | def demoToModel(demoname): 7 | return demotomodel.get(demoname) 8 | -------------------------------------------------------------------------------- /gpu_info.py: -------------------------------------------------------------------------------- 1 | import pynvml 2 | 3 | def gpu_info(): 4 | NUM_EXPAND = 1024*1024 5 | pynvml.nvmlInit() 6 | handle = pynvml.nvmlDeviceGetHandleByIndex(0) 7 | info = pynvml.nvmlDeviceGetMemoryInfo(handle) 8 | mem_used_rate = round(info.used/info.total,4)*100 #显存 9 | utilization = pynvml.nvmlDeviceGetUtilizationRates(handle) 10 | gpu_rate = round(utilization.gpu,4) #gpu使用率 11 | memory_rate = round(utilization.memory,4) #内存使用率 12 | 13 | pynvml.nvmlShutdown() 14 | 15 | rate={} 16 | rate['memory_rate']= memory_rate 17 | rate['gpu_rate']= gpu_rate 18 | rate['meme_used_rate'] = mem_used_rate 19 | return rate 20 | -------------------------------------------------------------------------------- /images/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenBMB/BMInf-demos/0a55d22905515c87656d1adb790a8d54017b828e/images/.DS_Store -------------------------------------------------------------------------------- /images/demo1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenBMB/BMInf-demos/0a55d22905515c87656d1adb790a8d54017b828e/images/demo1.jpg -------------------------------------------------------------------------------- /images/demo2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenBMB/BMInf-demos/0a55d22905515c87656d1adb790a8d54017b828e/images/demo2.jpg -------------------------------------------------------------------------------- /images/demo3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenBMB/BMInf-demos/0a55d22905515c87656d1adb790a8d54017b828e/images/demo3.jpg -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import threading 2 | from flask import Flask,request,jsonify 3 | from flask.helpers import send_from_directory 4 | import gpu_info as gpuinfo 5 | import demo_adapter as adapter 6 | import demotomodel as dm 7 | import bminf 8 | import os 9 | 10 | CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) 11 | 12 | app = Flask(__name__, static_url_path="", static_folder="statics") 13 | 14 | model = None 15 | current_key = None 16 | #lock methods 17 | lock = threading.Lock() 18 | 19 | @app.route('/api/loadmodel',methods=['GET']) 20 | def model_load(): 21 | res = request.args.get('key') 22 | key = int(res) 23 | 24 | global model, current_key 25 | 26 | if lock.locked(): 27 | data={'code':201,'message':'sorry,此模型正在被其他人独霸,请稍后再试!'} 28 | return jsonify(data),201 29 | else: 30 | if key == current_key: 31 | return jsonify({'code':200,'message':'success'}) 32 | if key == 1: 33 | lock.acquire() 34 | model = None 35 | print('loading cpm1') 36 | model = bminf.models.CPM1() 37 | lock.release() 38 | elif key == 2: 39 | lock.acquire() 40 | model = None 41 | print('loading cpm2') 42 | model = bminf.models.CPM2() 43 | lock.release() 44 | elif key == 3: 45 | lock.acquire() 46 | model = None 47 | print('loading eva') 48 | model = bminf.models.EVA() 49 | lock.release() 50 | current_key = key 51 | return jsonify({'code':200,'message':'success'}) 52 | 53 | @app.route('/api/gpuinfo',methods=['GET']) 54 | def gpu_info(): 55 | rate = gpuinfo.gpu_info() 56 | return jsonify({'code':200,'message':'success','data':rate}) 57 | 58 | @app.route('/api/',methods=['POST']) 59 | def demo(demoname): 60 | if current_key != dm.demoToModel(demoname): 61 | return jsonify({'code':202,'message':'模型已经失效,请刷新后重新加载'}),201 62 | if lock.locked() == False: 63 | lock.acquire() 64 | req_json = request.json 65 | result = adapter.demo_adapter(demoname, model, req_json) 66 | lock.release() 67 | return jsonify({'code':200,'message':'success','data':result}) 68 | else: 69 | return jsonify({'code':201,'message':'sorry,此接口正在被其他人独霸,请稍后再试!'}),201 70 | 71 | @app.route("/", methods=["GET"]) 72 | def index(): 73 | return send_from_directory( 74 | os.path.join(CURRENT_DIR, "statics"), 75 | "index.html" 76 | ) 77 | 78 | if __name__ == '__main__': 79 | app.config['JSON_AS_ASCII']= False 80 | app.run(host='0.0.0.0',port=8000) 81 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | bminf 2 | flask 3 | pynvml --------------------------------------------------------------------------------