Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1# eventsource2 3[](https://www.npmjs.com/package/eventsource)[](https://bundlephobia.com/result?p=eventsource)[](https://www.npmjs.com/package/eventsource)4 5WhatWG/W3C-compatible [server-sent events/eventsource](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) client. The module attempts to implement an absolute minimal amount of features/changes beyond the specification.6 7If you're looking for a modern alternative with a less constrained API, check out the [`eventsource-client` package](https://www.npmjs.com/package/eventsource-client).8 9## Installation10 11```bash12npm install --save eventsource13```14 15## Supported engines16 17- Node.js >= 1818- Chrome >= 6319- Safari >= 11.320- Firefox >= 6521- Edge >= 7922- Deno >= 1.3023- Bun >= 1.1.2324 25Basically, any environment that supports:26 27- [fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch)28- [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)29- [TextDecoderStream](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream)30- [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL)31- [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event), [MessageEvent](https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent), [EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget)32 33If you need to support older runtimes, try the `2.x` branch/version range (note: 2.x branch is primarily targetted at Node.js, not browsers).34 35## Usage36 37```ts38import {EventSource} from 'eventsource'39 40const es = new EventSource('https://my-server.com/sse')41 42/*43 * This will listen for events with the field `event: notice`.44 */45es.addEventListener('notice', (event) => {46 console.log(event.data)47})48 49/*50 * This will listen for events with the field `event: update`.51 */52es.addEventListener('update', (event) => {53 console.log(event.data)54})55 56/*57 * The event "message" is a special case, as it will capture events _without_ an58 * event field, as well as events that have the specific type `event: message`.59 * It will not trigger on any other event type.60 */61es.addEventListener('message', (event) => {62 console.log(event.data)63})64 65/**66 * To explicitly close the connection, call the `close` method.67 * This will prevent any reconnection from happening.68 */69setTimeout(() => {70 es.close()71}, 10_000)72```73 74### TypeScript75 76Make sure you have configured your TSConfig so it matches the environment you are targetting. If you are targetting browsers, this would be `dom`:77 78```jsonc79{80 "compilerOptions": {81 "lib": ["dom"],82 },83}84```85 86If you're using Node.js, ensure you have `@types/node` installed (and it is version 18 or higher). Cloudflare workers have `@cloudflare/workers-types` etc.87 88The following errors are caused by targetting an environment that does not have the necessary types available:89 90```91error TS2304: Cannot find name 'Event'.92error TS2304: Cannot find name 'EventTarget'.93error TS2304: Cannot find name 'MessageEvent'.94```95 96## Migrating from v1 / v297 98See [MIGRATION.md](MIGRATION.md#v2-to-v3) for a detailed migration guide.99 100## Extensions to the WhatWG/W3C API101 102### Message and code properties on errors103 104The `error` event has a `message` and `code` property that can be used to get more information about the error. In the specification, the Event105 106```ts107es.addEventListener('error', (err) => {108 if (err.code === 401 || err.code === 403) {109 console.log('not authorized')110 }111})112```113 114### Specify `fetch` implementation115 116The `EventSource` constructor accepts an optional `fetch` property in the second argument that can be used to specify the `fetch` implementation to use.117 118This can be useful in environments where the global `fetch` function is not available - but it can also be used to alter the request/response behaviour.119 120#### Setting HTTP request headers121 122```ts123const es = new EventSource('https://my-server.com/sse', {124 fetch: (input, init) =>125 fetch(input, {126 ...init,127 headers: {128 ...init.headers,129 Authorization: 'Bearer myToken',130 },131 }),132})133```134 135#### HTTP/HTTPS proxy136 137Use a package like [`node-fetch-native`](https://github.com/unjs/node-fetch-native) to add proxy support, either through environment variables or explicit configuration.138 139```ts140// npm install node-fetch-native --save141import {fetch} from 'node-fetch-native/proxy'142 143const es = new EventSource('https://my-server.com/sse', {144 fetch: (input, init) => fetch(input, init),145})146```147 148#### Allow unauthorized HTTPS requests149 150Use a package like [`undici`](https://github.com/nodejs/undici) for more control of fetch options through the use of an [`Agent`](https://undici.nodejs.org/#/docs/api/Agent.md).151 152```ts153// npm install undici --save154import {fetch, Agent} from 'undici'155 156await fetch('https://my-server.com/sse', {157 dispatcher: new Agent({158 connect: {159 rejectUnauthorized: false,160 },161 }),162})163```164 165## License166 167MIT-licensed. See [LICENSE](LICENSE).168 