@nebulars/primary 0.3.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.prettierignore +0 -0
  2. package/.prettierrc.cjs +8 -0
  3. package/components/fqa/index.vue +128 -0
  4. package/components/fqa/markdown-notes.less +34 -0
  5. package/components/fqa-amixer/index.vue +105 -0
  6. package/components/fqa-aovery/index.vue +46 -0
  7. package/components/fqa-aovery/modify.less +3 -0
  8. package/components/fqa-arrow/index.vue +51 -0
  9. package/components/fqa-assist/index.vue +104 -0
  10. package/components/fqa-assist/menus-modify.less +38 -0
  11. package/components/fqa-assist/start-modify.less +3 -0
  12. package/components/fqa-attach/index.vue +51 -0
  13. package/components/fqa-attach/modify.less +3 -0
  14. package/components/fqa-boxer/index.vue +130 -0
  15. package/components/fqa-button/index.vue +105 -0
  16. package/components/fqa-control/index.vue +47 -0
  17. package/components/fqa-debug/index.vue +49 -0
  18. package/components/fqa-download/index.vue +65 -0
  19. package/components/fqa-footer/index.vue +25 -0
  20. package/components/fqa-fullscreen/index.vue +60 -0
  21. package/components/fqa-gap/index.vue +10 -0
  22. package/components/fqa-header/index.vue +105 -0
  23. package/components/fqa-header/poping-modify.less +48 -0
  24. package/components/fqa-icon/index.vue +36 -0
  25. package/components/fqa-input/index.vue +47 -0
  26. package/components/fqa-link/index.vue +184 -0
  27. package/components/fqa-lister/index.vue +61 -0
  28. package/components/fqa-logo/index.vue +34 -0
  29. package/components/fqa-markdown/index.vue +109 -0
  30. package/components/fqa-markdown/katex-modify.less +0 -0
  31. package/components/fqa-markdown/table-modify.less +5 -0
  32. package/components/fqa-markdown/table-ops.less +76 -0
  33. package/components/fqa-mask/index.vue +42 -0
  34. package/components/fqa-pagination/index.vue +44 -0
  35. package/components/fqa-pagination/modify.less +66 -0
  36. package/components/fqa-preloading/index.vue +70 -0
  37. package/components/fqa-profile/index.vue +141 -0
  38. package/components/fqa-reissue/index.vue +19 -0
  39. package/components/fqa-selection/index.vue +95 -0
  40. package/components/fqa-selection/modify.less +10 -0
  41. package/components/fqa-sider/index.vue +16 -0
  42. package/components/fqa-snapshot/index.vue +107 -0
  43. package/components/fqa-start/index.vue +321 -0
  44. package/components/fqa-start/modify.less +11 -0
  45. package/components/fqa-switcher/index.vue +94 -0
  46. package/components/fqa-table/index.vue +42 -0
  47. package/components/fqa-table/modify.less +56 -0
  48. package/components/fqa-text/index.vue +58 -0
  49. package/components/fqa-welcome/index.vue +29 -0
  50. package/components/fqa-worcha/index.vue +107 -0
  51. package/components/fqa-worry/index.vue +148 -0
  52. package/index.js +20 -0
  53. package/package.json +9 -0
