mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-02-04 14:00:49 +00:00
nhj
more
This commit is contained in:
21
unified-ai-platform/node_modules/fast-fifo/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/fast-fifo/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 Mathias Buus
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
39
unified-ai-platform/node_modules/fast-fifo/fixed-size.js
generated
vendored
Normal file
39
unified-ai-platform/node_modules/fast-fifo/fixed-size.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
module.exports = class FixedFIFO {
|
||||
constructor (hwm) {
|
||||
if (!(hwm > 0) || ((hwm - 1) & hwm) !== 0) throw new Error('Max size for a FixedFIFO should be a power of two')
|
||||
this.buffer = new Array(hwm)
|
||||
this.mask = hwm - 1
|
||||
this.top = 0
|
||||
this.btm = 0
|
||||
this.next = null
|
||||
}
|
||||
|
||||
clear () {
|
||||
this.top = this.btm = 0
|
||||
this.next = null
|
||||
this.buffer.fill(undefined)
|
||||
}
|
||||
|
||||
push (data) {
|
||||
if (this.buffer[this.top] !== undefined) return false
|
||||
this.buffer[this.top] = data
|
||||
this.top = (this.top + 1) & this.mask
|
||||
return true
|
||||
}
|
||||
|
||||
shift () {
|
||||
const last = this.buffer[this.btm]
|
||||
if (last === undefined) return undefined
|
||||
this.buffer[this.btm] = undefined
|
||||
this.btm = (this.btm + 1) & this.mask
|
||||
return last
|
||||
}
|
||||
|
||||
peek () {
|
||||
return this.buffer[this.btm]
|
||||
}
|
||||
|
||||
isEmpty () {
|
||||
return this.buffer[this.btm] === undefined
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user