koishi-plugin-chat-patch 2.2.0 → 2.3.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.
@@ -1,9 +1,9 @@
1
- <template>
2
- <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
3
- <path d="M8 10.5H16" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
4
- <path d="M8 14H13.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
5
- <path
6
- d="M17 3.33782C15.5291 2.48697 13.8214 2 12 2C6.47715 2 2 6.47715 2 12C2 13.5997 2.37562 15.1116 3.04346 16.4525C3.22094 16.8088 3.28001 17.2161 3.17712 17.6006L2.58151 19.8267C2.32295 20.793 3.20701 21.677 4.17335 21.4185L6.39939 20.8229C6.78393 20.72 7.19121 20.7791 7.54753 20.9565C8.88837 21.6244 10.4003 22 12 22C17.5228 22 22 17.5228 22 12C22 10.1786 21.513 8.47087 20.6622 7"
7
- stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
8
- </svg>
9
- </template>
1
+ <template>
2
+ <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
3
+ <path d="M8 10.5H16" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
4
+ <path d="M8 14H13.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
5
+ <path
6
+ d="M17 3.33782C15.5291 2.48697 13.8214 2 12 2C6.47715 2 2 6.47715 2 12C2 13.5997 2.37562 15.1116 3.04346 16.4525C3.22094 16.8088 3.28001 17.2161 3.17712 17.6006L2.58151 19.8267C2.32295 20.793 3.20701 21.677 4.17335 21.4185L6.39939 20.8229C6.78393 20.72 7.19121 20.7791 7.54753 20.9565C8.88837 21.6244 10.4003 22 12 22C17.5228 22 22 17.5228 22 12C22 10.1786 21.513 8.47087 20.6622 7"
7
+ stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
8
+ </svg>
9
+ </template>
@@ -1,4 +1,4 @@
1
- import { icons } from '@koishijs/client'
2
- import Activity from './activity.vue'
3
-
4
- icons.register('activity:chat', Activity)
1
+ import { icons } from '@koishijs/client'
2
+ import Activity from './activity.vue'
3
+
4
+ icons.register('activity:chat', Activity)
package/client/index.scss CHANGED
@@ -1,90 +1,90 @@
1
- @tailwind components;
2
- @tailwind utilities;
3
-
4
- :root {
5
- --chat-bg: var(--k-page-bg);
6
- --chat-panel-bg: var(--k-card-bg);
7
- --chat-border: var(--k-border-color);
8
- --chat-text: var(--k-text-color);
9
- --chat-text-sub: var(--k-text-color-secondary);
10
- }
11
-
12
- .chat-patch-wrapper {
13
- /* 完全隐藏滚动条 - 增强版 */
14
- .mobile-scrollbar-fix {
15
- /* 隐藏 Element Plus 滚动条组件 */
16
- .el-scrollbar__bar {
17
- display: none !important;
18
- opacity: 0 !important;
19
- width: 0 !important;
20
- height: 0 !important;
21
- }
22
-
23
- .el-scrollbar__thumb {
24
- display: none !important;
25
- }
26
-
27
- .el-scrollbar__wrap {
28
- overflow-x: hidden !important;
29
-
30
- /* 隐藏原生滚动条 - 所有浏览器 */
31
- scrollbar-width: none !important; /* Firefox */
32
- -ms-overflow-style: none !important; /* IE/Edge */
33
-
34
- &::-webkit-scrollbar {
35
- display: none !important; /* Chrome/Safari */
36
- width: 0 !important;
37
- height: 0 !important;
38
- background: transparent !important;
39
- }
40
-
41
- &::-webkit-scrollbar-track {
42
- display: none !important;
43
- }
44
-
45
- &::-webkit-scrollbar-thumb {
46
- display: none !important;
47
- }
48
- }
49
- }
50
-
51
- color: var(--chat-text);
52
- background-color: var(--chat-bg);
53
-
54
- .el-aside, .el-main, .el-header, .el-footer {
55
- background-color: transparent !important;
56
- color: inherit !important;
57
- }
58
-
59
- .el-scrollbar {
60
- background-color: transparent !important;
61
- }
62
-
63
- .el-input__wrapper, .el-textarea__inner {
64
- background-color: var(--k-input-bg) !important;
65
- color: var(--chat-text) !important;
66
- box-shadow: 0 0 0 1px var(--chat-border) inset !important;
67
- }
68
-
69
- .el-empty {
70
- background-color: transparent !important;
71
- }
72
- }
73
-
74
- .layout-iframe {
75
- width: 100%;
76
- height: 100%;
77
- border: none;
78
- }
79
-
80
- .message-highlight {
81
- animation: highlight-fade 1.5s ease-in-out;
82
- border-radius: 8px;
83
- }
84
-
85
- @keyframes highlight-fade {
86
- 0% { background-color: transparent; }
87
- 10% { background-color: rgba(64, 158, 255, 0.4); filter: brightness(1.2); }
88
- 30% { background-color: rgba(64, 158, 255, 0.4); filter: brightness(1.2); }
89
- 100% { background-color: transparent; }
90
- }
1
+ @tailwind components;
2
+ @tailwind utilities;
3
+
4
+ :root {
5
+ --chat-bg: var(--k-page-bg);
6
+ --chat-panel-bg: var(--k-card-bg);
7
+ --chat-border: var(--k-border-color);
8
+ --chat-text: var(--k-text-color);
9
+ --chat-text-sub: var(--k-text-color-secondary);
10
+ }
11
+
12
+ .chat-patch-wrapper {
13
+ /* 完全隐藏滚动条 - 增强版 */
14
+ .mobile-scrollbar-fix {
15
+ /* 隐藏 Element Plus 滚动条组件 */
16
+ .el-scrollbar__bar {
17
+ display: none !important;
18
+ opacity: 0 !important;
19
+ width: 0 !important;
20
+ height: 0 !important;
21
+ }
22
+
23
+ .el-scrollbar__thumb {
24
+ display: none !important;
25
+ }
26
+
27
+ .el-scrollbar__wrap {
28
+ overflow-x: hidden !important;
29
+
30
+ /* 隐藏原生滚动条 - 所有浏览器 */
31
+ scrollbar-width: none !important; /* Firefox */
32
+ -ms-overflow-style: none !important; /* IE/Edge */
33
+
34
+ &::-webkit-scrollbar {
35
+ display: none !important; /* Chrome/Safari */
36
+ width: 0 !important;
37
+ height: 0 !important;
38
+ background: transparent !important;
39
+ }
40
+
41
+ &::-webkit-scrollbar-track {
42
+ display: none !important;
43
+ }
44
+
45
+ &::-webkit-scrollbar-thumb {
46
+ display: none !important;
47
+ }
48
+ }
49
+ }
50
+
51
+ color: var(--chat-text);
52
+ background-color: var(--chat-bg);
53
+
54
+ .el-aside, .el-main, .el-header, .el-footer {
55
+ background-color: transparent !important;
56
+ color: inherit !important;
57
+ }
58
+
59
+ .el-scrollbar {
60
+ background-color: transparent !important;
61
+ }
62
+
63
+ .el-input__wrapper, .el-textarea__inner {
64
+ background-color: var(--k-input-bg) !important;
65
+ color: var(--chat-text) !important;
66
+ box-shadow: 0 0 0 1px var(--chat-border) inset !important;
67
+ }
68
+
69
+ .el-empty {
70
+ background-color: transparent !important;
71
+ }
72
+ }
73
+
74
+ .layout-iframe {
75
+ width: 100%;
76
+ height: 100%;
77
+ border: none;
78
+ }
79
+
80
+ .message-highlight {
81
+ animation: highlight-fade 1.5s ease-in-out;
82
+ border-radius: 8px;
83
+ }
84
+
85
+ @keyframes highlight-fade {
86
+ 0% { background-color: transparent; }
87
+ 10% { background-color: rgba(64, 158, 255, 0.4); filter: brightness(1.2); }
88
+ 30% { background-color: rgba(64, 158, 255, 0.4); filter: brightness(1.2); }
89
+ 100% { background-color: transparent; }
90
+ }
package/client/index.ts CHANGED
@@ -1,25 +1,25 @@
1
-
2
- import { defineComponent, h, resolveComponent } from 'vue'
3
- import { Context } from '@koishijs/client'
4
- import Chat from './vue/index.vue'
5
- // 不导入 Element Plus CSS,Koishi 已经包含了
6
- // import 'element-plus/dist/index.css'
7
- import './index.scss'
8
- import './icons'
9
-
10
- export default (ctx: Context) => {
11
- ctx.page({
12
- name: '聊天室',
13
- path: '/chat-patch',
14
- desc: "",
15
- authority: 4,
16
- icon: 'activity:chat',
17
- component: defineComponent({
18
- setup() {
19
- return () => h(resolveComponent('k-layout'), {}, {
20
- default: () => h(Chat)
21
- })
22
- },
23
- }),
24
- })
25
- }
1
+
2
+ import { defineComponent, h, resolveComponent } from 'vue'
3
+ import { Context } from '@koishijs/client'
4
+ import Chat from './vue/index.vue'
5
+ // 不导入 Element Plus CSS,Koishi 已经包含了
6
+ // import 'element-plus/dist/index.css'
7
+ import './index.scss'
8
+ import './icons'
9
+
10
+ export default (ctx: Context) => {
11
+ ctx.page({
12
+ name: '聊天室',
13
+ path: '/chat-patch',
14
+ desc: "",
15
+ authority: 4,
16
+ icon: 'activity:chat',
17
+ component: defineComponent({
18
+ setup() {
19
+ return () => h(resolveComponent('k-layout'), {}, {
20
+ default: () => h(Chat)
21
+ })
22
+ },
23
+ }),
24
+ })
25
+ }
@@ -58,4 +58,4 @@ export function useChatActions() {
58
58
  togglePinBot,
59
59
  togglePinChannel
60
60
  }
