@matechat/core 1.0.0 → 1.1.0-alpha.1
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/Bubble/index.css +1 -0
- package/Bubble/index.js +166 -0
- package/Header/index.css +1 -0
- package/Header/index.js +65 -0
- package/Input/index.css +1 -0
- package/Input/index.js +220 -0
- package/Introduction/index.css +1 -0
- package/Introduction/index.js +97 -0
- package/Layout/index.css +1 -0
- package/Layout/index.js +48 -0
- package/List/index.css +1 -0
- package/List/index.js +143 -0
- package/MarkdownCard/index.css +1 -0
- package/MarkdownCard/index.js +309 -0
- package/Mention/index.css +1 -0
- package/Mention/index.js +172 -0
- package/PopperTrigger/index.js +48 -0
- package/Prompt/index.css +1 -0
- package/Prompt/index.js +110 -0
- package/README.md +14 -11
- package/index.d.ts +0 -1
- package/mate-chat.js +40 -866
- package/package.json +7 -5
- package/mate-chat.css +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Comment as s, Text as a, Fragment as m, h as g, defineComponent as h, ref as v, withDirectives as C, cloneVNode as y } from "vue";
|
|
2
|
+
import { isObject as x } from "@vue/shared";
|
|
3
|
+
function p(e) {
|
|
4
|
+
return g("span", {}, e);
|
|
5
|
+
}
|
|
6
|
+
function c(e) {
|
|
7
|
+
for (const t of e) {
|
|
8
|
+
if (x(t)) {
|
|
9
|
+
if (t.type === s)
|
|
10
|
+
continue;
|
|
11
|
+
return t.type === "svg" || t.type === a ? p(t) : t.type === m ? c(t.children) : t;
|
|
12
|
+
}
|
|
13
|
+
return p(t);
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const F = /* @__PURE__ */ h({
|
|
18
|
+
setup(e, t) {
|
|
19
|
+
const {
|
|
20
|
+
slots: r,
|
|
21
|
+
attrs: i,
|
|
22
|
+
expose: d
|
|
23
|
+
} = t, n = v();
|
|
24
|
+
return d({
|
|
25
|
+
triggerEl: n
|
|
26
|
+
}), () => {
|
|
27
|
+
var f;
|
|
28
|
+
const o = (f = r.default) == null ? void 0 : f.call(r, i);
|
|
29
|
+
if (!o)
|
|
30
|
+
return null;
|
|
31
|
+
const l = c(o);
|
|
32
|
+
return l ? C(y(l, i), [[{
|
|
33
|
+
mounted(u) {
|
|
34
|
+
n.value = u;
|
|
35
|
+
},
|
|
36
|
+
updated(u) {
|
|
37
|
+
n.value = u;
|
|
38
|
+
},
|
|
39
|
+
unmounted() {
|
|
40
|
+
n.value = null;
|
|
41
|
+
}
|
|
42
|
+
}]]) : null;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export {
|
|
47
|
+
F as PopperTrigger
|
|
48
|
+
};
|
package/Prompt/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.mc-prompt-item[data-v-5f016595]{display:flex;gap:8px}.mc-prompt-item .mc-prompt-item-icon.no-description[data-v-5f016595]{display:flex;align-items:center}.mc-prompt-item .mc-prompt-item-content[data-v-5f016595]{display:flex;flex-direction:column;gap:4px}.mc-prompt-item .mc-prompt-item-content .mc-prompt-item-label[data-v-5f016595]{font-weight:700}.mc-prompt-item .mc-prompt-item-content .mc-prompt-item-description[data-v-5f016595]{color:var(--devui-aide-text, #71757f)}
|
package/Prompt/index.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import { defineComponent as y, openBlock as r, createElementBlock as s, createElementVNode as P, normalizeClass as h, createBlock as g, unref as C, normalizeProps as b, mergeProps as I, createCommentVNode as c, toDisplayString as v, createVNode as u, withCtx as V } from "vue";
|
|
3
|
+
import { ListDirection as B, ListVariant as L, McList as M } from "@matechat/core/List";
|
|
4
|
+
import { Icon as N } from "vue-devui/icon";
|
|
5
|
+
import "vue-devui/icon/style.css";
|
|
6
|
+
const S = {
|
|
7
|
+
direction: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: B.Vertical
|
|
10
|
+
},
|
|
11
|
+
list: {
|
|
12
|
+
type: Array,
|
|
13
|
+
default: () => []
|
|
14
|
+
},
|
|
15
|
+
variant: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: L.Filled
|
|
18
|
+
}
|
|
19
|
+
}, $ = {
|
|
20
|
+
prompt: {
|
|
21
|
+
type: Object
|
|
22
|
+
}
|
|
23
|
+
}, z = { class: "mc-prompt-item" }, D = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "mc-prompt-item-content"
|
|
26
|
+
}, E = {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "mc-prompt-item-label"
|
|
29
|
+
}, O = {
|
|
30
|
+
key: 1,
|
|
31
|
+
class: "mc-prompt-item-description"
|
|
32
|
+
}, j = /* @__PURE__ */ y({
|
|
33
|
+
__name: "PromptItem",
|
|
34
|
+
props: $,
|
|
35
|
+
setup(o) {
|
|
36
|
+
return (t, p) => {
|
|
37
|
+
var e, i, m, n, a, l, d, _, f;
|
|
38
|
+
return r(), s("div", z, [
|
|
39
|
+
P(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
class: h(["mc-prompt-item-icon", { "no-description": !((e = t.prompt) != null && e.desc) }])
|
|
43
|
+
},
|
|
44
|
+
[
|
|
45
|
+
(i = t.prompt) != null && i.iconConfig ? (r(), g(
|
|
46
|
+
C(N),
|
|
47
|
+
b(I({ key: 0 }, (m = t.prompt) == null ? void 0 : m.iconConfig)),
|
|
48
|
+
null,
|
|
49
|
+
16
|
|
50
|
+
/* FULL_PROPS */
|
|
51
|
+
)) : c("v-if", !0)
|
|
52
|
+
],
|
|
53
|
+
2
|
|
54
|
+
/* CLASS */
|
|
55
|
+
),
|
|
56
|
+
(n = t.prompt) != null && n.label || (a = t.prompt) != null && a.desc ? (r(), s("div", D, [
|
|
57
|
+
(l = t.prompt) != null && l.label ? (r(), s(
|
|
58
|
+
"div",
|
|
59
|
+
E,
|
|
60
|
+
v((d = t.prompt) == null ? void 0 : d.label),
|
|
61
|
+
1
|
|
62
|
+
/* TEXT */
|
|
63
|
+
)) : c("v-if", !0),
|
|
64
|
+
(_ = t.prompt) != null && _.desc ? (r(), s(
|
|
65
|
+
"div",
|
|
66
|
+
O,
|
|
67
|
+
v((f = t.prompt) == null ? void 0 : f.desc),
|
|
68
|
+
1
|
|
69
|
+
/* TEXT */
|
|
70
|
+
)) : c("v-if", !0)
|
|
71
|
+
])) : c("v-if", !0)
|
|
72
|
+
]);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}), w = (o, t) => {
|
|
76
|
+
const p = o.__vccOpts || o;
|
|
77
|
+
for (const [e, i] of t)
|
|
78
|
+
p[e] = i;
|
|
79
|
+
return p;
|
|
80
|
+
}, A = /* @__PURE__ */ w(j, [["__scopeId", "data-v-5f016595"]]), F = { class: "mc-prompt" }, k = /* @__PURE__ */ y({
|
|
81
|
+
__name: "Prompt",
|
|
82
|
+
props: S,
|
|
83
|
+
emits: ["itemClick"],
|
|
84
|
+
setup(o, { emit: t }) {
|
|
85
|
+
const p = t, e = o;
|
|
86
|
+
return (i, m) => (r(), s("div", F, [
|
|
87
|
+
u(C(M), {
|
|
88
|
+
data: e.list,
|
|
89
|
+
direction: e.direction,
|
|
90
|
+
variant: e.variant,
|
|
91
|
+
selectable: !1
|
|
92
|
+
}, {
|
|
93
|
+
item: V(({ item: n }) => [
|
|
94
|
+
u(A, {
|
|
95
|
+
prompt: n,
|
|
96
|
+
onClick: (a) => p("itemClick", n)
|
|
97
|
+
}, null, 8, ["prompt", "onClick"])
|
|
98
|
+
]),
|
|
99
|
+
_: 1
|
|
100
|
+
/* STABLE */
|
|
101
|
+
}, 8, ["data", "direction", "variant"])
|
|
102
|
+
]));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
k.install = (o) => {
|
|
106
|
+
o.component("McPrompt", k);
|
|
107
|
+
};
|
|
108
|
+
export {
|
|
109
|
+
k as McPrompt
|
|
110
|
+
};
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
<h1 align="center">MateChat</h1>
|
|
7
|
-
<p align="center">前端智能化场景解决方案UI库,轻松构建你的AI
|
|
7
|
+
<p align="center">前端智能化场景解决方案UI库,轻松构建你的AI应用。已服务于华为内部多个应用智能化改造,并助力CodeArts、InsCode AI IDE等智能化助手搭建。</p>
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
@@ -34,20 +34,17 @@ $ npm i vue-devui @matechat/core @devui-design/icons
|
|
|
34
34
|
|
|
35
35
|
### 2. 引入
|
|
36
36
|
|
|
37
|
-
在`main.ts`文件中引入`matechat`,
|
|
37
|
+
在`main.ts`文件中引入`matechat`, `图标库` 样式文件
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
40
|
import { createApp } from 'vue';
|
|
41
41
|
import App from './App.vue';
|
|
42
42
|
|
|
43
|
-
// matechat基于vue-devui组件
|
|
44
|
-
import DevUI from 'vue-devui';
|
|
45
43
|
import MateChat from '@matechat/core';
|
|
46
44
|
|
|
47
|
-
import 'vue-devui/style.css';
|
|
48
45
|
import '@devui-design/icons/icomoon/devui-icon.css';
|
|
49
46
|
|
|
50
|
-
createApp(App).use(
|
|
47
|
+
createApp(App).use(MateChat).mount('#app');
|
|
51
48
|
```
|
|
52
49
|
|
|
53
50
|
### 3. 使用
|
|
@@ -56,7 +53,7 @@ createApp(App).use(DevUI).use(MateChat).mount('#app');
|
|
|
56
53
|
|
|
57
54
|
```html
|
|
58
55
|
<template>
|
|
59
|
-
<McBubble :
|
|
56
|
+
<McBubble :content="'Hello, MateChat'" :avatarConfig="{ name: 'matechat' }"></McBubble>
|
|
60
57
|
</template>
|
|
61
58
|
```
|
|
62
59
|
|
|
@@ -109,7 +106,7 @@ createApp(App).use(DevUI).use(MateChat).mount('#app');
|
|
|
109
106
|
style="flex: 1"
|
|
110
107
|
@itemClick="onSubmit($event.label)"
|
|
111
108
|
></McPrompt>
|
|
112
|
-
<
|
|
109
|
+
<Button
|
|
113
110
|
style="margin-left: auto"
|
|
114
111
|
icon="add"
|
|
115
112
|
shape="circle"
|
|
@@ -131,7 +128,7 @@ createApp(App).use(DevUI).use(MateChat).mount('#app');
|
|
|
131
128
|
<span class="input-foot-maxlength">{{ inputValue.length }}/2000</span>
|
|
132
129
|
</div>
|
|
133
130
|
<div class="input-foot-right">
|
|
134
|
-
<
|
|
131
|
+
<Button icon="op-clearup" shape="round" :disabled="!inputValue" @click="inputValue = ''">清空输入</Button>
|
|
135
132
|
</div>
|
|
136
133
|
</div>
|
|
137
134
|
</template>
|
|
@@ -142,6 +139,8 @@ createApp(App).use(DevUI).use(MateChat).mount('#app');
|
|
|
142
139
|
|
|
143
140
|
<script setup lang="ts">
|
|
144
141
|
import { ref } from 'vue';
|
|
142
|
+
import { Button } from 'vue-devui/button';
|
|
143
|
+
import 'vue-devui/button/style.css';
|
|
145
144
|
|
|
146
145
|
const description = [
|
|
147
146
|
'MateChat 可以辅助研发人员编码、查询知识和相关作业信息、编写文档等。',
|
|
@@ -228,11 +227,13 @@ const onSubmit = (evt) => {
|
|
|
228
227
|
<style>
|
|
229
228
|
.container {
|
|
230
229
|
width: 1000px;
|
|
231
|
-
margin:
|
|
232
|
-
height: 100vh;
|
|
230
|
+
margin: 20px auto;
|
|
231
|
+
height: calc(100vh - 40px);
|
|
233
232
|
padding: 20px;
|
|
234
233
|
gap: 8px;
|
|
235
234
|
background: #fff;
|
|
235
|
+
border: 1px solid #ddd;
|
|
236
|
+
border-radius: 16px;
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
.content-container {
|
|
@@ -422,6 +423,8 @@ MateChat 在不断的演进中,你可在这里了解我们的计划:[MateCha
|
|
|
422
423
|
|
|
423
424
|
## 谁在使用
|
|
424
425
|
|
|
426
|
+
[CodeArts盘古助手](https://www.huaweicloud.com/product/codeartside/snap.html)
|
|
427
|
+
|
|
425
428
|
[InsCode AI IDE](https://inscode.csdn.net/)
|
|
426
429
|
|
|
427
430
|
## License
|