@@ -0,0 +1,321 @@
1
+ <style lang="less" scoped>
2
+ .fqa-start {
3
+ & {
4
+ padding: @unit;
5
+ gap: @atom;
6
+ }
7
+
8
+ &-item {
9
+ line-height: 40px;
10
+ padding-inline: @gap;
11
+ border-radius: @radiu * 2 !important;
12
+ cursor: pointer;
13
+ transition: all @effect;
14
+
15
+ &:hover {
16
+ background-color: rgba(0, 0, 0, 0.06);
17
+ }
18
+
19
+ &.active {
20
+ background-color: darken(@color-assist, 5%);
21
+ }
22
+ }
23
+
24
+ &-slicks {
25
+ display: flex;
26
+ overflow-x: auto;
27
+ position: relative;
28
+ scroll-snap-type: x mandatory;
29
+ scrollbar-width: none;
30
+ -webkit-overflow-scrolling: touch;
31
+
32
+ &::-webkit-scrollbar {
33
+ display: none;
34
+ }
35
+
36
+ gap: @gap;
37
+
38
+ &-left,
39
+ &-right {
40
+ width: @size-slick;
41
+ height: @size-slick;
42
+ position: absolute;
43
+ }
44
+
45
+ &-left {
46
+ left: -@size-slick;
47
+ }
48
+
49
+ &-right {
50
+ right: -@size-slick;
51
+ }
52
+ }
53
+
54
+ &-slick {
55
+ flex: 0 0 80px;
56
+ height: 80px;
57
+
58
+ font-size: 13px;
59
+
60
+ scroll-snap-align: start;
61
+ white-space: nowrap;
62
+ display: flex;
63
+ flex-direction: column;
64
+ align-items: center;
65
+ justify-content: center;
66
+ gap: @gap;
67
+ padding: @gap;
68
+ border: 1px solid @color-line;
69
+ border-radius: @dozen;
70
+ background-color: @color-app;
71
+ transition: all @effect;
72
+ cursor: pointer;
73
+
74
+ &:hover {
75
+ border-color: darken(@color-line, 25%);
76
+ }
77
+
78
+ &.active {
79
+ color: @color-professor;
80
+ border-color: @color-professor;
81
+ }
82
+
83
+ /*
84
+ &.active {
85
+ color: @color-app;
86
+ border-color: #123248;
87
+ background: #123248;
88
+ }
89
+ */
90
+ }
91
+
92
+ &-icon {
93
+ font-size: 21px;
94
+ }
95
+
96
+ // Special for Mobile -- 主管要求,勿删
97
+ &-slick-mobile {
98
+ & {
99
+ // display: grid;
100
+ // grid-template-columns: repeat(2, 1fr);
101
+ // gap: 12px;
102
+
103
+ overflow: hidden;
104
+ }
105
+
106
+ &-item {
107
+ width: 128px;
108
+ height: 48px;
109
+ line-height: 42px;
110
+ border-radius: 8px;
111
+ padding-left: 16px;
112
+ float: left;
113
+
114
+ border: 1px solid #bdc5d0;
115
+ background-color: #ffffff;
116
+
117
+ margin-top: 12px;
118
+
119
+ &:nth-child(even) {
120
+ margin-right: 12px;
121
+ }
122
+
123
+ span {
124
+ padding-right: 6px;
125
+ vertical-align: middle;
126
+ }
127
+
128
+ &:hover {
129
+ border-color: #e4ebf4;
130
+ background-color: #e4ebf4;
131
+ }
132
+ }
133
+
134
+ &-create {
135
+ width: 100%;
136
+ height: 54px;
137
+ line-height: 48px;
138
+ border-radius: 8px;
139
+ text-align: center;
140
+
141
+ border: 1px solid #00275e;
142
+ background-color: #d7e2f8;
143
+
144
+ span {
145
+ padding-right: 6px;
146
+ vertical-align: middle;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ </style>
152
+
153
+ <template>
154
+ <a-flex class="fqa-start" vertical>
155
+ <!--
156
+ <a-space class="fqa-start-item" @click="createHandler">
157
+ <EditOutlined />
158
+ <span>{{ $t('start.create') }}</span>
159
+ </a-space>
160
+
161
+ <template v-for="{ name } in routes">
162
+ <a-space :class="{ 'fqa-start-item': true, active: $route.name === name }" v-if="surface[name] && hides[name] !== true" @click="trigger(name)">
163
+ <component :is="icons[name]" />
164
+ <span>{{ $t(`start.${name}`) }}</span>
165
+ </a-space>
166
+ </template>
167
+ -->
168
+
169
+ <!--
170
+ <fqa-gap />
171
+
172
+ <template v-if="app.mobile">
173
+ <div class="fqa-start-slick-mobile">
174
+ <template v-for="(item, index) in slicks">
175
+ <div :class="{ active: current(item), 'fqa-start-slick-mobile-item': !!index, 'fqa-start-slick-mobile-create': !index }" @click="trigger(item)">
176
+ <component :is="icons[item.name] || item.icon" class="fqa-start-icon" />
177
+ <span>{{ item.title || $t(`start.${item.name}`) }}</span>
178
+ </div>
179
+ </template>
180
+ </div>
181
+ </template>
182
+ -->
183
+
184
+ <horizontal :items="slicks">
185
+ <template #default="{ item }">
186
+ <div :class="{ 'fqa-start-slick': true, active: current(item) }" @click="trigger(item)">
187
+ <component :is="icons[item.name] || item.icon" class="fqa-start-icon" />
188
+ <span>{{ item.title || $t(`start.${item.name}`) }}</span>
189
+ </div>
190
+ </template>
191
+ </horizontal>
192
+ </a-flex>
193
+ </template>
194
+
195
+ <script>
196
+ import { namespace } from '@/extension';
197
+
198
+ export default {
199
+ props: {
200
+ ignore: {
201
+ type: [Array],
202
+ default: namespace,
203
+ },
204
+ },
205
+
206
+ data() {
207
+ return {
208
+ namespace: undefined,
209
+ extension: undefined,
210
+ };
211
+ },
212
+
213
+ computed: {
214
+ surface() {
215
+ return Object.fromEntries(this.routes.map(({ name }) => [name, true]));
216
+ },
217
+
218
+ routes() {
219
+ // Filter Routes by Ignore
220
+ return this.$router.getRoutes().filter(({ name }) => !this.ignore.includes(name));
221
+ },
222
+
223
+ icons() {
224
+ // Get Icons from Global Properties
225
+ return Object.fromEntries(this.routes.map(({ name }) => [name, this[name]?.icon]));
226
+ },
227
+
228
+ hides() {
229
+ // Get Hiddens from Global Properties
230
+ return Object.fromEntries(this.routes.map(({ name }) => [name, this[name]?.hidden]));
231
+ },
232
+
233
+ mobiles() {
234
+ // Get Mobiles from Global Properties
235
+ return Object.fromEntries(this.routes.map(({ name }) => [name, this.app.mobile ? this[name]?.mobile : undefined]));
236
+ },
237
+
238
+ envs() {
239
+ // Get Envs from Global Properties
240
+ return Object.fromEntries(this.routes.map(({ name }) => [name, this[name]?.env || []]));
241
+ },
242
+
243
+ slicks() {
244
+ return [
245
+ // Create First
246
+ { name: 'create', icon: 'EditOutlined' },
247
+ // Dynamic Routes
248
+ ...this.routes.filter(({ name }) => this.surface[name] && this.hides[name] !== true && this.mobiles[name] !== false && this.envs[name].includes(this.$util.mode)),
249
+ // Extensions
250
+ ...this.$util.remote(globalThis.__PRESET__.ENV),
251
+ ];
252
+ },
253
+ },
254
+
255
+ methods: {
256
+ current(item) {
257
+ // Get Path
258
+ const path = this.$route?.redirectedFrom?.path?.replace(/^\/remote/, '');
259
+
260
+ // Set Special for Remote
261
+ if (path && path.match(item.name)) return true;
262
+
263
+ // Normal Route
264
+ return item.name === this.$route.name;
265
+ },
266
+
267
+ async trigger(item) {
268
+ // Get Namespace
269
+ const { name: namespace } = item;
270
+
271
+ // Remote for Extension
272
+ if (item.extension) {
273
+ this.namespace = item.name;
274
+ this.extension = item.path;
275
+ }
276
+
277
+ // Create
278
+ if (namespace === 'create') {
279
+ return await this.createHandler();
280
+ }
281
+
282
+ // Tolerance
283
+ const fn = this[`${namespace}Handler`] || this[`remoteHandler`];
284
+
285
+ // Programs
286
+ await fn();
287
+ },
288
+
289
+ async createHandler() {
290
+ // Trigger Clean
291
+ this.$store.dispatch('sseengine/CLEAN');
292
+
293
+ // For Web
294
+ this.$util.message.send({ id: 'new' }, () => {
295
+ // For MNP
296
+ this.$router.push({ name: 'chat' });
297
+ });
298
+ },
299
+ },
300
+
301
+ created() {
302
+ // Extension Handlers
303
+ this.$util.extension.Handlers(this, name => {
304
+ // Clean Select
305
+ this.$store.dispatch('sseengine/STATE_UPDATE', { select: [] });
306
+
307
+ // Set Route - Special for Remote
308
+ const route = name === 'remote' ? { path: `/remote/${(this.extension || this.$api.remote).replace(/^http(s)?\:\/\//, '')}` } : { name };
309
+
310
+ // For Web
311
+ this.$util.message.send({ route }, () => {
312
+ // For MNP
313
+ this.$router.push(route);
314
+ });
315
+
316
+ // Clean
317
+ this.extension = undefined;
318
+ });
319
+ },
320
+ };
321
+ </script>
@@ -0,0 +1,11 @@
1
+ .fqa-start {
2
+ .slick-slide {
3
+ width: 120px !important;
4
+ }
5
+
6
+ .vue-horizontal {
7
+ .v-hl-container {
8
+ gap: @gap;
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,94 @@
1
+ <style lang="less" scoped>
2
+ .fqa-switcher {
3
+ --width: 96px;
4
+ --height: 36px;
5
+
6
+ & {
7
+ padding: @atom;
8
+ background-color: @color-assist;
9
+ position: relative;
10
+ }
11
+
12
+ &,
13
+ &:after {
14
+ border-radius: @radiu * 2;
15
+ }
16
+
17
+ &:after,
18
+ &-item {
19
+ width: var(--width);
20
+ height: var(--height);
21
+ line-height: var(--height);
22
+ padding: @unit @gap;
23
+ }
24
+
25
+ &:after {
26
+ content: '';
27
+ left: @atom;
28
+ top: @atom;
29
+ position: absolute;
30
+ background-color: @color-sider;
31
+ transition: all @fast;
32
+ }
33
+
34
+ &-item {
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ cursor: pointer;
39
+ z-index: 1;
40
+ position: relative;
41
+ }
42
+
43
+ &.left {
44
+ &:after {
45
+ transform: translateX(0);
46
+ }
47
+ }
48
+
49
+ &.middle {
50
+ &:after {
51
+ transform: translateX(calc(var(--width) + @atom * 2));
52
+ }
53
+ }
54
+
55
+ &.right {
56
+ &:after {
57
+ transform: translateX(calc(var(--width) * 2 + @atom * 4));
58
+ }
59
+ }
60
+ }
61
+ </style>
62
+
63
+ <template>
64
+ <a-space :class="{ 'fqa-switcher': true, [position]: true }">
65
+ <div class="fqa-switcher-item" v-for="({ key, title }, index) in menus" :key="key" @click="clickHandler(key, index)">{{ title }}</div>
66
+ </a-space>
67
+ </template>
68
+
69
+ <script>
70
+ export default {
71
+ props: {
72
+ active: {
73
+ type: [String, null],
74
+ default: null,
75
+ },
76
+ menus: {
77
+ type: [Array],
78
+ default: [],
79
+ },
80
+ },
81
+
82
+ computed: {
83
+ position() {
84
+ return ['left', 'middle', 'right'][this.menus.findIndex(item => item.key === this.active)];
85
+ },
86
+ },
87
+
88
+ methods: {
89
+ clickHandler(key, index) {
90
+ this.$emit('update:active', key);
91
+ },
92
+ },
93
+ };
94
+ </script>
@@ -0,0 +1,42 @@
1
+ <style lang="less" scoped>
2
+ .fqa-table {
3
+ &-text {
4
+ text-overflow: ellipsis;
5
+ overflow: hidden;
6
+ }
7
+ }
8
+ </style>
9
+
10
+ <template>
11
+ <a-table class="fqa-table" :columns="columns" :data-source="source" :pagination="false" :scroll="{ x: 'max-content', y: 'max-content' }" :sticky="true">
12
+ <template #bodyCell="{ text, record, index, column }">
13
+ <template v-if="column?.key === 'key'">
14
+ <slot name="tail" :column="column" :record="record" :index="index" />
15
+ </template>
16
+ <template v-else>
17
+ <div class="fqa-table-text" :style="{ maxWidth: `${column?.maxWidth}px` }">{{ translation[text] || text }}</div>
18
+ </template>
19
+ </template>
20
+ </a-table>
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ props: {
26
+ columns: {
27
+ type: [Array],
28
+ default: [],
29
+ },
30
+
31
+ source: {
32
+ type: [Array],
33
+ default: [],
34
+ },
35
+
36
+ translation: {
37
+ type: [Object],
38
+ default: {},
39
+ },
40
+ },
41
+ };
42
+ </script>
@@ -0,0 +1,56 @@
1
+ .fqa-table {
2
+ .ant-table {
3
+ background-color: darken(@color-assist, 1%);
4
+ }
5
+
6
+ .ant-table-header {
7
+ background-color: darken(@color-assist, 5%);
8
+
9
+ .ant-table-cell-scrollbar {
10
+ box-shadow: none !important;
11
+ }
12
+ }
13
+
14
+ .ant-empty-description {
15
+ color: @color-text;
16
+ }
17
+
18
+ .ant-table-thead {
19
+ .ant-table-cell {
20
+ color: @color-text;
21
+ border-bottom-color: @color-line !important;
22
+ background-color: darken(@color-assist, 1%);
23
+ line-height: 0.1;
24
+
25
+ &-content {
26
+ line-height: 1;
27
+ }
28
+
29
+ &:before {
30
+ background-color: @color-line !important;
31
+ }
32
+ }
33
+ }
34
+
35
+ .ant-table-tbody {
36
+ .ant-table-row,
37
+ .ant-table-placeholder {
38
+ &:hover {
39
+ .ant-table-cell {
40
+ background: darken(@color-assist, 1%) !important;
41
+ }
42
+ }
43
+ }
44
+
45
+ .ant-table-cell {
46
+ color: @color-text;
47
+ border-top-color: @color-line !important;
48
+ border-bottom-color: @color-line !important;
49
+ background-color: @color-assist;
50
+ }
51
+
52
+ .ant-table-cell-row-hover {
53
+ background: darken(@color-assist, 1%) !important;
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,58 @@
1
+ <style lang="less" scoped>
2
+ .fqa-text {
3
+ color: @color-text;
4
+
5
+ &.level-1 {
6
+ color: darken(@color-text, 0%);
7
+ }
8
+ &.level-2 {
9
+ color: darken(@color-text, 12%);
10
+ }
11
+ &.level-3 {
12
+ color: darken(@color-text, 24%);
13
+ }
14
+ &.level-4 {
15
+ color: darken(@color-text, 36%);
16
+ }
17
+ &.level-5 {
18
+ color: darken(@color-text, 48%);
19
+ }
20
+ &.level-6 {
21
+ color: darken(@color-text, 60%);
22
+ }
23
+ }
24
+ </style>
25
+
26
+ <template>
27
+ <span class="fqa-text" :class="{ ...classic }" :style="{ ...css }"><slot /></span>
28
+ </template>
29
+
30
+ <script>
31
+ export default {
32
+ props: {
33
+ size: {
34
+ type: [String, Number],
35
+ default: 14,
36
+ },
37
+
38
+ level: {
39
+ type: [String, Number],
40
+ default: 1,
41
+ },
42
+ },
43
+
44
+ computed: {
45
+ classic() {
46
+ return {
47
+ [`level-${this.level}`]: true,
48
+ };
49
+ },
50
+
51
+ css() {
52
+ return {
53
+ fontSize: `${this.size}px`,
54
+ };
55
+ },
56
+ },
57
+ };
58
+ </script>
@@ -0,0 +1,29 @@
1
+ <style lang="less" scoped>
2
+ .fqa-welcome {
3
+ height: 100%;
4
+ text-align: center;
5
+
6
+ h1 {
7
+ line-height: 4rem;
8
+ font-size: 1.68rem;
9
+ font-family: pacifico;
10
+ color: @color-subtext;
11
+ }
12
+ }
13
+ </style>
14
+
15
+ <template>
16
+ <a-flex class="fqa-welcome" justify="center" align="center" vertical>
17
+ <a-space direction="vertical" :size="50">
18
+ <!-- <a-avatar :size="200" :src="$util.uri(`logo.png`)" /> -->
19
+ <fqa-logo :size="18" />
20
+ <h1 v-html="$t('welcome.slogan')"></h1>
21
+ </a-space>
22
+ </a-flex>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ name: 'fqa-welcome',
28
+ };
29
+ </script>
@@ -0,0 +1,107 @@
1
+ <style lang="less" scoped>
2
+ .fqa-worcha {
3
+ & {
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: @atom;
7
+ padding-left: @gap;
8
+ }
9
+
10
+ &-title {
11
+ display: flex;
12
+ justify-content: space-between;
13
+ flex: 10;
14
+ }
15
+
16
+ &-container {
17
+ display: flex;
18
+ }
19
+
20
+ &-context {
21
+ flex: 10;
22
+ text-align: justify;
23
+ }
24
+
25
+ &-duration {
26
+ flex: 2;
27
+ text-align: right;
28
+ }
29
+ }
30
+
31
+ .fqa-worcha-error {
32
+ padding-inline: @gap;
33
+ }
34
+ </style>
35
+
36
+ <template>
37
+ <div class="fqa-worcha-error" v-if="compliance === false">服务器繁忙,请稍后重试 ~</div>
38
+
39
+ <div class="fqa-worcha" v-else>
40
+ <div class="fqa-worcha-title" v-if="source.stage === 'process_start'">
41
+ <template v-if="!source.finish && sseengine.produce">
42
+ <span>{{ source.is_rag ? '检索中' : '思考中' }} ...</span>
43
+ <!-- <span>{{ $util.time.Duration(source.total * 1000) }}</span> -->
44
+ <fqa-icon icon="LoadingOutlined" />
45
+ </template>
46
+ </div>
47
+ <div class="fqa-worcha-container" :size="16" v-else>
48
+ <div class="fqa-worcha-context">
49
+ <span v-if="source.name">【{{ source.name }}】</span>
50
+ <span>{{ source.content }}</span>
51
+ </div>
52
+ <div class="fqa-worcha-duration">
53
+ <fqa-icon v-if="source.duration === undefined && sseengine.produce" icon="LoadingOutlined" :size="18" />
54
+ <template v-else>{{ $util.time.Duration(source.duration * 1000) }}</template>
55
+ </div>
56
+ </div>
57
+
58
+ <template v-if="source.children">
59
+ <template v-for="item in source.children">
60
+ <fqa-worcha :source="item" />
61
+ </template>
62
+ </template>
63
+ </div>
64
+ </template>
65
+
66
+ <script>
67
+ export default {
68
+ props: {
69
+ source: {
70
+ type: [Object],
71
+ default: {},
72
+ },
73
+
74
+ compliance: {
75
+ type: [Number],
76
+ default: 0,
77
+ },
78
+
79
+ up: {
80
+ type: [String],
81
+ default: '',
82
+ },
83
+
84
+ rag: {
85
+ type: [Number],
86
+ default: 0,
87
+ },
88
+ },
89
+
90
+ watch: {
91
+ source: {
92
+ async handler({ finish, compliance }) {
93
+ if (finish) {
94
+ this.$emit('finish', finish);
95
+ }
96
+
97
+ if (compliance === false && this.compliance === 0) {
98
+ await this.$store.dispatch('sseengine/COMPLIANCE', this.up);
99
+ }
100
+ },
101
+
102
+ deep: true,
103
+ immediate: true,
104
+ },
105
+ },
106
+ };
107
+ </script>