helpers.ts

Declarations
#

8 declarations

view source

create_client_id
#

helpers.ts view source

(): string

Creates an id suitable for insecure use on a single client, like for element ids.

returns

string

defined
#

DURATION_LG
#

DURATION_SM
#

estimate_token_count
#

helpers.ts view source

(text: string): number

Quick and dirty token count estimate using ESTIMATED_CHARS_PER_TOKEN. Real tokenizers are heavy and little benefit for our cases right now, especially because each LLM may tokenize differently!

text

type string

returns

number

ESTIMATED_CHARS_PER_TOKEN
#

get_unique_name
#

helpers.ts view source

(name: string, existing_names: { has: (name: string) => boolean; } | { includes: (name: string) => boolean; }): string

name

type string

existing_names

type { has: (name: string) => boolean; } | { includes: (name: string) => boolean; }

returns

string

to_preview
#

helpers.ts view source

(content: string | null | undefined, max_length?: number): string

content

type string | null | undefined

max_length

type number
default CONTENT_PREVIEW_LENGTH

returns

string

Depends on
#

Imported by
#