mirror of
https://github.com/LingChair/LingChair-V0.git
synced 2025-12-07 17:45:49 +08:00
chore: init
This commit is contained in:
39
.github/一些思想/聊天数据储存.md
vendored
Normal file
39
.github/一些思想/聊天数据储存.md
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
### 关于聊天记录储存的方案概述
|
||||
|
||||
自 3月10日 开始,这个项目遇到了一些瓶颈,停止开发
|
||||
|
||||
我在这段时间的精力也被耗尽
|
||||
|
||||
故此,在今天(3月26日)重新思考,理清思路
|
||||
|
||||
预计3月28日左右实现此功能
|
||||
|
||||
#### 基本想法
|
||||
|
||||
##### 写入
|
||||
|
||||
对于储存来说,从 0 开始计次,一条消息对应一个 ID
|
||||
|
||||
第一条消息的 ID 为 1, 计次文件储存为 1
|
||||
|
||||
为了性能,每个消息使用一个 JSON 文件储存
|
||||
|
||||
##### 读取
|
||||
|
||||
当读取时,从计次文件获取计次数,并从此数字递减,以此读取
|
||||
|
||||
然后储存到数组并直接返回给用户
|
||||
|
||||
客户端消息的 ID 必须要同步,这是为了范围读取以前的消息
|
||||
|
||||
#### 和以前的区别
|
||||
|
||||
在我的聊天软件第一版、第二版中,均由 PHP 作为后端
|
||||
|
||||
写入则直接追加,读取整个返回
|
||||
|
||||
这种做法的最大缺陷是浪费性能
|
||||
|
||||
我曾想过使用 SQL,不过潜在的风险以及我的技术都能符合我的要求
|
||||
|
||||
故此,便有了这个方法
|
||||
42
.github/测试样例/test.html
vendored
Normal file
42
.github/测试样例/test.html
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-cmn-Hans">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no"/>
|
||||
<meta name="renderer" content="webkit"/>
|
||||
<meta name="force-rendering" content="webkit"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
|
||||
<!-- MDUI CSS -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/mdui@1.0.2/dist/css/mdui.min.css"/>
|
||||
<title>铃之椅 API测试</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<button id="s" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent">send</button>
|
||||
|
||||
<div class="mdui-textfield">
|
||||
<input id="i" class="mdui-textfield-input" type="text" placeholder="API Name"/>
|
||||
</div>
|
||||
|
||||
<div class="mdui-textfield">
|
||||
<textarea id="sz" class="mdui-textfield-input" placeholder="Args"></textarea>
|
||||
</div>
|
||||
|
||||
<!-- MDUI JavaScript -->
|
||||
<script src="https://unpkg.com/mdui@1.0.2/dist/js/mdui.min.js"></script>
|
||||
<!-- Socket.IO -->
|
||||
<script src="https://unpkg.com/socket.io-client@4.7.4/dist/socket.io.min.js"></script>
|
||||
<script>
|
||||
const c = io("ws://localhost:3601")
|
||||
let i = document.getElementById("i")
|
||||
let sz = document.getElementById("sz")
|
||||
document.getElementById("s").onclick = () => {
|
||||
c.emit(i.value,JSON.parse(sz.value), (repo) => {
|
||||
alert(JSON.stringify(repo))
|
||||
})
|
||||
}
|
||||
// c.onAny((name,...args) => {alert(name + " -> called with -> " + JSON.stringify(args))})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
68
.github/测试样例/聊天气泡实验.html
vendored
Normal file
68
.github/测试样例/聊天气泡实验.html
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-cmn-Hans">
|
||||
<!--
|
||||
* 铃之椅 - 把选择权还给用户, 让聊天权掌握在用户手中
|
||||
* Copyright 2024 满月叶
|
||||
* GitHub: https://github.com/MoonLeeeaf/LingChair-Web-Client
|
||||
* 本项目使用 Apache 2.0 协议开源
|
||||
*
|
||||
* Copyright 2024 MoonLeeeaf
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no" />
|
||||
<meta name="renderer" content="webkit" />
|
||||
<meta name="force-rendering" content="webkit" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
|
||||
<!-- MDUI CSS -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/mdui@1.0.2/dist/css/mdui.min.css" />
|
||||
<link rel="stylesheet" href="chat-message.css" />
|
||||
<script src="https://unpkg.com/jquery@3.7.1/dist/jquery.min.js"></script>
|
||||
<link rel="icon" href="icon.ico" />
|
||||
<title>聊天气泡测试</title>
|
||||
</head>
|
||||
|
||||
<body class="mdui-theme-teal mdui-theme-layout-auto mdui-theme-accent-teal">
|
||||
|
||||
<!-- 右侧样式 -->
|
||||
<div class="chat-message">
|
||||
<div class="message-content-with-nickname-right">
|
||||
<span class="nickname">小沫</span>
|
||||
<div class="message-content mdui-card">
|
||||
<span>你好!这是一条较长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长的消息内容,测试消息长度自动填充效果。</span>
|
||||
</div>
|
||||
</div>
|
||||
<img class="avatar" src="icon.ico" alt="Avatar">
|
||||
</div>
|
||||
|
||||
<!-- 左侧样式 -->
|
||||
<div class="chat-message">
|
||||
<img class="avatar" src="icon.ico" alt="Avatar">
|
||||
<div class="message-content-with-nickname-left">
|
||||
<span class="nickname">小沫</span>
|
||||
<div class="message-content mdui-card">
|
||||
<span>你好!这是一条较长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长的消息内容,测试消息长度自动填充效果。</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MDUI JavaScript -->
|
||||
<script src="https://unpkg.com/mdui@1.0.2/dist/js/mdui.min.js"></script>
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
2
.github/项目创建时间.txt
vendored
Normal file
2
.github/项目创建时间.txt
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
Web客户端: 2024年1月23日,13:15:09
|
||||
Node.js服务端: 2024年1月24日,14:10:47
|
||||
Reference in New Issue
Block a user