collabdocchat 2.0.0 → 2.0.2
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/package.json +1 -1
- package/scripts/generate-docs.js +448 -0
- package/server/websocket/index.js +4 -0
- package/src/components/knowledge-modal.js +485 -485
- package/src/pages/optimized-knowledge-view.js +803 -803
- package/src/pages/user-dashboard.js +17 -17
- package/src/services/api.js +1 -1
- package/src/services/websocket.js +6 -2
- package/src/utils/ai-assistant.js +4 -4
- package/src/utils/collaboration-enhancer.js +7 -7
|
@@ -399,34 +399,34 @@ export function renderUserDashboard(user, wsService) {
|
|
|
399
399
|
|
|
400
400
|
${!hasVoted ? `
|
|
401
401
|
<div class="poll-form-simple">
|
|
402
|
-
|
|
402
|
+
<div class="poll-question">
|
|
403
403
|
<strong>请选择您的投票选项:</strong>
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
</div>
|
|
405
|
+
${pollData.options.map((option, index) => {
|
|
406
|
+
return `
|
|
407
407
|
<div class="poll-option-simple">
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
408
|
+
<label>
|
|
409
|
+
<input type="${pollData.allowMultiple ? 'checkbox' : 'radio'}"
|
|
410
|
+
name="poll_${task._id}"
|
|
411
411
|
value="${index}">
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
412
|
+
<span class="option-text">${option.text}</span>
|
|
413
|
+
</label>
|
|
414
|
+
</div>
|
|
415
|
+
`;
|
|
416
|
+
}).join('')}
|
|
417
417
|
<div class="task-actions" style="margin-top: 16px;">
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
418
|
+
<button class="btn-primary btn-sm" data-id="${task._id}" data-action="vote">
|
|
419
|
+
提交投票
|
|
420
|
+
</button>
|
|
421
421
|
</div>
|
|
422
422
|
</div>
|
|
423
|
-
|
|
423
|
+
` : `
|
|
424
424
|
<div class="voted-message">
|
|
425
425
|
<span class="voted-badge">✓ 您已投票</span>
|
|
426
426
|
<p style="margin-top: 8px; color: var(--text-secondary); font-size: 14px;">
|
|
427
427
|
投票结果仅管理员可见
|
|
428
428
|
</p>
|
|
429
|
-
|
|
429
|
+
</div>
|
|
430
430
|
`}
|
|
431
431
|
`;
|
|
432
432
|
}
|
package/src/services/api.js
CHANGED
|
@@ -21,7 +21,7 @@ export class WebSocketService {
|
|
|
21
21
|
this.isConnecting = true;
|
|
22
22
|
|
|
23
23
|
try {
|
|
24
|
-
this.ws = new WebSocket('ws://localhost:
|
|
24
|
+
this.ws = new WebSocket('ws://localhost:3000');
|
|
25
25
|
|
|
26
26
|
this.ws.onopen = () => {
|
|
27
27
|
console.log('✅ WebSocket 连接成功');
|
|
@@ -60,7 +60,11 @@ export class WebSocketService {
|
|
|
60
60
|
this.isConnecting = false;
|
|
61
61
|
this.isAuthenticated = false;
|
|
62
62
|
this.stopHeartbeat();
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
// 只有在非正常关闭时才重连
|
|
65
|
+
if (event.code !== 1000 && this.reconnectAttempts < this.maxReconnectAttempts) {
|
|
66
|
+
this.handleReconnect();
|
|
67
|
+
}
|
|
64
68
|
};
|
|
65
69
|
} catch (error) {
|
|
66
70
|
console.error('❌ WebSocket 连接失败:', error);
|
|
@@ -600,12 +600,12 @@ export class AIAssistant {
|
|
|
600
600
|
`<div class="result-section">
|
|
601
601
|
<h5 class="result-title">⚠️ 发现的问题</h5>
|
|
602
602
|
<div class="issues-list">
|
|
603
|
-
|
|
603
|
+
${result.issues.map(issue => `
|
|
604
604
|
<div class="issue-item">
|
|
605
605
|
<span class="issue-type-badge">${issue.type}</span>
|
|
606
606
|
<span class="issue-message">${issue.message}</span>
|
|
607
|
-
|
|
608
|
-
|
|
607
|
+
</div>
|
|
608
|
+
`).join('')}
|
|
609
609
|
</div>
|
|
610
610
|
</div>`
|
|
611
611
|
}
|
|
@@ -650,7 +650,7 @@ export class AIAssistant {
|
|
|
650
650
|
<div class="sentiment-badge-large" style="background: ${sentimentColor[result.sentiment]};">
|
|
651
651
|
<span class="sentiment-emoji">${sentimentEmoji[result.sentiment]}</span>
|
|
652
652
|
<span class="sentiment-text">${sentimentText[result.sentiment]}</span>
|
|
653
|
-
|
|
653
|
+
</div>
|
|
654
654
|
</div>
|
|
655
655
|
</div>
|
|
656
656
|
<div class="result-section">
|
|
@@ -743,7 +743,7 @@ export class CollaborationEnhancer {
|
|
|
743
743
|
nodes.set(nodeId, { element: node, parent: parentId, children: [] });
|
|
744
744
|
nodes.get(parentId).children.push(nodeId);
|
|
745
745
|
connections.set(nodeId, parentId);
|
|
746
|
-
|
|
746
|
+
|
|
747
747
|
// 使节点可拖动
|
|
748
748
|
this.makeDraggable(node, () => this.updateLines(container, connections, showLines));
|
|
749
749
|
|
|
@@ -825,10 +825,10 @@ export class CollaborationEnhancer {
|
|
|
825
825
|
content: info.element.querySelector('.node-content').textContent,
|
|
826
826
|
level: info.element.dataset.level,
|
|
827
827
|
parent: info.parent,
|
|
828
|
-
|
|
828
|
+
position: {
|
|
829
829
|
left: info.element.style.left,
|
|
830
830
|
top: info.element.style.top
|
|
831
|
-
|
|
831
|
+
}
|
|
832
832
|
})),
|
|
833
833
|
connections: Array.from(connections.entries())
|
|
834
834
|
};
|
|
@@ -1108,10 +1108,10 @@ export class CollaborationEnhancer {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
|
|
1110
1110
|
animationFrameId = requestAnimationFrame(() => {
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1111
|
+
pos1 = pos3 - e.clientX;
|
|
1112
|
+
pos2 = pos4 - e.clientY;
|
|
1113
|
+
pos3 = e.clientX;
|
|
1114
|
+
pos4 = e.clientY;
|
|
1115
1115
|
|
|
1116
1116
|
// 直接使用 transform 而不是 top/left,性能更好
|
|
1117
1117
|
const newTop = element.offsetTop - pos2;
|