@textbus/xnote 0.3.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai.service.ts +124 -0
- package/bundles/fonts/textbus.svg +51 -43
- package/bundles/fonts/textbus.ttf +0 -0
- package/bundles/fonts/textbus.woff +0 -0
- package/bundles/index.css +2 -2
- package/bundles/index.esm.css +2 -2
- package/bundles/index.esm.js +640 -378
- package/bundles/index.js +639 -375
- package/bundles/plugins/hooks/popup-position.d.ts +4 -0
- package/bundles/plugins/tools/_api.d.ts +1 -0
- package/bundles/plugins/tools/ai.tool.d.ts +4 -0
- package/bundles/services/_api.d.ts +1 -0
- package/bundles/services/llm.service.d.ts +24 -0
- package/bundles/textbus/components/table/tools/complete.d.ts +1 -1
- package/index.tsx +17 -11
- package/lerna.json +1 -4
- package/package.json +12 -9
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Observable } from '@textbus/core';
|
|
2
|
+
export interface LLMParams {
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
export interface LLMTranslateParams extends LLMParams {
|
|
6
|
+
targetLanguage: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 大模型接口
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class LLMService {
|
|
12
|
+
/** 续写 */
|
|
13
|
+
abstract continue(params: LLMParams): Observable<string>;
|
|
14
|
+
/** 润色内容 */
|
|
15
|
+
abstract polish(params: LLMParams): Observable<string>;
|
|
16
|
+
/** 简化内容 */
|
|
17
|
+
abstract simplify(params: LLMParams): Observable<string>;
|
|
18
|
+
/** 丰富内容 */
|
|
19
|
+
abstract enrich(params: LLMParams): Observable<string>;
|
|
20
|
+
/** 翻译内容 */
|
|
21
|
+
abstract translate(params: LLMTranslateParams): Observable<string>;
|
|
22
|
+
/** 总结内容 */
|
|
23
|
+
abstract summarize(params: LLMParams): Observable<string>;
|
|
24
|
+
}
|
package/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import 'reflect-metadata'
|
|
3
|
-
import { Editor, Member, Organization } from './src/public-api'
|
|
3
|
+
import { Editor, LLMService, Member, Organization } from './src/public-api'
|
|
4
4
|
import { SyncConnector, YWebsocketConnector } from '@textbus/collaborate'
|
|
5
5
|
import { FileUploader } from './src/interfaces'
|
|
6
6
|
import { UserInfo } from './src/xnote-message-bus'
|
|
@@ -8,7 +8,8 @@ import { StaticToolbarPlugin, SuspensionToolbarPlugin } from '@textbus/xnote'
|
|
|
8
8
|
import { VIEW_CONTAINER } from '@textbus/platform-browser'
|
|
9
9
|
import { createRef, createSignal, onMounted } from '@viewfly/core'
|
|
10
10
|
import { createApp } from '@viewfly/platform-browser'
|
|
11
|
-
import { RootComponentRef } from '@textbus/core'
|
|
11
|
+
import { Observable, RootComponentRef } from '@textbus/core'
|
|
12
|
+
import { AiService } from './ai.service'
|
|
12
13
|
|
|
13
14
|
const firstNameText = '王、李、张、刘、陈、杨、黄、赵、周、吴、徐、孙、马、胡、朱、郭、何、罗、高、林'.replace(/、/g, '')
|
|
14
15
|
const lastNameText = '本义既为女子所生子嗣则同一女子所生子嗣组成的亲族也可以称为姓以表示其同出于一个女性始祖的这种特殊的亲属关系这是姓的另一引申义此种亲族组织强调女性始祖则当如许多学者所推拟的其最初必形成于母系氏族社会中即夫从妻居子女属于母族世系以母方计对于这种具有血缘关系的亲属组织的名称杨希枚先生主张称为姓族典籍所记姬姓姜姓嬴姓最初应皆属母系姓族姬姜则是此种母系姓族之名号进入父系氏族社会后妻从夫居子女不再属母族而归于父族世系以父方计所以母系姓族遂转为父系姓族此后父系姓族仍然使用着母系姓族的名号其四姓在东周文献中有时是指姓族之名号如国语周语下言赐姓曰姜之姓即应理解为所赐姓族之名号即姜又如左传哀公五月昭夫人孟子卒昭公娶于吴故不书姓很明显姓在这里是指吴女所属姓族之名号即姬所谓姓族之姓与作姓族名号讲的姓是一实一名属于两种概念范畴所以会发生此种混同当如杨希枚先生所言是由于名代表实积久而以实为名于是产生姬姜之类姓之名号就是姓的概念司马迁在史记中常言姓某氏没能区别古代姓与氏之不同但他所说的姓意思即是指姓族之名号妘黄帝住姬水之滨以姬为姓司马迁在史记五帝本纪中说黄帝二十五子其得姓者十四人三语中胥臣解释说黄帝之子二十五宗其得姓者十四人为十二姓姬酉祁己滕箴任荀僖姞儇衣是也惟青阳与夷鼓同己姓后来的五帝少昊颛顼喾尧舜以及夏禹商族的祖先契周族的祖先农神后稷秦族的祖先伯益等都是黄帝的后代后稷承继姬姓他的后代建立了周朝周初周天子姬发大封诸侯时其中姬姓国个姬姓位于百家姓第位由姬姓演支出个姓占百家姓总姓姓的再演化出来的姓氏更是数不胜数了炎帝居姜水之旁以姜为姓姜姓还是今天中国的许多姓氏如吕姓谢姓齐姓高姓卢姓崔姓等的重要起源之一姜姓在当今以人口排名的中国百家姓氏中居于第位妘起源于帝喾高辛氏嬴起源于少昊金天氏;姚妫同源都是起源于帝舜;姒起源于大禹此外部落首领之子亦可得姓黄帝有二十五子得姓者十四人为姬酉祁己滕任荀葴僖姞儇依十二姓其中有四人分属二姓祝融之后为己董彭秃妘曹斟芈等八姓史称祝融八姓'
|
|
@@ -83,7 +84,6 @@ class Http extends Organization {
|
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
|
|
87
87
|
function EditorContainer() {
|
|
88
88
|
const editorRef = createRef<HTMLElement>()
|
|
89
89
|
const htmlRef = createRef<HTMLTextAreaElement>()
|
|
@@ -91,21 +91,27 @@ function EditorContainer() {
|
|
|
91
91
|
const editor = new Editor({
|
|
92
92
|
readonly: false,
|
|
93
93
|
// content: document.getElementById('article')!.innerHTML,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
collaborateConfig: {
|
|
95
|
+
userinfo: user,
|
|
96
|
+
createConnector(yDoc): SyncConnector {
|
|
97
|
+
// return new YWebsocketConnector('ws://localhost:1234', 'xnote', yDoc)
|
|
98
|
+
return new YWebsocketConnector('wss://textbus.io/api', 'xnote', yDoc)
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
101
|
// plugins: [
|
|
102
|
-
// new SuspensionToolbarPlugin(
|
|
102
|
+
// new SuspensionToolbarPlugin({
|
|
103
|
+
// theme: 'dark'
|
|
104
|
+
// })
|
|
103
105
|
// ],
|
|
104
106
|
providers: [
|
|
105
107
|
{
|
|
106
108
|
provide: Organization,
|
|
107
109
|
useValue: new Http()
|
|
108
110
|
},
|
|
111
|
+
{
|
|
112
|
+
provide: LLMService,
|
|
113
|
+
useValue: new AiService()
|
|
114
|
+
},
|
|
109
115
|
{
|
|
110
116
|
provide: FileUploader,
|
|
111
117
|
useValue: {
|
package/lerna.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@textbus/xnote",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A high-performance rich text editor that supports multiplayer online collaboration.",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -27,15 +27,17 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@tanbo/color": "^0.1.1",
|
|
30
|
-
"@textbus/adapter-viewfly": "^5.
|
|
31
|
-
"@textbus/collaborate": "^5.
|
|
32
|
-
"@textbus/core": "^5.
|
|
33
|
-
"@textbus/platform-browser": "^5.
|
|
34
|
-
"@
|
|
35
|
-
"@viewfly/
|
|
36
|
-
"@viewfly/
|
|
30
|
+
"@textbus/adapter-viewfly": "^5.1.1",
|
|
31
|
+
"@textbus/collaborate": "^5.1.1",
|
|
32
|
+
"@textbus/core": "^5.1.1",
|
|
33
|
+
"@textbus/platform-browser": "^5.1.1",
|
|
34
|
+
"@types/markdown-it": "^14.1.2",
|
|
35
|
+
"@viewfly/core": "^2.0.0",
|
|
36
|
+
"@viewfly/platform-browser": "^2.0.0",
|
|
37
|
+
"@viewfly/scoped-css": "^2.0.0",
|
|
37
38
|
"highlight.js": "^11.9.0",
|
|
38
39
|
"katex": "^0.16.10",
|
|
40
|
+
"markdown-it": "^14.1.1",
|
|
39
41
|
"uuid": "^10.0.0"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
@@ -46,7 +48,8 @@
|
|
|
46
48
|
"@types/uuid": "^10.0.0",
|
|
47
49
|
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
|
48
50
|
"@typescript-eslint/parser": "^5.8.0",
|
|
49
|
-
"@viewfly/devtools": "^
|
|
51
|
+
"@viewfly/devtools": "^2.0.0",
|
|
52
|
+
"@y/websocket-server": "^0.1.5",
|
|
50
53
|
"autoprefixer": "^10.4.0",
|
|
51
54
|
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
|
52
55
|
"core-js": "^3.20.1",
|