61
- }
61
+ }
@@ -183,4 +183,4 @@ export function useChatData() {
183
183
  addMessage,
184
184
  loadHistory
185
185
  }
186
- }
186
+ }
@@ -137,4 +137,4 @@ export function useImageCache() {
137
137
  cacheImage,
138
138
  clearChannelCache
139
139
  }
140
- }
140
+ }
@@ -70,4 +70,4 @@ export interface PluginConfig {
70
70
  }>
71
71
  chatContainerHeight: number
72
72
  clearIndexedDBOnStart: boolean
73
- }
73
+ }
@@ -0,0 +1,25 @@
1
+ import { ChatData, MessageInfo } from './types';
2
+ import { Context } from 'koishi';
3
+ import { Config } from './config';
4
+ export declare class FileManager {
5
+ private ctx;
6
+ private config;
7
+ private dataFilePath;
8
+ private fileOperationLock;
9
+ private logger;
10
+ private utils;
11
+ private memoryCache;
12
+ private pendingMessages;
13
+ private writeTimer;
14
+ private readonly WRITE_DEBOUNCE_MS;
15
+ constructor(ctx: Context, config: Config);
16
+ private ensureDataDir;
17
+ readChatDataFromFile(): ChatData;
18
+ writeChatDataToFile(data: ChatData): void;
19
+ private scheduleWrite;
20
+ private flushPendingMessages;
21
+ cleanExcessMessages(data: ChatData): ChatData;
22
+ addMessageToFile(messageInfo: MessageInfo): Promise<void>;
23
+ dispose(): void;
24
+ private logInfo;
25
+ }