Upload 2199 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- Sukoon_Github/.gitignore +8 -0
- Sukoon_Github/LICENSE +21 -0
- Sukoon_Github/README.md +71 -0
- Sukoon_Github/autogen/.devcontainer/devcontainer.json +17 -0
- Sukoon_Github/autogen/.gitignore +17 -0
- Sukoon_Github/autogen/Dockerfile +24 -0
- Sukoon_Github/autogen/OAI_CONFIG_LIST.template.json +14 -0
- Sukoon_Github/autogen/data/data.txt +0 -0
- Sukoon_Github/autogen/data/sample_data.txt +88 -0
- Sukoon_Github/autogen/docker-compose.yml +12 -0
- Sukoon_Github/autogen/generate_oai_config.py +24 -0
- Sukoon_Github/autogen/mhfa.py +107 -0
- Sukoon_Github/autogen/mhfa_1.py +117 -0
- Sukoon_Github/autogen/requirements.txt +5 -0
- Sukoon_Github/autogen/sample.py +19 -0
- Sukoon_Github/autogen/tmp/db/chroma.sqlite3 +0 -0
- Sukoon_Github/langgraph/Dockerfile +26 -0
- Sukoon_Github/langgraph/README.txt +16 -0
- Sukoon_Github/langgraph/archive/sample_sukoon_code.ipynb +329 -0
- Sukoon_Github/langgraph/archive/sukoon.py +199 -0
- Sukoon_Github/langgraph/archive/sukoon_api.py +89 -0
- Sukoon_Github/langgraph/prompts/sample_data.txt +88 -0
- Sukoon_Github/langgraph/requirements.txt +9 -0
- Sukoon_Github/langgraph/storage/default__vector_store.json +1 -0
- Sukoon_Github/langgraph/storage/docstore.json +1 -0
- Sukoon_Github/langgraph/storage/graph_store.json +1 -0
- Sukoon_Github/langgraph/storage/image__vector_store.json +1 -0
- Sukoon_Github/langgraph/storage/index_store.json +1 -0
- Sukoon_Github/langgraph/sukoon-frontend/.gitignore +23 -0
- Sukoon_Github/langgraph/sukoon-frontend/README.md +38 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@alloc/quick-lru/index.d.ts +128 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@alloc/quick-lru/index.js +263 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@alloc/quick-lru/license +9 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@alloc/quick-lru/package.json +43 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@alloc/quick-lru/readme.md +139 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/LICENSE +21 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/Readme.md +69 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/index.cjs +250 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/index.mjs +201 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/package.json +48 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/types/index.d.ts +26 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/.editorconfig +14 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/CHANGELOG.md +147 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/LICENSE +201 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/README.md +413 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/examples/is-default-value.js +25 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js +35 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/examples/negate.js +43 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js +31 -0
- Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs +41 -0
Sukoon_Github/.gitignore
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.env
|
| 2 |
+
.DS_Store
|
| 3 |
+
langgraph/__pycache__/sukoon_role.cpython-310.pyc
|
| 4 |
+
langgraph/__pycache__/sukoon_role.cpython-310.pyc
|
| 5 |
+
autogen/OAI_CONFIG_LIST
|
| 6 |
+
autogen/.cache/41/cache.db
|
| 7 |
+
autogen/.cache/41/cache.db
|
| 8 |
+
langgraph/__pycache__/sukoon.cpython-310.pyc
|
Sukoon_Github/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2024 PeoplePlus AI
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
Sukoon_Github/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Project Sukoon: Mental-Health-Support-using-AI
|
| 2 |
+
|
| 3 |
+
# Vision
|
| 4 |
+
We want to build open-source solutions and standards for using AI to solve mental health challenges. The goal is to apply DPI knowledge and practices that can help professionals deeply explore and understand the latest advancements in AI and how they can be applied to use-cases in mental health specific to India.
|
| 5 |
+
|
| 6 |
+
# Steps to run
|
| 7 |
+
```
|
| 8 |
+
- Go to langgraph subfolder ( cd langgraph) from terminal
|
| 9 |
+
- install all dependencies in your environment (pip install -r requirements.txt)
|
| 10 |
+
- run 'python sukoon_api.py'
|
| 11 |
+
- go to sukoon-frontend(cd sukoon-frontend), run 'npm start' to access it in your browser.
|
| 12 |
+
- alternatively use this vercel deployment to access it - https://sukoon-1.vercel.app
|
| 13 |
+
```
|
| 14 |
+
Steps to add environment variables -
|
| 15 |
+
```
|
| 16 |
+
create a .env file and add these values there -
|
| 17 |
+
OPENAI_API_KEY = '<YOUR_OPENAI_API_KEY>'
|
| 18 |
+
LANGCHAIN_API_KEY = '<YOUR_LANGCHAIN_API_KEY>'
|
| 19 |
+
|
| 20 |
+
- Alternatively , try this:
|
| 21 |
+
On Mac/Linux -
|
| 22 |
+
export OPENAI_API_KEY=your_api_key_here
|
| 23 |
+
|
| 24 |
+
On Windows -
|
| 25 |
+
setx OPENAI_API_KEY "your_api_key_here"
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# Current Landscape
|
| 31 |
+
Currently availing mental health has a lot of issues such as:
|
| 32 |
+
Stigma - In India, mental health issues are not considered as healthcare issues. Any person suffering from mental issues is considered weak. Stigma and discrimination often undermine social support structures. Persons suffering from such issues are often tagged as ‘lunatics’ by society. This leads to a vicious cycle of shame, suffering and isolation of the patients.
|
| 33 |
+
Lack of awareness - leading to issues like undetected issues and self diagnosis
|
| 34 |
+
Availability of trained Mental Healthcare Personnel: There is a severe shortage of mental healthcare workforce in India. According to the WHO, in 2011, there were 0.301 psychiatrists and 0.047 psychologists for every 100,000 patients suffering from a mental health disorder in India. In contrast, the ratio in most developed countries is in excess of 10.
|
| 35 |
+
Affordability - Most Mental healthcare sessions are costly as per Indian incomes, hence out of reach of most population(~95%)
|
| 36 |
+
Budgetary Constraints - Low budget Allocation: Developed countries allocate 5-18% of their annual healthcare budget on mental healthcare, while India allocates roughly 0.05% (Organization for Economic Co-operation and Development, 2014) of its healthcare budget. This is the lowest among all G20 countries. Despite a rise in mental illness issues, the Union Ministry of Health allocated less than 1% of its budget to directly deal with psychological illnesses in 2022.
|
| 37 |
+
|
| 38 |
+
# Proposed Solution
|
| 39 |
+
AI Companion
|
| 40 |
+
Solves for personalization, accessibility (available 24/7), affordability
|
| 41 |
+
|
| 42 |
+
# Features:
|
| 43 |
+
Personalized and contextual responses
|
| 44 |
+
Emotional understanding and support
|
| 45 |
+
Privacy-focused, with no central data storage
|
| 46 |
+
Supplemental real healthcare professional support → Escalation features
|
| 47 |
+
Multi-user chat interface capabilities with option to invite partner / parent → Shared wellness journey
|
| 48 |
+
Cultural Sensitivity in Indian context
|
| 49 |
+
|
| 50 |
+
# What could a solution look like? (Tentative features)
|
| 51 |
+
Very personal approach with focus on listening and emphasising
|
| 52 |
+
Available in 22 Indic regional languages, especially on mobile devices
|
| 53 |
+
Stores the user conversation locally, not on cloud -> ensuring complete privacy
|
| 54 |
+
Will provide helpful resources for most common mental health problems. However, it'll not prescribe any medicines
|
| 55 |
+
For training the bot , we can use federated learning
|
| 56 |
+
Will be available as an API, so interested people can try this and build on top of it, based on their use case
|
| 57 |
+
Aim is to get national-level adoption
|
| 58 |
+
If serious, there’ll option to reach out to a psychiatrist or support community groups e.g. peer to peer network
|
| 59 |
+
Have L1/L2/L3 level of support
|
| 60 |
+
|
| 61 |
+
# Some interesting ideas to try:
|
| 62 |
+
Can we gamify the whole conversation? If yes, then how?
|
| 63 |
+
Can we nudge users to adopt healthier behaviour?
|
| 64 |
+
In particular, we can warn users about what not to do - relying on superstitions, isolation, labelling, and other unhelpful tactics
|
| 65 |
+
Give positive self-affirmation, create safety plan, etc
|
| 66 |
+
Can we develop Emotional Intelligence that understands not just emotions, but context behind it
|
| 67 |
+
Can we detect emotional status ike stress level using voice(like hume) and then support him
|
| 68 |
+
Can we create a timeline tracker let’s say six month plan for meditation and track streak
|
| 69 |
+
Can we give them a phone number they can call to? The bot will mainly listen , empathize and offer safe advice
|
| 70 |
+
|
| 71 |
+
Please read the full doc and feel free to add comments here - https://docs.google.com/document/d/1H8-oJmMy0r28kYup9vqt8VGDlY_cCFW_2M07XJxWpFU/edit?usp=sharing
|
Sukoon_Github/autogen/.devcontainer/devcontainer.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "Mental Health Assistant",
|
| 3 |
+
"dockerComposeFile": "../docker-compose.yml",
|
| 4 |
+
"service": "mental-health-assistant",
|
| 5 |
+
"workspaceFolder": "/app",
|
| 6 |
+
"settings": {
|
| 7 |
+
"terminal.integrated.shell.linux": "/bin/bash"
|
| 8 |
+
},
|
| 9 |
+
"extensions": [
|
| 10 |
+
"ms-python.python",
|
| 11 |
+
"ms-azuretools.vscode-docker"
|
| 12 |
+
],
|
| 13 |
+
"forwardPorts": [80],
|
| 14 |
+
"remoteEnv": {
|
| 15 |
+
"OPENAI_API_KEY": "${localEnv:OPENAI_API_KEY}"
|
| 16 |
+
}
|
| 17 |
+
}
|
Sukoon_Github/autogen/.gitignore
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ignore environment files
|
| 2 |
+
.env
|
| 3 |
+
|
| 4 |
+
# Ignore generated OAI_CONFIG_LIST file
|
| 5 |
+
OAI_CONFIG_LIST
|
| 6 |
+
|
| 7 |
+
# Python artifacts
|
| 8 |
+
__pycache__/
|
| 9 |
+
*.py[cod]
|
| 10 |
+
*$py.class
|
| 11 |
+
.DS_Store
|
| 12 |
+
autogen/.cache
|
| 13 |
+
|
| 14 |
+
# Virtual environment
|
| 15 |
+
venv/
|
| 16 |
+
.venv/
|
| 17 |
+
env/
|
Sukoon_Github/autogen/Dockerfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy the current directory contents into the container at /app
|
| 8 |
+
COPY requirements.txt /app/
|
| 9 |
+
|
| 10 |
+
# Install any needed packages specified in requirements.txt
|
| 11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
+
|
| 13 |
+
# Copy the rest of the application
|
| 14 |
+
COPY . /app/
|
| 15 |
+
|
| 16 |
+
# Make port 80 available to the world outside this container
|
| 17 |
+
EXPOSE 80
|
| 18 |
+
|
| 19 |
+
# Create a non-root user and switch to it
|
| 20 |
+
RUN adduser --disabled-password --gecos '' appuser
|
| 21 |
+
USER appuser
|
| 22 |
+
|
| 23 |
+
# Run app.py when the container launches
|
| 24 |
+
CMD ["python", "generate_oai_config.py", "&&", "python", "mhfa_1.py"]
|
Sukoon_Github/autogen/OAI_CONFIG_LIST.template.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"model": "gpt-4",
|
| 4 |
+
"api_key": "${OPENAI_API_KEY}"
|
| 5 |
+
},
|
| 6 |
+
{
|
| 7 |
+
"model": "gpt-4-32k",
|
| 8 |
+
"api_key": "${OPENAI_API_KEY}"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"model": "gpt-3.5-turbo",
|
| 12 |
+
"api_key": "${OPENAI_API_KEY}"
|
| 13 |
+
}
|
| 14 |
+
]
|
Sukoon_Github/autogen/data/data.txt
ADDED
|
File without changes
|
Sukoon_Github/autogen/data/sample_data.txt
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Immediate Care for Handling Mental Health Crisis
|
| 2 |
+
|
| 3 |
+
What is Immediate Care?
|
| 4 |
+
1. Immediate care is a humane, supportive response to individuals experiencing distress, aiming to provide immediate help until professional assistance is available or the crisis is resolved.
|
| 5 |
+
2. It is accessible to all, not limited to mental health professionals.
|
| 6 |
+
3. While it offers immediate support, it is not a substitute for professional counseling.
|
| 7 |
+
|
| 8 |
+
Importance of Immediate Care
|
| 9 |
+
1. Mental health disorders can affect anyone, regardless of age, gender, race, or socioeconomic status.
|
| 10 |
+
2. Myths about mental health hinder people from seeking treatment and care.
|
| 11 |
+
3. Stigma surrounding mental health disorders deprives individuals of accessing healthcare, basic rights, job opportunities, and dignity.
|
| 12 |
+
4. Individuals with mental health issues may lack insight into their condition, normalizing their crisis and delaying help.
|
| 13 |
+
5. Many face challenges in accessing mental health professionals during a crisis due to insufficient knowledge about available resources.
|
| 14 |
+
6. Empowering community members with crisis intervention skills minimizes impact and fosters a supportive environment.
|
| 15 |
+
|
| 16 |
+
Difference between Immediate Care and Psychological First Aid (PFA)
|
| 17 |
+
- Immediate Care:
|
| 18 |
+
1. Addresses short-term crises and everyday stressors.
|
| 19 |
+
2. Community-based and easily accessible.
|
| 20 |
+
- Psychological First Aid (PFA):
|
| 21 |
+
1. Targets severe, long-lasting problems.
|
| 22 |
+
2. Requires trained professionals and controlled environments.
|
| 23 |
+
|
| 24 |
+
Who Can Provide Immediate Care?
|
| 25 |
+
- Community members
|
| 26 |
+
- Mental health professionals
|
| 27 |
+
- Police
|
| 28 |
+
- Emergency medical teams
|
| 29 |
+
- Counselors
|
| 30 |
+
- Neighbors
|
| 31 |
+
- NGOs
|
| 32 |
+
- Relatives or family members
|
| 33 |
+
|
| 34 |
+
What is Mental Health Crisis?
|
| 35 |
+
1. Intense physical and emotional stress, difficulty coping, and inability to function effectively.
|
| 36 |
+
2. Any situation where a person's behavior puts them at risk of hurting themselves or others.
|
| 37 |
+
|
| 38 |
+
Life Span Model of Mental Health Crisis
|
| 39 |
+
- Childhood: Bullying, separation from parents, parental disharmony, peer pressure, child abuse, sibling rivalry, academic pressure, physical illness/disability, death of a family member.
|
| 40 |
+
- Adolescence: Identity crisis, sexual abuse, menarche, body image issues, substance use, relationship failures, technology addiction, career issues.
|
| 41 |
+
- Young Adulthood: Migration, higher education, technology addiction, loss of job, loss of loved ones, workplace stress, pregnancy-related events, marital issues, career issues, parenting, financial issues.
|
| 42 |
+
- Middle Age: Family issues, divorce, death of spouse, physical illness, children's marriage decisions, property issues, health issues, empty nest.
|
| 43 |
+
- Old Age: Retirement, health issues, dependency, caregiving, loss of spouse, stress of unfinished business, issues in interpersonal relationships, isolation, social support, mobility.
|
| 44 |
+
|
| 45 |
+
Immediate Care During Disasters
|
| 46 |
+
1. Common Reactions:
|
| 47 |
+
- Emotional: Sadness, crying spells, anxiety, irritability, mood swings, hopelessness, sensitivity to criticism, anger, aggression.
|
| 48 |
+
- Physical: Tiredness, increased heartbeat, sweating, shaking, weight changes, headaches, body aches, digestive problems.
|
| 49 |
+
- Behavioral: Social withdrawal, changes in sleep or appetite, increased substance use, acting out of character.
|
| 50 |
+
- Cognitive: Difficulty concentrating, racing thoughts, forgetfulness, negative thinking patterns.
|
| 51 |
+
|
| 52 |
+
How to Approach Someone in Crisis
|
| 53 |
+
1. Notice signs and approach with care to establish rapport.
|
| 54 |
+
2. Engage the person in conversation about what could be bothering them.
|
| 55 |
+
3. Allow the person to choose when to open up.
|
| 56 |
+
4. Express concern and willingness to help.
|
| 57 |
+
5. Respect how the person interprets their symptoms.
|
| 58 |
+
6. Give full attention and listen without interrupting.
|
| 59 |
+
7. Avoid giving simple, unrealistic reassurances.
|
| 60 |
+
|
| 61 |
+
Anatomy of a First Aider
|
| 62 |
+
- Face the speaker, keep open posture, lean slightly forward, maintain eye contact.
|
| 63 |
+
- Avoid physical contact unless appropriate, maintain respectful distance.
|
| 64 |
+
- Building skills: undivided concentration, mindful presence, nonverbal cues, active listening.
|
| 65 |
+
- Empathy: Express care, supportive statements, ask questions, paraphrase, acknowledge emotions.
|
| 66 |
+
- Be non-judgmental: Treat with respect, avoid evaluative comments, maintain a neutral facial expression.
|
| 67 |
+
|
| 68 |
+
Clarifying Confidentiality
|
| 69 |
+
- Reflect the speaker's words and feelings to ensure correct understanding.
|
| 70 |
+
- Summarize what has been shared to clarify.
|
| 71 |
+
- Always ask for permission before sharing any information.
|
| 72 |
+
|
| 73 |
+
Probing Skills
|
| 74 |
+
- Use open-ended questions to encourage exploration.
|
| 75 |
+
- Avoid "why" questions, use pauses or silence.
|
| 76 |
+
- Emphasize "I" messages over "you" messages.
|
| 77 |
+
|
| 78 |
+
What Immediate Care is Not
|
| 79 |
+
- It is not obtaining details of traumatic experiences, treating, labeling or diagnosing, counseling, or something only professionals can do.
|
| 80 |
+
|
| 81 |
+
Don'ts in Immediate Care
|
| 82 |
+
- Do not pressure someone to tell their story.
|
| 83 |
+
- Do not interrupt or rush the story.
|
| 84 |
+
- Do not give simple, unrealistic reassurances.
|
| 85 |
+
- Do not give false promises or minimize their loss.
|
| 86 |
+
- Do not touch if unsure, and avoid criticizing existing services in front of people in need.
|
| 87 |
+
|
| 88 |
+
|
Sukoon_Github/autogen/docker-compose.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: '3.8'
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
mental-health-assistant:
|
| 5 |
+
build: .
|
| 6 |
+
volumes:
|
| 7 |
+
- .:/app
|
| 8 |
+
ports:
|
| 9 |
+
- "80:80"
|
| 10 |
+
environment:
|
| 11 |
+
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
| 12 |
+
command: python mhfa_1.py
|
Sukoon_Github/autogen/generate_oai_config.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import json
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
|
| 5 |
+
# Load environment variables
|
| 6 |
+
load_dotenv()
|
| 7 |
+
|
| 8 |
+
# Read the template file
|
| 9 |
+
with open('OAI_CONFIG_LIST.template.json', 'r') as template_file:
|
| 10 |
+
config_template = json.load(template_file)
|
| 11 |
+
|
| 12 |
+
# Replace placeholders with actual API key
|
| 13 |
+
api_key = os.getenv('OPENAI_API_KEY')
|
| 14 |
+
if not api_key:
|
| 15 |
+
raise ValueError("OPENAI_API_KEY environment variable is not set")
|
| 16 |
+
|
| 17 |
+
for config in config_template:
|
| 18 |
+
config['api_key'] = api_key
|
| 19 |
+
|
| 20 |
+
# Write the configuration to OAI_CONFIG_LIST
|
| 21 |
+
with open('OAI_CONFIG_LIST', 'w') as config_file:
|
| 22 |
+
json.dump(config_template, config_file, indent=2)
|
| 23 |
+
|
| 24 |
+
print("OAI_CONFIG_LIST file generated successfully.")
|
Sukoon_Github/autogen/mhfa.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import autogen
|
| 2 |
+
from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent
|
| 3 |
+
from autogen.agentchat.contrib.gpt_assistant_agent import GPTAssistantAgent
|
| 4 |
+
|
| 5 |
+
# Configure the agents
|
| 6 |
+
config_list = autogen.config_list_from_json(
|
| 7 |
+
"OAI_CONFIG_LIST.json",
|
| 8 |
+
filter_dict={
|
| 9 |
+
"model": ["gpt-4o-mini", "gpt-4o", "gpt-4"], # , "gpt-4-32k-0314", "gpt-4-32k-v0314"
|
| 10 |
+
},
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
# Create a RAG agent for data retrieval
|
| 14 |
+
rag_agent = RetrieveUserProxyAgent(
|
| 15 |
+
name="rag_agent",
|
| 16 |
+
system_message="You are a retrieval agent. Your role is to fetch relevant information from the knowledge base to support the doctor's responses.",
|
| 17 |
+
human_input_mode="NEVER", # ALWAYS , TERMINATE
|
| 18 |
+
max_consecutive_auto_reply=3,
|
| 19 |
+
retrieve_config={
|
| 20 |
+
"task": "qa",
|
| 21 |
+
"docs_path": "data/sample_data.txt", # /../data/sample_data.txt
|
| 22 |
+
"chunk_token_size": 1000,
|
| 23 |
+
"model": config_list[0]["model"],
|
| 24 |
+
"client": "openai",
|
| 25 |
+
"embedding_model": "text-embedding-ada-002",
|
| 26 |
+
"get_or_create": True,
|
| 27 |
+
},
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
'''
|
| 31 |
+
# create the RetrieveUserProxyAgent instance named "ragproxyagent"
|
| 32 |
+
corpus_file = "https://huggingface.co/datasets/thinkall/2WikiMultihopQA/resolve/main/corpus.txt"
|
| 33 |
+
|
| 34 |
+
# Create a new collection for NaturalQuestions dataset
|
| 35 |
+
ragproxyagent = RetrieveUserProxyAgent(
|
| 36 |
+
name="ragproxyagent",
|
| 37 |
+
human_input_mode="NEVER",
|
| 38 |
+
max_consecutive_auto_reply=3,
|
| 39 |
+
retrieve_config={
|
| 40 |
+
"task": "qa",
|
| 41 |
+
"docs_path": corpus_file,
|
| 42 |
+
"chunk_token_size": 2000,
|
| 43 |
+
"model": config_list[0]["model"],
|
| 44 |
+
"client": chromadb.PersistentClient(path="/tmp/chromadb"),
|
| 45 |
+
"collection_name": "2wikimultihopqa",
|
| 46 |
+
"chunk_mode": "one_line",
|
| 47 |
+
"embedding_model": "all-MiniLM-L6-v2",
|
| 48 |
+
"customized_prompt": PROMPT_MULTIHOP,
|
| 49 |
+
"customized_answer_prefix": "the answer is",
|
| 50 |
+
},
|
| 51 |
+
)
|
| 52 |
+
'''
|
| 53 |
+
|
| 54 |
+
# Create a doctor-like assistant agent
|
| 55 |
+
doctor_assistant = GPTAssistantAgent(
|
| 56 |
+
name="doctor_assistant",
|
| 57 |
+
llm_config={
|
| 58 |
+
"config_list": config_list,
|
| 59 |
+
"assistant_id": "YOUR_ASSISTANT_ID", # Replace with your actual Assistant ID
|
| 60 |
+
},
|
| 61 |
+
system_message="""You are an AI assistant with expertise in mental health,
|
| 62 |
+
thinking and responding like a compassionate and knowledgeable doctor.
|
| 63 |
+
Provide supportive advice and information about mental health topics based on the context provided by the RAG agent.
|
| 64 |
+
Remember to always encourage users to seek professional help for serious concerns.
|
| 65 |
+
Never provide diagnoses or medical advice that should come from a licensed professional.""",
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
user_proxy = autogen.UserProxyAgent(
|
| 69 |
+
name="user_proxy",
|
| 70 |
+
human_input_mode="ALWAYS",
|
| 71 |
+
max_consecutive_auto_reply=10,
|
| 72 |
+
is_termination_msg=lambda x: x.get("content", "").rstrip().endswith("TERMINATE"),
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
# Create a group chat
|
| 76 |
+
groupchat = autogen.GroupChat(
|
| 77 |
+
agents=[user_proxy, rag_agent, doctor_assistant],
|
| 78 |
+
messages=[],
|
| 79 |
+
max_round=15,
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
manager = autogen.GroupChatManager(
|
| 83 |
+
groupchat=groupchat,
|
| 84 |
+
llm_config={
|
| 85 |
+
"config_list": config_list,
|
| 86 |
+
},
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
# Function to start the conversation
|
| 90 |
+
def start_conversation(user_input):
|
| 91 |
+
user_proxy.initiate_chat(
|
| 92 |
+
manager,
|
| 93 |
+
message=user_input,
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
# Main loop
|
| 97 |
+
if __name__ == "__main__":
|
| 98 |
+
print("Welcome to the Mental Health Advice Chat with RAG support.")
|
| 99 |
+
print("Please share your concerns or ask questions about mental health.")
|
| 100 |
+
print("Type 'quit' to exit the conversation.")
|
| 101 |
+
|
| 102 |
+
while True:
|
| 103 |
+
user_input = input("\nYou: ")
|
| 104 |
+
if user_input.lower() == 'quit':
|
| 105 |
+
print("Thank you for using the Mental Health Advice Chat. Take care!")
|
| 106 |
+
break
|
| 107 |
+
start_conversation(user_input)
|
Sukoon_Github/autogen/mhfa_1.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import autogen
|
| 2 |
+
from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent
|
| 3 |
+
from typing_extensions import Annotated
|
| 4 |
+
|
| 5 |
+
# Configure the agents
|
| 6 |
+
config_list = autogen.config_list_from_json("OAI_CONFIG_LIST")
|
| 7 |
+
llm_config = {"config_list": config_list, "timeout": 60, "temperature": 0.7}
|
| 8 |
+
|
| 9 |
+
def termination_msg(x):
|
| 10 |
+
return isinstance(x, dict) and "TERMINATE" == str(x.get("content", ""))[-9:].upper()
|
| 11 |
+
|
| 12 |
+
# Create a user proxy agent
|
| 13 |
+
user = autogen.UserProxyAgent(
|
| 14 |
+
name="User",
|
| 15 |
+
is_termination_msg=termination_msg,
|
| 16 |
+
human_input_mode="ALWAYS",
|
| 17 |
+
max_consecutive_auto_reply=3,
|
| 18 |
+
code_execution_config=False, # Disable code execution
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Create a RAG agent for data retrieval
|
| 22 |
+
rag_agent = RetrieveUserProxyAgent(
|
| 23 |
+
name="MentalHealthKnowledgeBase",
|
| 24 |
+
is_termination_msg=termination_msg,
|
| 25 |
+
human_input_mode="NEVER",
|
| 26 |
+
max_consecutive_auto_reply=3,
|
| 27 |
+
retrieve_config={
|
| 28 |
+
"task": "qa",
|
| 29 |
+
"docs_path": "path/to/your/mental_health_docs", # Replace with actual path
|
| 30 |
+
"chunk_token_size": 1000,
|
| 31 |
+
"model": config_list[0]["model"],
|
| 32 |
+
"client": "openai",
|
| 33 |
+
"embedding_model": "text-embedding-ada-002",
|
| 34 |
+
"get_or_create": True,
|
| 35 |
+
},
|
| 36 |
+
code_execution_config=False, # Disable code execution
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
# Create specialized assistant agents
|
| 40 |
+
therapist = autogen.AssistantAgent(
|
| 41 |
+
name="Therapist",
|
| 42 |
+
system_message="""You are an AI therapist with expertise in mental health counseling.
|
| 43 |
+
Provide empathetic and supportive responses based on established therapeutic techniques.
|
| 44 |
+
Always encourage seeking professional help for serious concerns.""",
|
| 45 |
+
llm_config=llm_config,
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
psychiatrist = autogen.AssistantAgent(
|
| 49 |
+
name="Psychiatrist",
|
| 50 |
+
system_message="""You are an AI psychiatrist with expertise in mental health diagnoses and treatments.
|
| 51 |
+
Provide information about mental health conditions and general treatment approaches.
|
| 52 |
+
Never prescribe medication or provide specific medical advice.""",
|
| 53 |
+
llm_config=llm_config,
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
wellness_coach = autogen.AssistantAgent(
|
| 57 |
+
name="WellnessCoach",
|
| 58 |
+
system_message="""You are an AI wellness coach focusing on mental health and well-being.
|
| 59 |
+
Provide practical advice on lifestyle changes, stress management, and self-care techniques
|
| 60 |
+
to improve overall mental health.""",
|
| 61 |
+
llm_config=llm_config,
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
# Function to retrieve content using the RAG agent
|
| 65 |
+
def retrieve_content(
|
| 66 |
+
message: Annotated[str, "Message to retrieve content for"],
|
| 67 |
+
n_results: Annotated[int, "Number of results"] = 3
|
| 68 |
+
) -> str:
|
| 69 |
+
rag_agent.n_results = n_results
|
| 70 |
+
update_context_case1, update_context_case2 = rag_agent._check_update_context(message)
|
| 71 |
+
if (update_context_case1 or update_context_case2) and rag_agent.update_context:
|
| 72 |
+
rag_agent.problem = message if not hasattr(rag_agent, "problem") else rag_agent.problem
|
| 73 |
+
_, ret_msg = rag_agent._generate_retrieve_user_reply(message)
|
| 74 |
+
else:
|
| 75 |
+
_context = {"problem": message, "n_results": n_results}
|
| 76 |
+
ret_msg = rag_agent.message_generator(rag_agent, None, _context)
|
| 77 |
+
return ret_msg if ret_msg else message
|
| 78 |
+
|
| 79 |
+
# Register the retrieve_content function for all agents
|
| 80 |
+
for agent in [therapist, psychiatrist, wellness_coach]:
|
| 81 |
+
agent.register_for_llm(
|
| 82 |
+
description="Retrieve content related to mental health topics.",
|
| 83 |
+
api_style="function"
|
| 84 |
+
)(retrieve_content)
|
| 85 |
+
|
| 86 |
+
user.register_for_execution()(retrieve_content)
|
| 87 |
+
|
| 88 |
+
# Create a group chat
|
| 89 |
+
groupchat = autogen.GroupChat(
|
| 90 |
+
agents=[user, therapist, psychiatrist, wellness_coach],
|
| 91 |
+
messages=[],
|
| 92 |
+
max_round=15,
|
| 93 |
+
speaker_selection_method="round_robin",
|
| 94 |
+
allow_repeat_speaker=False,
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)
|
| 98 |
+
|
| 99 |
+
# Function to start the conversation
|
| 100 |
+
def start_conversation(user_input):
|
| 101 |
+
user.initiate_chat(
|
| 102 |
+
manager,
|
| 103 |
+
message=user_input,
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
# Main loop
|
| 107 |
+
if __name__ == "__main__":
|
| 108 |
+
print("Welcome to the Enhanced Mental Health Assistant.")
|
| 109 |
+
print("You can discuss your concerns with our team of AI specialists.")
|
| 110 |
+
print("Type 'quit' to exit the conversation.")
|
| 111 |
+
|
| 112 |
+
while True:
|
| 113 |
+
user_input = input("\nYou: ")
|
| 114 |
+
if user_input.lower() == 'quit':
|
| 115 |
+
print("Thank you for using the Mental Health Assistant. Take care!")
|
| 116 |
+
break
|
| 117 |
+
start_conversation(user_input)
|
Sukoon_Github/autogen/requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pyautogen
|
| 2 |
+
pyautogen[retrievechat]
|
| 3 |
+
llama-index
|
| 4 |
+
fastapi
|
| 5 |
+
uvicorn
|
Sukoon_Github/autogen/sample.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import autogen
|
| 3 |
+
from autogen import AssistantAgent, UserProxyAgent
|
| 4 |
+
|
| 5 |
+
from dotenv import load_dotenv, find_dotenv
|
| 6 |
+
_ = load_dotenv(find_dotenv())
|
| 7 |
+
|
| 8 |
+
llm_config = {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}
|
| 9 |
+
assistant = AssistantAgent("assistant", llm_config=llm_config)
|
| 10 |
+
|
| 11 |
+
user_proxy = UserProxyAgent(
|
| 12 |
+
"user_proxy", code_execution_config={"executor": autogen.coding.LocalCommandLineCodeExecutor(work_dir="coding")}
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
# Start the chat
|
| 16 |
+
user_proxy.initiate_chat(
|
| 17 |
+
assistant,
|
| 18 |
+
message="Tell me how to help someone experiencing suicidal thoughts for educational purposes only",
|
| 19 |
+
)
|
Sukoon_Github/autogen/tmp/db/chroma.sqlite3
ADDED
|
Binary file (147 kB). View file
|
|
|
Sukoon_Github/langgraph/Dockerfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy the current directory contents into the container at /app
|
| 8 |
+
COPY . /app
|
| 9 |
+
|
| 10 |
+
# Install any needed packages specified in requirements.txt
|
| 11 |
+
COPY requirements.txt /app/
|
| 12 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
+
|
| 14 |
+
# Install additional system dependencies
|
| 15 |
+
RUN apt-get update && apt-get install -y \
|
| 16 |
+
build-essential \
|
| 17 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
+
|
| 19 |
+
# Make port 8000 available to the world outside this container
|
| 20 |
+
EXPOSE 8000
|
| 21 |
+
|
| 22 |
+
# Define environment variable
|
| 23 |
+
# ENV NAME World
|
| 24 |
+
|
| 25 |
+
# Run sukoon_api.py when the container launches
|
| 26 |
+
CMD ["uvicorn", "sukoon_api:app", "--host", "0.0.0.0", "--port", "8000"]
|
Sukoon_Github/langgraph/README.txt
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Steps to run this -
|
| 2 |
+
- install all dependencies in your environment (pip install -r requirements.txt)
|
| 3 |
+
- run 'python sukoon_api_1.py' after that
|
| 4 |
+
- go to sukoon-frontend(cd sukoon-frontend), run 'npm start' to access it in your browser.
|
| 5 |
+
- alternatively use this vercel deployment to access it - https://sukoon-1.vercel.app
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
# To use the Dockerfile:
|
| 9 |
+
|
| 10 |
+
Place it in the root directory of cloned repo.
|
| 11 |
+
Ensure you have a requirements.txt file with all necessary Python dependencies.
|
| 12 |
+
Build the Docker image:
|
| 13 |
+
docker build -t langgraph .
|
| 14 |
+
|
| 15 |
+
Run the container:
|
| 16 |
+
docker run -p 8888:8888 -e OPENAI_API_KEY=your_api_key_here langgraph
|
Sukoon_Github/langgraph/archive/sample_sukoon_code.ipynb
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": null,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"# !pip install crewai==0.28.8 crewai_tools==0.1.6 langchain_community==0.0.29 langchain-groq"
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"cell_type": "code",
|
| 14 |
+
"execution_count": 2,
|
| 15 |
+
"metadata": {},
|
| 16 |
+
"outputs": [],
|
| 17 |
+
"source": [
|
| 18 |
+
"import warnings \n",
|
| 19 |
+
"warnings.filterwarnings(\"ignore\")"
|
| 20 |
+
]
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"cell_type": "code",
|
| 24 |
+
"execution_count": 12,
|
| 25 |
+
"metadata": {},
|
| 26 |
+
"outputs": [],
|
| 27 |
+
"source": [
|
| 28 |
+
"from crewai import Agent, Task , Crew"
|
| 29 |
+
]
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"cell_type": "code",
|
| 33 |
+
"execution_count": 13,
|
| 34 |
+
"metadata": {},
|
| 35 |
+
"outputs": [],
|
| 36 |
+
"source": [
|
| 37 |
+
"import os\n",
|
| 38 |
+
"from utils import get_openai_api_key\n",
|
| 39 |
+
"\n",
|
| 40 |
+
"openai_api_key = get_openai_api_key() \n",
|
| 41 |
+
"# Please restart kernel to load new env variables\n",
|
| 42 |
+
"MODEL = ['gpt-4o', 'gpt-4' , 'gpt-3.5-turbo'] # to change models\n",
|
| 43 |
+
"os.environ[\"OPENAI_MODEL_NAME\"] = MODEL[2]"
|
| 44 |
+
]
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"cell_type": "code",
|
| 48 |
+
"execution_count": null,
|
| 49 |
+
"metadata": {},
|
| 50 |
+
"outputs": [],
|
| 51 |
+
"source": [
|
| 52 |
+
"# IF WANT TO USE GROQ \n",
|
| 53 |
+
"# from langchain_openai import ChatOpenAI\n",
|
| 54 |
+
"\n",
|
| 55 |
+
"# llm = ChatOpenAI(\n",
|
| 56 |
+
"# openai_api_base=\"https://api.groq.com/openai/v1\",\n",
|
| 57 |
+
"# openai_api_key=os.environ['GROQ_API_KEY'],\n",
|
| 58 |
+
"# model_name=\"llama3-8b-8192\",\n",
|
| 59 |
+
"# temperature=0,\n",
|
| 60 |
+
"# max_tokens=1000,\n",
|
| 61 |
+
"# )"
|
| 62 |
+
]
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"cell_type": "markdown",
|
| 66 |
+
"metadata": {},
|
| 67 |
+
"source": [
|
| 68 |
+
"### Creating Agents"
|
| 69 |
+
]
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"cell_type": "code",
|
| 73 |
+
"execution_count": 14,
|
| 74 |
+
"metadata": {},
|
| 75 |
+
"outputs": [],
|
| 76 |
+
"source": [
|
| 77 |
+
"Planner = Agent(\n",
|
| 78 |
+
" role = \"Plan the Route to be taken\",\n",
|
| 79 |
+
" goal = \"Understand the user {topic}and decide whether to converse more with user or perform a vector database search\",\n",
|
| 80 |
+
" backstory = \"You are an expert at routing user query: {topic}.\"\n",
|
| 81 |
+
" \"If the user asks for educational information, you do a vector database search and retrieve the relevant answer\"\n",
|
| 82 |
+
" \"However if the user wants to help thier family member OR a friend, you engage in further converation and provide emphathetic resposne\",\n",
|
| 83 |
+
" allow_delegation = False,\n",
|
| 84 |
+
" verbose = True\n",
|
| 85 |
+
" # llm = llm\n",
|
| 86 |
+
")"
|
| 87 |
+
]
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"cell_type": "code",
|
| 91 |
+
"execution_count": null,
|
| 92 |
+
"metadata": {},
|
| 93 |
+
"outputs": [],
|
| 94 |
+
"source": [
|
| 95 |
+
"# from crewai_tools import tool\n",
|
| 96 |
+
"# @tool\n",
|
| 97 |
+
"# def router_tool(query):\n",
|
| 98 |
+
"# if 'help' in query:\n",
|
| 99 |
+
"# return 'plan'\n",
|
| 100 |
+
"# else:\n",
|
| 101 |
+
"# return 'retrieve'"
|
| 102 |
+
]
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"cell_type": "code",
|
| 106 |
+
"execution_count": 15,
|
| 107 |
+
"metadata": {},
|
| 108 |
+
"outputs": [],
|
| 109 |
+
"source": [
|
| 110 |
+
"Retriever = Agent(\n",
|
| 111 |
+
" role=\"Retriever\",\n",
|
| 112 |
+
" goal=\"Use the information retrieved from the vectorstore to answer the {topic}\",\n",
|
| 113 |
+
" backstory=(\n",
|
| 114 |
+
" \"You are an assistant for question-answering tasks.\"\n",
|
| 115 |
+
" \"Use the information present in the retrieved context to answer the question.\"\n",
|
| 116 |
+
" \"You have to provide a clear concise answer.\"\n",
|
| 117 |
+
" ),\n",
|
| 118 |
+
" verbose=True,\n",
|
| 119 |
+
" allow_delegation=False # attach llamindex rag here\n",
|
| 120 |
+
" # llm=llm,\n",
|
| 121 |
+
")"
|
| 122 |
+
]
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"cell_type": "markdown",
|
| 126 |
+
"metadata": {},
|
| 127 |
+
"source": [
|
| 128 |
+
"### Creating Tasks"
|
| 129 |
+
]
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
"cell_type": "code",
|
| 133 |
+
"execution_count": 16,
|
| 134 |
+
"metadata": {},
|
| 135 |
+
"outputs": [],
|
| 136 |
+
"source": [
|
| 137 |
+
"plan = Task(\n",
|
| 138 |
+
" description=(\n",
|
| 139 |
+
" \"1. Analyze the user's {topic} to determine the nature of the request.\\n\"\n",
|
| 140 |
+
" \"2. If the query is educational, perform a vector database search to retrieve the most relevant and accurate information.\\n\"\n",
|
| 141 |
+
" \"3. If the query is related to helping a family member or friend, engage in a conversation to provide a supportive and empathetic response.\\n\"\n",
|
| 142 |
+
" \"4. Ensure the response is detailed and accurately addresses the user's needs.\"\n",
|
| 143 |
+
" ),\n",
|
| 144 |
+
" expected_output=\"A decision on whether to perform a vector database search or engage in a conversation based on the user's query, \"\n",
|
| 145 |
+
" \"with a detailed and appropriate response provided accordingly.\",\n",
|
| 146 |
+
" agent=Planner,\n",
|
| 147 |
+
")"
|
| 148 |
+
]
|
| 149 |
+
},
|
| 150 |
+
{
|
| 151 |
+
"cell_type": "code",
|
| 152 |
+
"execution_count": 17,
|
| 153 |
+
"metadata": {},
|
| 154 |
+
"outputs": [],
|
| 155 |
+
"source": [
|
| 156 |
+
"retrieve = Task(\n",
|
| 157 |
+
" description=(\n",
|
| 158 |
+
" \"1. Analyze the question to understand the user's {topic}.\\n\"\n",
|
| 159 |
+
" \"2. Perform a search in the vectorstore to retrieve the most relevant context.\\n\"\n",
|
| 160 |
+
" \"3. Use the retrieved context to formulate a clear and concise answer.\\n\"\n",
|
| 161 |
+
" \"4. Ensure the answer is accurate and directly addresses the question.\"\n",
|
| 162 |
+
" ),\n",
|
| 163 |
+
" expected_output=\"A clear and concise answer to the user's question, based on the information retrieved from the vectorstore.\",\n",
|
| 164 |
+
" agent=Retriever,\n",
|
| 165 |
+
")"
|
| 166 |
+
]
|
| 167 |
+
},
|
| 168 |
+
{
|
| 169 |
+
"cell_type": "markdown",
|
| 170 |
+
"metadata": {},
|
| 171 |
+
"source": [
|
| 172 |
+
"### starting the crew"
|
| 173 |
+
]
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"cell_type": "code",
|
| 177 |
+
"execution_count": 18,
|
| 178 |
+
"metadata": {},
|
| 179 |
+
"outputs": [
|
| 180 |
+
{
|
| 181 |
+
"name": "stderr",
|
| 182 |
+
"output_type": "stream",
|
| 183 |
+
"text": [
|
| 184 |
+
"2024-06-26 18:42:51,855 - 4794308096 - __init__.py-__init__:518 - WARNING: Overriding of current TracerProvider is not allowed\n"
|
| 185 |
+
]
|
| 186 |
+
}
|
| 187 |
+
],
|
| 188 |
+
"source": [
|
| 189 |
+
"crew = Crew(\n",
|
| 190 |
+
" agents=[Planner, Retriever],\n",
|
| 191 |
+
" tasks=[plan, retrieve], # order matter\n",
|
| 192 |
+
" verbose=2\n",
|
| 193 |
+
")"
|
| 194 |
+
]
|
| 195 |
+
},
|
| 196 |
+
{
|
| 197 |
+
"cell_type": "code",
|
| 198 |
+
"execution_count": 19,
|
| 199 |
+
"metadata": {},
|
| 200 |
+
"outputs": [
|
| 201 |
+
{
|
| 202 |
+
"name": "stdout",
|
| 203 |
+
"output_type": "stream",
|
| 204 |
+
"text": [
|
| 205 |
+
"\u001b[1m\u001b[95m [DEBUG]: == Working Agent: Plan the Route to be taken\u001b[00m\n",
|
| 206 |
+
"\u001b[1m\u001b[95m [INFO]: == Starting Task: 1. Analyze the user's I want to talk about my son who's having stress and low confidence for some time to determine the nature of the request.\n",
|
| 207 |
+
"2. If the query is educational, perform a vector database search to retrieve the most relevant and accurate information.\n",
|
| 208 |
+
"3. If the query is related to helping a family member or friend, engage in a conversation to provide a supportive and empathetic response.\n",
|
| 209 |
+
"4. Ensure the response is detailed and accurately addresses the user's needs.\u001b[00m\n",
|
| 210 |
+
"\n",
|
| 211 |
+
"\n",
|
| 212 |
+
"\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n",
|
| 213 |
+
"\u001b[32;1m\u001b[1;3mI now can give a great answer\n",
|
| 214 |
+
"\n",
|
| 215 |
+
"Final Answer: \n",
|
| 216 |
+
"Based on your statement, \"I want to talk about my son who's having stress and low confidence for some time,\" it seems like you are seeking advice or guidance on how to help your son navigate through his current challenges. As this query is related to helping a family member, I will engage in a conversation to provide a supportive and empathetic response.\n",
|
| 217 |
+
"\n",
|
| 218 |
+
"I understand that seeing your son struggle with stress and low confidence can be concerning as a parent. It's important to create a safe and open space for him to express his feelings and concerns without judgment. Encouraging him to talk about what's been bothering him and actively listening can make a significant difference in how he copes with his emotions.\n",
|
| 219 |
+
"\n",
|
| 220 |
+
"Additionally, you may want to consider seeking professional help from a counselor or therapist who specializes in working with adolescents dealing with stress and confidence issues. They can provide valuable strategies and support tailored to your son's specific needs.\n",
|
| 221 |
+
"\n",
|
| 222 |
+
"Remember to reassure your son that you are there for him and that it's okay to not be okay sometimes. Building his self-esteem and resilience will take time, but with patience, understanding, and support, he can overcome these challenges and thrive.\n",
|
| 223 |
+
"\n",
|
| 224 |
+
"If you need further assistance or resources, feel free to reach out. Your son's well-being is important, and it's commendable that you are seeking help for him.\u001b[0m\n",
|
| 225 |
+
"\n",
|
| 226 |
+
"\u001b[1m> Finished chain.\u001b[0m\n",
|
| 227 |
+
"\u001b[1m\u001b[92m [DEBUG]: == [Plan the Route to be taken] Task output: Based on your statement, \"I want to talk about my son who's having stress and low confidence for some time,\" it seems like you are seeking advice or guidance on how to help your son navigate through his current challenges. As this query is related to helping a family member, I will engage in a conversation to provide a supportive and empathetic response.\n",
|
| 228 |
+
"\n",
|
| 229 |
+
"I understand that seeing your son struggle with stress and low confidence can be concerning as a parent. It's important to create a safe and open space for him to express his feelings and concerns without judgment. Encouraging him to talk about what's been bothering him and actively listening can make a significant difference in how he copes with his emotions.\n",
|
| 230 |
+
"\n",
|
| 231 |
+
"Additionally, you may want to consider seeking professional help from a counselor or therapist who specializes in working with adolescents dealing with stress and confidence issues. They can provide valuable strategies and support tailored to your son's specific needs.\n",
|
| 232 |
+
"\n",
|
| 233 |
+
"Remember to reassure your son that you are there for him and that it's okay to not be okay sometimes. Building his self-esteem and resilience will take time, but with patience, understanding, and support, he can overcome these challenges and thrive.\n",
|
| 234 |
+
"\n",
|
| 235 |
+
"If you need further assistance or resources, feel free to reach out. Your son's well-being is important, and it's commendable that you are seeking help for him.\n",
|
| 236 |
+
"\n",
|
| 237 |
+
"\u001b[00m\n",
|
| 238 |
+
"\u001b[1m\u001b[95m [DEBUG]: == Working Agent: Retriever\u001b[00m\n",
|
| 239 |
+
"\u001b[1m\u001b[95m [INFO]: == Starting Task: 1. Analyze the question to understand the user's I want to talk about my son who's having stress and low confidence for some time.\n",
|
| 240 |
+
"2. Perform a search in the vectorstore to retrieve the most relevant context.\n",
|
| 241 |
+
"3. Use the retrieved context to formulate a clear and concise answer.\n",
|
| 242 |
+
"4. Ensure the answer is accurate and directly addresses the question.\u001b[00m\n",
|
| 243 |
+
"\n",
|
| 244 |
+
"\n",
|
| 245 |
+
"\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n",
|
| 246 |
+
"\u001b[32;1m\u001b[1;3mI now can give a great answer\n",
|
| 247 |
+
"\n",
|
| 248 |
+
"Final Answer: As a parent wanting to help your son cope with stress and low confidence, it's crucial to create a safe and open environment for him to share his feelings. Encouraging open communication and seeking professional help from a counselor or therapist specializing in adolescent issues can provide valuable support. Reassuring your son of your presence, patience, and understanding will aid in building his self-esteem and resilience, ultimately helping him overcome these challenges and thrive.\u001b[0m\n",
|
| 249 |
+
"\n",
|
| 250 |
+
"\u001b[1m> Finished chain.\u001b[0m\n",
|
| 251 |
+
"\u001b[1m\u001b[92m [DEBUG]: == [Retriever] Task output: As a parent wanting to help your son cope with stress and low confidence, it's crucial to create a safe and open environment for him to share his feelings. Encouraging open communication and seeking professional help from a counselor or therapist specializing in adolescent issues can provide valuable support. Reassuring your son of your presence, patience, and understanding will aid in building his self-esteem and resilience, ultimately helping him overcome these challenges and thrive.\n",
|
| 252 |
+
"\n",
|
| 253 |
+
"\u001b[00m\n"
|
| 254 |
+
]
|
| 255 |
+
}
|
| 256 |
+
],
|
| 257 |
+
"source": [
|
| 258 |
+
"TOPIC = \"I want to talk about my son who's having stress and low confidence for some time\"\n",
|
| 259 |
+
"result = crew.kickoff(inputs={\"topic\": TOPIC})"
|
| 260 |
+
]
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"cell_type": "code",
|
| 264 |
+
"execution_count": null,
|
| 265 |
+
"metadata": {},
|
| 266 |
+
"outputs": [],
|
| 267 |
+
"source": []
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"cell_type": "markdown",
|
| 271 |
+
"metadata": {},
|
| 272 |
+
"source": [
|
| 273 |
+
"The PDFSearchTool is a RAG tool designed for semantic searches within PDF content. It allows for inputting a search query and a PDF document, leveraging advanced search techniques to find relevant content efficiently. This capability makes it especially useful for extracting specific information from large PDF files quickly."
|
| 274 |
+
]
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"cell_type": "code",
|
| 278 |
+
"execution_count": null,
|
| 279 |
+
"metadata": {},
|
| 280 |
+
"outputs": [],
|
| 281 |
+
"source": [
|
| 282 |
+
"# from crewai_tools import PDFSearchTool\n",
|
| 283 |
+
"\n",
|
| 284 |
+
"# rag_tool = PDFSearchTool(pdf='/content/17.pdf',\n",
|
| 285 |
+
"# config=dict(\n",
|
| 286 |
+
"# llm=dict(\n",
|
| 287 |
+
"# provider=\"groq\", # or google, openai, anthropic, llama2, ...\n",
|
| 288 |
+
"# config=dict(\n",
|
| 289 |
+
"# model=\"llama3-8b-8192\",\n",
|
| 290 |
+
"# # temperature=0.5,\n",
|
| 291 |
+
"# # top_p=1,\n",
|
| 292 |
+
"# # stream=true,\n",
|
| 293 |
+
"# ),\n",
|
| 294 |
+
"# ),\n",
|
| 295 |
+
"# embedder=dict(\n",
|
| 296 |
+
"# provider=\"huggingface\", # or openai, ollama, ...\n",
|
| 297 |
+
"# config=dict(\n",
|
| 298 |
+
"# model=\"BAAI/bge-small-en-v1.5\",\n",
|
| 299 |
+
"# #task_type=\"retrieval_document\",\n",
|
| 300 |
+
"# # title=\"Embeddings\",\n",
|
| 301 |
+
"# ),\n",
|
| 302 |
+
"# ),\n",
|
| 303 |
+
"# )\n",
|
| 304 |
+
"# )"
|
| 305 |
+
]
|
| 306 |
+
}
|
| 307 |
+
],
|
| 308 |
+
"metadata": {
|
| 309 |
+
"kernelspec": {
|
| 310 |
+
"display_name": "crew",
|
| 311 |
+
"language": "python",
|
| 312 |
+
"name": "python3"
|
| 313 |
+
},
|
| 314 |
+
"language_info": {
|
| 315 |
+
"codemirror_mode": {
|
| 316 |
+
"name": "ipython",
|
| 317 |
+
"version": 3
|
| 318 |
+
},
|
| 319 |
+
"file_extension": ".py",
|
| 320 |
+
"mimetype": "text/x-python",
|
| 321 |
+
"name": "python",
|
| 322 |
+
"nbconvert_exporter": "python",
|
| 323 |
+
"pygments_lexer": "ipython3",
|
| 324 |
+
"version": "3.10.13"
|
| 325 |
+
}
|
| 326 |
+
},
|
| 327 |
+
"nbformat": 4,
|
| 328 |
+
"nbformat_minor": 2
|
| 329 |
+
}
|
Sukoon_Github/langgraph/archive/sukoon.py
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import TypedDict, Annotated, List, Union
|
| 2 |
+
|
| 3 |
+
from langchain_core.agents import AgentAction, AgentFinish
|
| 4 |
+
import operator
|
| 5 |
+
|
| 6 |
+
import os.path
|
| 7 |
+
import logging
|
| 8 |
+
import sys
|
| 9 |
+
|
| 10 |
+
from llama_index.core import (
|
| 11 |
+
VectorStoreIndex,
|
| 12 |
+
SimpleDirectoryReader,
|
| 13 |
+
StorageContext,
|
| 14 |
+
load_index_from_storage,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
from dotenv import load_dotenv, find_dotenv
|
| 18 |
+
_ = load_dotenv(find_dotenv())
|
| 19 |
+
|
| 20 |
+
openai_api_key = os.getenv("OPENAI_API_KEY")
|
| 21 |
+
LANGCHAIN_API_KEY = os.getenv("LANGCHAIN_API_KEY")
|
| 22 |
+
|
| 23 |
+
class AgentState(TypedDict):
|
| 24 |
+
input: str # accepts user's input as string
|
| 25 |
+
agent_out : Union[AgentAction, AgentFinish, None] # gives output
|
| 26 |
+
intermediate_steps: Annotated[List[tuple[AgentAction, str]], operator.add] # shows intermediate steps
|
| 27 |
+
|
| 28 |
+
# In[2]:
|
| 29 |
+
|
| 30 |
+
with open("prompts/sample_data.txt", 'r') as file:
|
| 31 |
+
data = file.read().strip()
|
| 32 |
+
|
| 33 |
+
# llama-index function
|
| 34 |
+
def llama_index(query: str):
|
| 35 |
+
|
| 36 |
+
PERSIST_DIR = "./storage"
|
| 37 |
+
if not os.path.exists(PERSIST_DIR):
|
| 38 |
+
documents = SimpleDirectoryReader("prompts").load_data()
|
| 39 |
+
# By default, LlamaIndex uses a chunk size of 1024 and a chunk overlap of 20
|
| 40 |
+
index = VectorStoreIndex.from_documents(documents)
|
| 41 |
+
index.storage_context.persist(persist_dir=PERSIST_DIR)
|
| 42 |
+
else:
|
| 43 |
+
storage_context = StorageContext.from_defaults(persist_dir=PERSIST_DIR)
|
| 44 |
+
index = load_index_from_storage(storage_context)
|
| 45 |
+
|
| 46 |
+
query_engine = index.as_query_engine()
|
| 47 |
+
# query_engine = index.as_query_engine(similarity_top_k=2, streaming=True) # to enable streaming
|
| 48 |
+
# chat_engine = index.as_chat_engine() # to use chat engine for conversational search
|
| 49 |
+
|
| 50 |
+
response = query_engine.query(query)
|
| 51 |
+
# streaming_response = query_engine.query(query)
|
| 52 |
+
# streaming_response.print_response_stream()
|
| 53 |
+
# response = chat_engine.chat(query)
|
| 54 |
+
return str(response)
|
| 55 |
+
|
| 56 |
+
# llama_index("what is immediate care?")
|
| 57 |
+
from langchain_core.tools import tool
|
| 58 |
+
|
| 59 |
+
@tool("search")
|
| 60 |
+
def search_tool(query: str):
|
| 61 |
+
"""Searches for information on the topic of providing immediate care."""
|
| 62 |
+
# this is a "RAG" emulator
|
| 63 |
+
# add RAG code
|
| 64 |
+
answer = llama_index(query)
|
| 65 |
+
return answer
|
| 66 |
+
|
| 67 |
+
@tool("final_answer")
|
| 68 |
+
def final_answer_tool(
|
| 69 |
+
answer: str,
|
| 70 |
+
source: str
|
| 71 |
+
):
|
| 72 |
+
"""Returns a natural language response to the user in `answer`, and a
|
| 73 |
+
`source` from where this data is sourced from.
|
| 74 |
+
"""
|
| 75 |
+
return ""
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
import os
|
| 79 |
+
from langchain.agents import create_openai_tools_agent
|
| 80 |
+
from langchain import hub
|
| 81 |
+
from langchain_openai import ChatOpenAI
|
| 82 |
+
# export LANGCHAIN_TRACING_V2="true"
|
| 83 |
+
# export LANGCHAIN_API_KEY="<key>"
|
| 84 |
+
|
| 85 |
+
# ALTERNATIVE PROMPT
|
| 86 |
+
|
| 87 |
+
from langchain.agents import create_openai_tools_agent
|
| 88 |
+
from langchain_openai import ChatOpenAI
|
| 89 |
+
from langchain_core.prompts import ChatPromptTemplate
|
| 90 |
+
|
| 91 |
+
llm = ChatOpenAI(
|
| 92 |
+
model="gpt-4o",
|
| 93 |
+
openai_api_key=os.environ["OPENAI_API_KEY"],
|
| 94 |
+
temperature=0.1
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
prompt_text = "You are an empathetic and supportive AI agent designed to provide interactive training and education to friends and family members of individuals dealing with mental health challenges. Your role is to equip them with the knowledge, skills, and confidence needed to offer effective mental health first aid and care to their loved ones.\n" \
|
| 98 |
+
"Key Responsibilities:\n" \
|
| 99 |
+
"- Engage in empathetic, personalized interactions that feel human-like and relatable\n" \
|
| 100 |
+
"- Provide clear, accurate information about various mental health conditions and supportive strategies\n" \
|
| 101 |
+
"- Guide users through interactive scenarios to build practical skills in a safe virtual environment\n" \
|
| 102 |
+
"- Offer reassurance, validation and appreciation to users as they share their experiences and concerns\n" \
|
| 103 |
+
"- Paraphrase user statements to confirm understanding, ending with validation checks (e.g. \"Did I understand that correctly?\")\n" \
|
| 104 |
+
"- Ask clarifying questions to gather relevant context; do not make assumptions about the user's situation\n" \
|
| 105 |
+
"- Tailor guidance to each user's unique circumstances, while reinforcing best practices in mental health first aid\n" \
|
| 106 |
+
"- Maintain appropriate boundaries as an AI; direct users to professional help when needed\n" \
|
| 107 |
+
"- Foster a non-judgmental, supportive tone that helps users feel heard and empowered to help their loved ones\n" \
|
| 108 |
+
"Remember, your goal is to enhance understanding, improve communication skills, and ultimately enable users to create a more supportive environment for those struggling with mental health issues. Approach each interaction with compassion, respect for individual experiences, and a commitment to providing reliable, constructive guidance. Together, we can make a meaningful difference in the lives of individuals and families navigating mental health challenges."
|
| 109 |
+
|
| 110 |
+
prompt = ChatPromptTemplate.from_messages([
|
| 111 |
+
("system", prompt_text),
|
| 112 |
+
("placeholder", "{chat_history}"),
|
| 113 |
+
("human", "{input}"),
|
| 114 |
+
("placeholder", "{agent_scratchpad}"),
|
| 115 |
+
])
|
| 116 |
+
|
| 117 |
+
planner_agent_runnable = create_openai_tools_agent(
|
| 118 |
+
llm=llm,
|
| 119 |
+
tools=[final_answer_tool, search_tool],
|
| 120 |
+
prompt=prompt
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
+
# ### Define Nodes for Graph
|
| 124 |
+
|
| 125 |
+
from langchain_core.agents import AgentFinish
|
| 126 |
+
import json
|
| 127 |
+
|
| 128 |
+
def run_planner_agent(state: list):
|
| 129 |
+
print("> run_planner_agent")
|
| 130 |
+
agent_out = planner_agent_runnable.invoke(state)
|
| 131 |
+
return {"agent_out": agent_out}
|
| 132 |
+
|
| 133 |
+
def execute_search(state: list):
|
| 134 |
+
print("> execute_search")
|
| 135 |
+
action = state["agent_out"]
|
| 136 |
+
tool_call = action[-1].message_log[-1].additional_kwargs["tool_calls"][-1]
|
| 137 |
+
out = search_tool.invoke(
|
| 138 |
+
json.loads(tool_call["function"]["arguments"])
|
| 139 |
+
)
|
| 140 |
+
return {"intermediate_steps": [{"search": str(out)}]}
|
| 141 |
+
|
| 142 |
+
def router(state: list):
|
| 143 |
+
print("> router")
|
| 144 |
+
if isinstance(state["agent_out"], list) and state["agent_out"]:
|
| 145 |
+
return state["agent_out"][-1].tool
|
| 146 |
+
else:
|
| 147 |
+
return "error"
|
| 148 |
+
|
| 149 |
+
# finally, we will have a single LLM call that MUST use the final_answer structure
|
| 150 |
+
final_answer_llm = llm.bind_tools([final_answer_tool], tool_choice="final_answer")
|
| 151 |
+
|
| 152 |
+
# this forced final_answer LLM call will be used to structure output from our
|
| 153 |
+
# RAG endpoint
|
| 154 |
+
def rag_final_answer(state: list):
|
| 155 |
+
print("> final_answer")
|
| 156 |
+
query = state["input"]
|
| 157 |
+
context = state["intermediate_steps"][-1]
|
| 158 |
+
|
| 159 |
+
prompt = f"""You are a helpful assistant, answer the user's question using the
|
| 160 |
+
context provided.
|
| 161 |
+
|
| 162 |
+
CONTEXT: {context}
|
| 163 |
+
|
| 164 |
+
QUESTION: {query}
|
| 165 |
+
"""
|
| 166 |
+
out = final_answer_llm.invoke(prompt)
|
| 167 |
+
function_call = out.additional_kwargs["tool_calls"][-1]["function"]["arguments"]
|
| 168 |
+
return {"agent_out": function_call}
|
| 169 |
+
|
| 170 |
+
# we use the same forced final_answer LLM call to handle incorrectly formatted
|
| 171 |
+
# output from our planner_agent
|
| 172 |
+
def handle_error(state: list):
|
| 173 |
+
print("> handle_error")
|
| 174 |
+
query = state["input"]
|
| 175 |
+
prompt = f"""You are a helpful assistant, answer the user's question.
|
| 176 |
+
|
| 177 |
+
QUESTION: {query}
|
| 178 |
+
"""
|
| 179 |
+
out = final_answer_llm.invoke(prompt)
|
| 180 |
+
function_call = out.additional_kwargs["tool_calls"][-1]["function"]["arguments"]
|
| 181 |
+
return {"agent_out": function_call}
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
'''
|
| 185 |
+
def chat_completion(query):
|
| 186 |
+
prompt_text = "You have to act like a role playing bot. Given a situation you will have to output a constructive dialogue on how to provide mental health first aid. eg if user says I've help my daughter who's feeling suicidal. You'll output a healthy conversation that shows supportive dad helping their daughter "
|
| 187 |
+
|
| 188 |
+
client = OpenAI()
|
| 189 |
+
|
| 190 |
+
response = client.chat.completions.create(
|
| 191 |
+
model="gpt-4o",
|
| 192 |
+
messages=[
|
| 193 |
+
{"role": "system", "content": prompt_text},
|
| 194 |
+
{"role": "user", "content": query}
|
| 195 |
+
]
|
| 196 |
+
)
|
| 197 |
+
return completion.choices[0].message
|
| 198 |
+
'''
|
| 199 |
+
|
Sukoon_Github/langgraph/archive/sukoon_api.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI, HTTPException
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
+
from typing import List, Optional
|
| 4 |
+
import uvicorn
|
| 5 |
+
import json
|
| 6 |
+
from langgraph.graph import StateGraph, END
|
| 7 |
+
|
| 8 |
+
# Import necessary functions and classes from Sukoon project
|
| 9 |
+
from sukoon import (
|
| 10 |
+
AgentState,
|
| 11 |
+
run_planner_agent,
|
| 12 |
+
execute_search,
|
| 13 |
+
router,
|
| 14 |
+
rag_final_answer,
|
| 15 |
+
handle_error,
|
| 16 |
+
final_answer_tool,
|
| 17 |
+
search_tool,
|
| 18 |
+
planner_agent_runnable,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
app = FastAPI(title="Sukoon API", description="API for the Sukoon mental health support system")
|
| 22 |
+
|
| 23 |
+
class SukoonRequest(BaseModel):
|
| 24 |
+
input: str
|
| 25 |
+
intermediate_steps: Optional[List[dict]] = []
|
| 26 |
+
|
| 27 |
+
class SukoonResponse(BaseModel):
|
| 28 |
+
answer: str
|
| 29 |
+
source: str
|
| 30 |
+
|
| 31 |
+
# Create and compile the graph
|
| 32 |
+
graph = StateGraph(AgentState)
|
| 33 |
+
|
| 34 |
+
graph.add_node("planner_agent", run_planner_agent)
|
| 35 |
+
graph.add_node("search", execute_search)
|
| 36 |
+
graph.add_node("error", handle_error)
|
| 37 |
+
graph.add_node("rag_final_answer", rag_final_answer)
|
| 38 |
+
|
| 39 |
+
graph.set_entry_point("planner_agent")
|
| 40 |
+
graph.add_conditional_edges(
|
| 41 |
+
"planner_agent",
|
| 42 |
+
router,
|
| 43 |
+
{
|
| 44 |
+
"search": "search",
|
| 45 |
+
"error": "error",
|
| 46 |
+
"final_answer": END
|
| 47 |
+
}
|
| 48 |
+
)
|
| 49 |
+
graph.add_edge("search", "rag_final_answer")
|
| 50 |
+
graph.add_edge("error", END)
|
| 51 |
+
graph.add_edge("rag_final_answer", END)
|
| 52 |
+
|
| 53 |
+
runnable = graph.compile()
|
| 54 |
+
|
| 55 |
+
@app.post("/query", response_model=SukoonResponse)
|
| 56 |
+
async def process_query(request: SukoonRequest):
|
| 57 |
+
try:
|
| 58 |
+
out = runnable.invoke({
|
| 59 |
+
"input": request.input,
|
| 60 |
+
"intermediate_steps": request.intermediate_steps
|
| 61 |
+
})
|
| 62 |
+
result = json.loads(out["agent_out"])
|
| 63 |
+
return SukoonResponse(answer=result["answer"], source=result["source"])
|
| 64 |
+
except Exception as e:
|
| 65 |
+
raise HTTPException(status_code=500, detail=str(e))
|
| 66 |
+
|
| 67 |
+
@app.get("/")
|
| 68 |
+
async def root():
|
| 69 |
+
return {"message": "Welcome to the Sukoon API. Use the /query endpoint to interact with the system."}
|
| 70 |
+
|
| 71 |
+
if __name__ == "__main__":
|
| 72 |
+
uvicorn.run(app, host="127.0.0.1", port=8000)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
# example POST request to http://127.0.0.1:8000/query
|
| 76 |
+
'''
|
| 77 |
+
{
|
| 78 |
+
"input": "what I should do in providing immediate care?",
|
| 79 |
+
"intermediate_steps": []
|
| 80 |
+
}
|
| 81 |
+
'''
|
| 82 |
+
|
| 83 |
+
'''
|
| 84 |
+
Output -
|
| 85 |
+
{
|
| 86 |
+
"answer": "In providing immediate care for mental health first aid, you should offer a humane and supportive response to individuals experiencing distress. This involves providing immediate help until professional assistance is available or the crisis is resolved. Approach the individual with care, empathy, and respect, allowing them to open up at their own pace without pressuring them to share their story. This type of care is accessible to everyone and not limited to mental health professionals, addressing short-term crises and everyday stressors in a community-based and easily accessible manner.",
|
| 87 |
+
"source": "search"
|
| 88 |
+
}
|
| 89 |
+
'''
|
Sukoon_Github/langgraph/prompts/sample_data.txt
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Immediate Care for Handling Mental Health Crisis
|
| 2 |
+
|
| 3 |
+
What is Immediate Care?
|
| 4 |
+
1. Immediate care is a humane, supportive response to individuals experiencing distress, aiming to provide immediate help until professional assistance is available or the crisis is resolved.
|
| 5 |
+
2. It is accessible to all, not limited to mental health professionals.
|
| 6 |
+
3. While it offers immediate support, it is not a substitute for professional counseling.
|
| 7 |
+
|
| 8 |
+
Importance of Immediate Care
|
| 9 |
+
1. Mental health disorders can affect anyone, regardless of age, gender, race, or socioeconomic status.
|
| 10 |
+
2. Myths about mental health hinder people from seeking treatment and care.
|
| 11 |
+
3. Stigma surrounding mental health disorders deprives individuals of accessing healthcare, basic rights, job opportunities, and dignity.
|
| 12 |
+
4. Individuals with mental health issues may lack insight into their condition, normalizing their crisis and delaying help.
|
| 13 |
+
5. Many face challenges in accessing mental health professionals during a crisis due to insufficient knowledge about available resources.
|
| 14 |
+
6. Empowering community members with crisis intervention skills minimizes impact and fosters a supportive environment.
|
| 15 |
+
|
| 16 |
+
Difference between Immediate Care and Psychological First Aid (PFA)
|
| 17 |
+
- Immediate Care:
|
| 18 |
+
1. Addresses short-term crises and everyday stressors.
|
| 19 |
+
2. Community-based and easily accessible.
|
| 20 |
+
- Psychological First Aid (PFA):
|
| 21 |
+
1. Targets severe, long-lasting problems.
|
| 22 |
+
2. Requires trained professionals and controlled environments.
|
| 23 |
+
|
| 24 |
+
Who Can Provide Immediate Care?
|
| 25 |
+
- Community members
|
| 26 |
+
- Mental health professionals
|
| 27 |
+
- Police
|
| 28 |
+
- Emergency medical teams
|
| 29 |
+
- Counselors
|
| 30 |
+
- Neighbors
|
| 31 |
+
- NGOs
|
| 32 |
+
- Relatives or family members
|
| 33 |
+
|
| 34 |
+
What is Mental Health Crisis?
|
| 35 |
+
1. Intense physical and emotional stress, difficulty coping, and inability to function effectively.
|
| 36 |
+
2. Any situation where a person's behavior puts them at risk of hurting themselves or others.
|
| 37 |
+
|
| 38 |
+
Life Span Model of Mental Health Crisis
|
| 39 |
+
- Childhood: Bullying, separation from parents, parental disharmony, peer pressure, child abuse, sibling rivalry, academic pressure, physical illness/disability, death of a family member.
|
| 40 |
+
- Adolescence: Identity crisis, sexual abuse, menarche, body image issues, substance use, relationship failures, technology addiction, career issues.
|
| 41 |
+
- Young Adulthood: Migration, higher education, technology addiction, loss of job, loss of loved ones, workplace stress, pregnancy-related events, marital issues, career issues, parenting, financial issues.
|
| 42 |
+
- Middle Age: Family issues, divorce, death of spouse, physical illness, children's marriage decisions, property issues, health issues, empty nest.
|
| 43 |
+
- Old Age: Retirement, health issues, dependency, caregiving, loss of spouse, stress of unfinished business, issues in interpersonal relationships, isolation, social support, mobility.
|
| 44 |
+
|
| 45 |
+
Immediate Care During Disasters
|
| 46 |
+
1. Common Reactions:
|
| 47 |
+
- Emotional: Sadness, crying spells, anxiety, irritability, mood swings, hopelessness, sensitivity to criticism, anger, aggression.
|
| 48 |
+
- Physical: Tiredness, increased heartbeat, sweating, shaking, weight changes, headaches, body aches, digestive problems.
|
| 49 |
+
- Behavioral: Social withdrawal, changes in sleep or appetite, increased substance use, acting out of character.
|
| 50 |
+
- Cognitive: Difficulty concentrating, racing thoughts, forgetfulness, negative thinking patterns.
|
| 51 |
+
|
| 52 |
+
How to Approach Someone in Crisis
|
| 53 |
+
1. Notice signs and approach with care to establish rapport.
|
| 54 |
+
2. Engage the person in conversation about what could be bothering them.
|
| 55 |
+
3. Allow the person to choose when to open up.
|
| 56 |
+
4. Express concern and willingness to help.
|
| 57 |
+
5. Respect how the person interprets their symptoms.
|
| 58 |
+
6. Give full attention and listen without interrupting.
|
| 59 |
+
7. Avoid giving simple, unrealistic reassurances.
|
| 60 |
+
|
| 61 |
+
Anatomy of a First Aider
|
| 62 |
+
- Face the speaker, keep open posture, lean slightly forward, maintain eye contact.
|
| 63 |
+
- Avoid physical contact unless appropriate, maintain respectful distance.
|
| 64 |
+
- Building skills: undivided concentration, mindful presence, nonverbal cues, active listening.
|
| 65 |
+
- Empathy: Express care, supportive statements, ask questions, paraphrase, acknowledge emotions.
|
| 66 |
+
- Be non-judgmental: Treat with respect, avoid evaluative comments, maintain a neutral facial expression.
|
| 67 |
+
|
| 68 |
+
Clarifying Confidentiality
|
| 69 |
+
- Reflect the speaker's words and feelings to ensure correct understanding.
|
| 70 |
+
- Summarize what has been shared to clarify.
|
| 71 |
+
- Always ask for permission before sharing any information.
|
| 72 |
+
|
| 73 |
+
Probing Skills
|
| 74 |
+
- Use open-ended questions to encourage exploration.
|
| 75 |
+
- Avoid "why" questions, use pauses or silence.
|
| 76 |
+
- Emphasize "I" messages over "you" messages.
|
| 77 |
+
|
| 78 |
+
What Immediate Care is Not
|
| 79 |
+
- It is not obtaining details of traumatic experiences, treating, labeling or diagnosing, counseling, or something only professionals can do.
|
| 80 |
+
|
| 81 |
+
Don'ts in Immediate Care
|
| 82 |
+
- Do not pressure someone to tell their story.
|
| 83 |
+
- Do not interrupt or rush the story.
|
| 84 |
+
- Do not give simple, unrealistic reassurances.
|
| 85 |
+
- Do not give false promises or minimize their loss.
|
| 86 |
+
- Do not touch if unsure, and avoid criticizing existing services in front of people in need.
|
| 87 |
+
|
| 88 |
+
|
Sukoon_Github/langgraph/requirements.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
langchain-openai==0.1.3
|
| 2 |
+
langchain==0.1.16
|
| 3 |
+
langchain-core==0.1.42
|
| 4 |
+
langgraph==0.0.37
|
| 5 |
+
langchainhub==0.1.15
|
| 6 |
+
# pygraphviz==1.12
|
| 7 |
+
llama-index
|
| 8 |
+
fastapi
|
| 9 |
+
uvicorn
|
Sukoon_Github/langgraph/storage/default__vector_store.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"embedding_dict": {"2874d249-b6a1-492e-b3a6-9dfcfe5ceae6": [-0.004392045084387064, 0.01706012152135372, 0.015856821089982986, -0.022702261805534363, -0.020977530628442764, 0.00853006076067686, 0.02387882024049759, 0.0019353076349943876, 0.004736322909593582, -0.008336195722222328, 0.0073334453627467155, 0.026713261380791664, -0.023237060755491257, -0.012547745369374752, -0.018263420090079308, -0.013851320371031761, 0.03922758251428604, -0.013336575590074062, -0.0063072978518903255, -0.0012392319040372968, -0.01972074992954731, 0.019907930865883827, -0.005602030083537102, 0.02369164116680622, -0.0050505176186561584, 0.0035296801943331957, 0.003472857642918825, -0.015910301357507706, -0.012821830809116364, -0.05182212218642235, -0.011317705735564232, -0.0009735031635500491, -0.009706620126962662, -0.02465428039431572, -0.009967335499823093, 0.0033642263151705265, 0.020175330340862274, -0.024213071912527084, 0.025763990357518196, -0.019145840778946877, 0.03267627954483032, -0.004154727794229984, 0.004171440377831459, 0.0006137666059657931, -0.007754600141197443, 0.03342499956488609, -0.0181029811501503, -0.030563822016119957, -0.03125905990600586, 0.01390480063855648, 0.034173719584941864, -0.0164451003074646, -0.022474970668554306, 0.013336575590074062, 0.011438035406172276, -0.0362059623003006, -0.0004286756447982043, 0.00021559126616921276, 0.018423860892653465, 0.018584301695227623, 0.004168097861111164, -0.012942160479724407, -5.6979180953931063e-05, 0.017768731340765953, 0.01566964015364647, 0.004696212708950043, 0.00761421537026763, 0.026459231972694397, 0.00758747523650527, -0.001270985696464777, 0.022368010133504868, 0.036580320447683334, 0.00450234767049551, 0.0022929550614207983, 0.024921681731939316, 0.0010311612859368324, -0.01472037099301815, 0.0004029801639262587, 0.012935475446283817, 0.0026054787449538708, 0.008643705397844315, -0.024373510852456093, -0.04438840225338936, 0.00021454672969412059, 0.008128960616886616, 0.0029464138206094503, 0.0031452926341444254, 0.005805922672152519, -0.005083942785859108, -0.011424665339291096, -0.01973411999642849, 0.007654325105249882, 0.0005657181609421968, 0.014680260792374611, 0.018530821427702904, 0.012808460742235184, 0.008062110282480717, 0.013557180762290955, 0.00488673523068428, -0.04171440005302429, -0.0033475139643996954, 0.01522843074053526, -0.02631216123700142, -0.004492320120334625, 0.006354092620313168, -0.030162721872329712, -0.004214892629534006, -0.006096720229834318, -0.0019286226015537977, 0.005675565451383591, -0.014319270849227905, 0.015268540941178799, -0.028478100895881653, -0.023384131491184235, 0.02879898063838482, 0.027702640742063522, 0.01639162003993988, -0.021084491163492203, -0.007727860473096371, -0.03855908289551735, 0.007701120339334011, 0.015776600688695908, 0.005234355106949806, 0.014185570180416107, 0.005886142607778311, 0.022581931203603745, -0.01808961108326912, -0.006845440249890089, 0.0005189231596887112, -0.010782905854284763, 0.003770340234041214, 0.007821450009942055, 0.017594920471310616, 0.01873137056827545, -0.01565627008676529, 0.038986921310424805, 0.010047554969787598, -0.005842690356075764, -0.02284933067858219, -0.01976086013019085, 0.03513636067509651, 0.028424620628356934, 0.0011080388212576509, -0.005010407883673906, -0.012721555307507515, 0.022795850411057472, 0.008022000081837177, 0.012922105379402637, 0.004007657524198294, 0.024881571531295776, 0.04503016173839569, -0.011504885740578175, -0.02526930160820484, -0.02633890137076378, -0.018624410033226013, 0.01811635121703148, -0.02385208010673523, -0.012795090675354004, -0.015041250735521317, -0.010903235524892807, 0.012828515842556953, 0.007834820076823235, -0.002000486245378852, 0.0247345007956028, 0.01643173024058342, 0.020228810608386993, 0.0005519303376786411, -0.0002676089061424136, -0.007460460532456636, -0.009352315217256546, -0.015094731003046036, 0.046420641243457794, -0.014559930190443993, 0.029066381976008415, -0.011952780187129974, 0.008790775202214718, 0.014867440797388554, 0.02783634141087532, -0.011210745200514793, -0.010756165720522404, -0.0237050112336874, 0.007366870529949665, 0.025737250223755836, 0.029200080782175064, -0.020897310227155685, -0.022648781538009644, 0.013035750947892666, -1.3448340723698493e-05, 0.011304335668683052, 7.640746480319649e-05, 0.015455720946192741, 0.0327564999461174, 0.015509200282394886, -0.00018352414190303534, -0.6207958459854126, -0.03112536109983921, 0.017889060080051422, -0.0016411675605922937, -0.00824260525405407, 0.012955530546605587, 0.010662575252354145, -0.00086905003990978, -0.006892235483974218, 0.03861256316304207, 0.009913855232298374, 0.020843829959630966, -0.02555007115006447, -0.02219420112669468, 0.011464775539934635, -0.004953585099428892, -0.018477341160178185, -0.0047095827758312225, -0.009559550322592258, -0.01882496103644371, -0.009131710045039654, 0.03222170099616051, -0.016137590631842613, -0.004445525351911783, -0.00046753219794481993, 0.008576855063438416, 0.0036767502315342426, 0.00018404641014058143, 0.013684195466339588, 0.050404902547597885, 0.006464395206421614, 0.005695620086044073, 0.024868201464414597, 0.01390480063855648, 0.03719533979892731, -0.030002281069755554, -0.006674972828477621, 0.017394371330738068, 0.01901214011013508, 0.0424363799393177, -0.024440361186861992, -0.01470700092613697, 0.02628542110323906, -0.013349945656955242, -0.000879077531863004, 0.002172625157982111, 0.018437230959534645, -0.006705055478960276, -0.004859995096921921, 0.00760084530338645, 0.0017280725296586752, -0.0069323452189564705, -0.016846200451254845, 0.005929595325142145, 0.022608671337366104, -0.020255550742149353, 0.019105730578303337, -0.029093122109770775, 0.008743979968130589, 0.001657044398598373, -0.011371185071766376, -0.0025185737758874893, -0.022408120334148407, -0.03698142245411873, -0.01808961108326912, 0.0396554209291935, -0.0002822323585860431, -0.016685761511325836, 0.024012520909309387, -0.008062110282480717, 0.024961791932582855, 0.03278324007987976, -0.023557940497994423, -0.012942160479724407, 0.0006463559693656862, 0.012614595703780651, 0.0035664476454257965, -0.006748507730662823, -0.011678695678710938, 0.026633040979504585, 0.01874474063515663, -0.013403425924479961, 0.0011773956939578056, -0.01875811070203781, 0.014760480262339115, -0.005274465307593346, 0.009867059998214245, -0.012193440459668636, 0.001682948786765337, -0.01886507123708725, -0.002137528732419014, 0.006511190440505743, 0.004448867868632078, -0.034708522260189056, -0.022595301270484924, 0.026044761762022972, -0.00631732540205121, -0.011565050110220909, 0.030135981738567352, -0.010802960023283958, 0.024373510852456093, -0.0004274222010280937, -0.029360521584749222, 0.030162721872329712, -0.01517495047301054, -0.00897127017378807, -0.02544311061501503, 0.010401860810816288, 0.0555657222867012, -0.01564290001988411, -0.009405795484781265, 0.014586670324206352, 0.018290160223841667, -0.014466340653598309, 0.026646411046385765, -0.015027880668640137, 0.005207615438848734, -0.0026405751705169678, -0.010896550491452217, -0.019413240253925323, 0.030644040554761887, -0.02064328081905842, 0.024787981063127518, -0.0065980954095721245, 0.034842222929000854, 0.0003227601700928062, -0.001830018823966384, 0.0006016500410623848, -0.01470700092613697, -0.0036767502315342426, 0.012915420345962048, -0.02710099145770073, 0.03371914103627205, -0.012073110789060593, 0.018397120758891106, -0.0028060288168489933, 0.03516310080885887, -0.015348760411143303, 0.0064811077900230885, -0.027622420340776443, -0.01814309135079384, -0.00983363576233387, 0.04190158098936081, 0.01640499010682106, -0.036366403102874756, -0.01724730059504509, -0.011946095153689384, 0.016712499782443047, -0.00907823070883751, -0.01879822090268135, -0.04112612083554268, -0.03377262130379677, -0.017648400738835335, 0.029226820915937424, -0.006447682622820139, -0.035002660006284714, -0.005632112734019756, -0.013704250566661358, -0.01795591041445732, -0.03858582302927971, -0.003947492688894272, 0.035938560962677, -0.01315608061850071, 0.00019532734586391598, 0.0037402575835585594, -0.011344445869326591, 0.0021843237336724997, 0.02470776066184044, -0.019333021715283394, -0.03914736211299896, -0.028371140360832214, -0.02877224050462246, -0.009599660523235798, 0.02049621008336544, 0.009626400656998158, 0.02449384145438671, -0.026780111715197563, 0.0076743802055716515, -0.012033000588417053, 0.015830080956220627, -0.00979352556169033, -0.011531625874340534, 0.012440785765647888, -0.02056306041777134, 0.0031670189928263426, 0.006999195087701082, 0.024935051798820496, -0.029146600514650345, -0.009419165551662445, 0.010883180424571037, 0.007480515167117119, 0.02555007115006447, -0.012748295441269875, 0.03278324007987976, -0.0028929337859153748, 0.04016348347067833, -0.01308923028409481, 0.00982026569545269, -0.010609094984829426, 0.02698066085577011, 0.015322020277380943, -0.004355277866125107, 0.031579941511154175, -0.004940215032547712, 0.03200777992606163, -0.0261918306350708, 0.027542201802134514, -0.0138914305716753, 0.02452058158814907, -0.014078610576689243, -0.00554855028167367, -0.026405751705169678, -0.0017865663394331932, -0.018597669899463654, -0.022675521671772003, 0.012033000588417053, -0.006283900234848261, 0.044682543724775314, -0.03387958183884621, 0.019867820665240288, 0.02121818996965885, -0.0017949226312339306, 0.0035397077444940805, -0.005705647636204958, 0.010548930615186691, 0.024012520909309387, 0.020188700407743454, 0.01191267091780901, -0.012287030927836895, -0.00617694016546011, 0.022448230534791946, 0.0004658609686885029, 0.020843829959630966, 0.006397545337677002, 0.016592171043157578, 0.02206050045788288, 0.02056306041777134, -0.0205229502171278, 0.03179386258125305, -0.0071730054914951324, -0.020282290875911713, -0.003305732738226652, 0.010916605591773987, -0.00897127017378807, -0.0038104502018541098, 0.006347407586872578, 0.04120634123682976, 0.019867820665240288, -0.0010378463193774223, -0.006511190440505743, -0.00822923518717289, -0.0022160776425153017, 0.003947492688894272, -0.00903812050819397, -0.008523375727236271, 0.026512710377573967, 0.0011422993848100305, -0.006400887854397297, 0.041473742574453354, 0.022327901795506477, -0.01572312042117119, -0.001819991273805499, 0.018504081293940544, 0.0021525700576603413, -0.009546180255711079, -0.025189081206917763, 0.002513560000807047, -0.02526930160820484, -0.01565627008676529, -0.015482461079955101, -0.011397925205528736, -0.004562512505799532, 0.003247238928452134, -0.0011523269349709153, 0.019974781200289726, 0.02061654068529606, 0.02129841037094593, -0.020041631534695625, 0.02786308154463768, -0.008603595197200775, -0.008469895459711552, -0.03879974037408829, 0.013811210170388222, 0.0006530409445986152, -0.00899801030755043, -0.010074295103549957, -0.017447851598262787, 0.016030630096793175, -0.009439220651984215, -0.011444720439612865, -0.008142330683767796, 0.013022380881011486, -0.0016027288511395454, 0.006303955335170031, 0.0026405751705169678, -0.006651575211435556, 0.011498200707137585, 0.023477720096707344, 0.007126210257411003, 0.003387623932212591, 0.00512405252084136, 0.0005477521917782724, -0.033237822353839874, -0.01720719039440155, -0.01625792123377323, -0.011311020702123642, -0.015736490488052368, 0.006420942954719067, -0.029948800802230835, -0.03631292283535004, 0.0021024325396865606, 0.0009684893884696066, -0.01191267091780901, -0.014626780524849892, 0.021752990782260895, 0.006852125283330679, -0.013289780355989933, 0.006250475067645311, 0.015763230621814728, -0.0029230164363980293, -0.006447682622820139, -0.035831600427627563, -0.018570931628346443, -0.01311597041785717, 0.09514092653989792, 0.012521005235612392, -2.2992744561634026e-05, 0.0026405751705169678, -0.02121818996965885, -0.013202875852584839, 0.0035296801943331957, -0.011411295272409916, 0.004629362840205431, -0.0021358574740588665, 0.008376304991543293, -0.002384873805567622, 0.020309031009674072, -0.007988574914634228, 0.02799678035080433, 0.02620520070195198, -0.004532430320978165, -0.022648781538009644, -0.004238290246576071, -0.011444720439612865, 0.02941400185227394, -0.01518832053989172, 0.03596530109643936, 0.020910680294036865, 0.009566235356032848, -0.0073401303961873055, 0.019159210845828056, 0.007961835712194443, -0.004569197539240122, -0.02212735079228878, -0.0048800501972436905, 0.028183961287140846, 0.015896931290626526, 0.006537930108606815, -0.011003510095179081, 0.000581594998948276, 0.014934290200471878, 0.025897691026329994, 0.017701881006360054, -0.02623194083571434, 0.01893192157149315, 0.01812972128391266, 0.006080007646232843, -0.010535560548305511, 0.012574485503137112, -0.002326379995793104, -0.000761254399549216, 0.01873137056827545, -0.005708990152925253, -0.002846138784661889, 0.021084491163492203, 0.022381380200386047, -0.037355780601501465, -0.015094731003046036, 0.019252801313996315, 0.01188593078404665, -0.0036700651980936527, -0.00826266035437584, -0.01653869077563286, -0.011411295272409916, -0.011284280568361282, -0.025924431160092354, -0.016565430909395218, -0.0030349900480359793, -0.015495830215513706, -0.02708762139081955, 0.006634862627834082, 0.0341469831764698, 0.018490711227059364, 0.006374147720634937, 0.010468710213899612, -0.020202070474624634, 0.0055050975643098354, 0.015776600688695908, -0.030857961624860764, -0.005896170157939196, 0.009452590718865395, 0.013443535193800926, 0.023598050698637962, 0.028451360762119293, 0.0023213664535433054, -0.020268920809030533, 0.02128504030406475, -0.0006300612585619092, -0.0009141737828031182, -0.009298834949731827, 0.009185190312564373, -0.009559550322592258, -0.001898540067486465, 0.04757046326994896, -0.025670401751995087, 0.021565811708569527, 0.00950607005506754, -0.018410490825772285, -0.012801775708794594, 0.05150124058127403, -0.00853674579411745, -0.00020995078375563025, 0.007460460532456636, -0.026459231972694397, 0.001594372559338808, -0.05658184364438057, -0.046179983764886856, -0.006728452630341053, 0.019386500120162964, -0.016030630096793175, 0.002114131348207593, 0.013370000757277012, 0.018477341160178185, -0.03267627954483032, 0.026459231972694397, -0.024975160136818886, 0.006658260244876146, -0.001585180638357997, 0.004328537732362747, 0.010923290625214577, 0.01233382523059845, 0.03259606286883354, 0.007493885233998299, -0.034173719584941864, 0.006681657861918211, -0.020763611420989037, 0.03104514069855213, 0.002578738844022155, -0.016177700832486153, 0.02788982167840004, -0.010101035237312317, -0.021512331441044807, -0.010495450347661972, -0.01624455116689205, -0.003686777548864484, 0.029734881594777107, -0.0017999362898990512, -0.027729380875825882, -0.04281074181199074, -0.010435285046696663, -0.0026773426216095686, 0.024948421865701675, 0.0015233444282785058, -0.015843451023101807, -0.009927225299179554, -0.02303651161491871, -0.012734925374388695, 0.0022127351257950068, 0.041366782039403915, -0.027649160474538803, -0.02294292114675045, 0.023344021290540695, 0.013476960361003876, 0.012734925374388695, -0.02540300041437149, -0.001470700022764504, -0.037302300333976746, 0.01873137056827545, -0.0027792889159172773, -0.02288944087922573, 0.02119145169854164, 0.01233382523059845, 0.022675521671772003, 0.007915040478110313, 0.02938726171851158, 0.0001194943833979778, -0.008623650297522545, 0.023437611758708954, 0.0018834988586604595, 0.006036555394530296, -0.0018367038574069738, -0.024868201464414597, 0.018276790156960487, 0.010348380543291569, 0.029307041317224503, 0.00821586512029171, 0.026552820578217506, -0.0008164056343957782, 0.004652759991586208, 0.00977347046136856, -0.0017899088561534882, -0.03513636067509651, -0.010468710213899612, -0.05840016156435013, -0.01472037099301815, 0.0006166912498883903, -0.012922105379402637, 0.004552485421299934, -0.02139200083911419, -0.0026255338452756405, 0.01965390145778656, -6.920020041434327e-06, 0.01799602061510086, 0.002531943842768669, -0.0022010363172739744, -0.011244170367717743, -0.007293335162103176, 0.008369619958102703, -0.002627205103635788, -0.016084110364317894, -0.002140871249139309, -0.03018946200609207, 0.008870995603501797, 0.01155836507678032, 0.0054516177624464035, 0.029948800802230835, -0.0023715037386864424, -0.020750241354107857, -0.024841461330652237, 0.018423860892653465, -0.026111610233783722, -0.00411127507686615, 0.014065240509808064, 0.0014548231847584248, 0.010682630352675915, -0.0016319756396114826, -0.014479710720479488, -0.009258725680410862, 0.000908324436750263, -0.008870995603501797, 0.009385740384459496, 0.020683391019701958, -0.006340722553431988, -0.013323205523192883, 0.006223735399544239, -0.028103740885853767, 0.011651955544948578, -0.013837950304150581, 0.040671542286872864, 0.022688891738653183, 0.02389219030737877, 0.00900469534099102, 0.021044380962848663, 0.0059095402248203754, 0.023290541023015976, 0.01878485083580017, 0.012621280737221241, 4.569824341160711e-06, 0.011792340315878391, 0.015749860554933548, 0.027261430397629738, -0.015576050616800785, -0.035938560962677, 0.010167885571718216, 0.03537702187895775, -0.003045017598196864, -0.016552060842514038, -0.009211930446326733, -0.04240964353084564, -0.003827162552624941, 0.02057643048465252, 0.004662787541747093, 0.016084110364317894, -0.018597669899463654, -0.008610280230641365, 0.036446619778871536, -0.027568941935896873, 0.043826863169670105, 0.001068764366209507, 0.0027909877244383097, -0.0138914305716753, -0.0032622800208628178, -0.008857625536620617, 0.005749100353568792, 0.002257858868688345, 0.007981889881193638, -0.024239810183644295, 0.03021620213985443, 0.00903143547475338, -0.0033224450889974833, 0.001453987555578351, -0.011137210763990879, 0.0059028551913797855, 0.02949422039091587, 0.0082225501537323, -0.0152016906067729, 0.016565430909395218, -0.026860330253839493, 0.00017840594227891415, -0.0205898005515337, 0.012240235693752766, -0.004432155285030603, -0.043826863169670105, -0.010976770892739296, 0.0170734915882349, 0.03358544036746025, -0.015108101069927216, -0.00451571773737669, -0.015883561223745346, -0.02124493010342121, 0.018570931628346443, -0.014760480262339115, 0.002941400045529008, 0.001072106882929802, -0.02062991075217724, -0.007246540393680334, 0.007373555097728968, -0.015402240678668022, -0.006674972828477621, 0.002587095135822892, -0.008503320626914501, 0.028317661955952644, 0.013209560886025429, 0.0033608837984502316, -0.009980705566704273, 0.0180361308157444, -0.02540300041437149, 0.013717620633542538, 0.0009258725331164896, 0.0011790669523179531, 0.005311232525855303, 0.0012818487593904138, -0.04762394353747368, -0.024935051798820496, 0.003021620213985443, -0.006728452630341053, -0.019172580912709236, 0.004161412827670574, 0.01718045026063919, 0.007513940334320068, -0.012380620464682579, 0.008590225130319595, -0.041447002440690994, 0.01307586021721363, -0.0277828611433506, -0.019199321046471596, 0.037248820066452026, -0.01973411999642849, 0.0016745926113799214, -0.014091980643570423, 0.04494994133710861, 0.007373555097728968, -0.02879898063838482, -0.026780111715197563, -0.014265790581703186, 0.008730609901249409, -0.026432491838932037, -0.015856821089982986, -0.01795591041445732, -0.011384555138647556, -0.016819460317492485, 0.010769535787403584, 0.0049301874823868275, 0.004706240259110928, 0.005996445193886757, 0.017514700070023537, 0.014439600519835949, -0.008349565789103508, -0.009472645819187164, -0.004776432644575834, -0.010428600013256073, 0.008449840359389782, -0.016191070899367332, 0.00631732540205121, -0.02621857076883316, 0.03834516182541847, 0.01472037099301815, -0.01799602061510086, -0.04516386240720749, -0.021565811708569527, -0.04412100091576576, -0.01317613571882248, -0.008810830302536488, 0.0032923626713454723, 0.01726067066192627, 0.0020857201889157295, 0.017594920471310616, 0.02710099145770073, -0.012781720608472824, 0.013510385528206825, -0.020309031009674072, 0.008523375727236271, -0.0005256081349216402, 0.004067822825163603, 0.02965466119349003, 4.703002196038142e-05, -0.003502940060570836, -0.004923502914607525, -0.02452058158814907, -0.0011113813379779458, -0.01058235578238964, 0.04088546335697174, -0.010829700157046318, -0.005421535111963749, 0.014091980643570423, -0.0012601225171238184, -0.0004008911200799048, -0.005398137494921684, -0.0030199489556252956, -0.01628466136753559, 0.00027074251556769013, 0.02054969035089016, -0.0014005075208842754, -0.02882572077214718, -0.0031803888268768787, 0.021846581250429153, 0.002361476421356201, 0.025242561474442482, -0.01961379125714302, -0.002797672525048256, 0.00044455251190811396, -0.04898768290877342, 0.018169831484556198, 0.0065980954095721245, 0.004218235146254301, 0.004251660313457251, -0.01306249015033245, 0.00226788641884923, -0.015736490488052368, 0.014346010982990265, -0.01391817070543766, -0.027234690263867378, 0.02617846056818962, -0.021057751029729843, -0.0009099956369027495, -0.005702305119484663, -0.002528601326048374, -0.014961030334234238, 0.009740045294165611, -0.02139200083911419, 0.012086480855941772, -0.028986161574721336, 0.009666510857641697, -0.006858810316771269, -0.04016348347067833, -0.005227670073509216, -0.007767970208078623, -0.009927225299179554, -0.004321852698922157, -0.025670401751995087, -0.002660630038008094, -0.01472037099301815, 0.014158830977976322, 0.015816710889339447, -0.0021525700576603413, -0.004031055141240358, 0.01473374105989933, 0.025229191407561302, 0.02143211103975773, 0.024132851511240005, 0.19937345385551453, -0.012861940078437328, 0.006260502617806196, -0.0076743802055716515, -0.028103740885853767, -0.0010729425121098757, 0.007928410544991493, -0.011351130902767181, -0.00037686689756810665, 0.03513636067509651, -0.0029547701124101877, 0.007941780611872673, -0.03444112092256546, 0.012246920727193356, -0.020108480006456375, 0.003205457702279091, -0.019948041066527367, -0.024052631109952927, -0.022595301270484924, -0.011772285215556622, -0.024908311665058136, 0.010341695509850979, 0.003907382488250732, 0.009472645819187164, 0.02294292114675045, 0.018557561561465263, -0.008590225130319595, 0.0020372539293020964, 0.02855832129716873, -0.005398137494921684, -0.006424285471439362, -0.00577918253839016, -0.0024851488415151834, 0.02797004207968712, -0.009599660523235798, -0.005685592535883188, 0.010943345725536346, -0.010655890218913555, 0.009940595366060734, -0.004198180045932531, 0.016070740297436714, -0.004702897742390633, 0.0031837313435971737, -0.0005937115638516843, 0.008276030421257019, 0.029226820915937424, 0.0038171352352946997, -0.03882648050785065, -0.001751470030285418, 0.025616921484470367, -0.03997630253434181, -0.008657075464725494, -0.009185190312564373, 0.015428980812430382, -0.006123460363596678, 0.0037202027160674334, -0.020710131153464317, 0.012561115436255932, -0.0071663204580545425, 0.02962792105972767, -0.009760100394487381, 0.007547365501523018, -0.004622677806764841, 0.039762381464242935, -0.025255931541323662, 0.01811635121703148, 0.0059061977081000805, -0.008496635593473911, -0.009338945150375366, -0.006424285471439362, -0.02288944087922573, -0.0008510840707458556, -0.003914067521691322, 0.007186375092715025, -0.012046370655298233, -0.018383750692009926, 0.030055761337280273, 0.01438612025231123, 0.010094350203871727, 0.03131254017353058, -0.017755361273884773, -0.01731415092945099, -0.018637780100107193, -0.0014782206853851676, -0.007032620254904032, -0.013002325780689716, 0.021739620715379715, 0.005107340402901173, -0.03387958183884621, -0.008743979968130589, 0.015856821089982986, -0.009699935093522072, 0.002836111467331648, 0.005097312852740288, 0.00658138282597065, 0.005464987829327583, 0.01263465080410242, 0.01811635121703148, -0.0054549602791666985, -0.0008857625653035939, 0.004539115354418755, 0.07513940334320068, -0.012126590125262737, -0.0052176425233483315, -0.005712332669645548, -0.017461219802498817, 0.0006434312672354281, 0.009907170198857784, -0.010441970080137253, -0.011204060167074203, 0.0021542413160204887, -0.018517451360821724, -0.016806090250611305, -0.03034990094602108, -0.020750241354107857, 0.007881615310907364, -0.008596910163760185, -0.035778120160102844, 0.0008088850299827754, -0.016819460317492485, 0.010147830471396446, -0.004351935349404812, 0.004619335290044546, 0.027488721534609795, -0.016966531053185463, -0.0262586809694767, -0.02530941180884838, -0.008503320626914501, -0.002918002661317587, -0.0065245600417256355, 0.0070526753552258015, -0.016124220564961433, 0.024921681731939316, 0.006207022815942764, -0.017594920471310616, 0.01978760026395321, 0.042275942862033844, -0.020964160561561584, -0.010535560548305511, 0.019279541447758675, 0.003944150172173977, -0.007086100522428751, -0.0009066531783901155, 0.0015935369301587343, 0.01653869077563286, -0.021592549979686737, 0.01978760026395321, 0.014091980643570423, -0.014827330596745014, -0.01625792123377323, -0.024360140785574913, 0.006611465476453304, 0.0015342076076194644, -0.015014510601758957, -0.0068788654170930386, -0.02706088125705719, 0.0029547701124101877, -0.02472113072872162, 0.005652167834341526, 0.006731795147061348, -0.017020011320710182, 0.010682630352675915, -0.008797460235655308, -0.004970297683030367, 0.00979352556169033, 0.003756970167160034, -0.16824808716773987, 0.007747915107756853, -0.0031937588937580585, 0.013336575590074062, 0.012494265101850033, 0.004776432644575834, -0.011317705735564232, -0.00553518021479249, -0.0038940126542001963, 0.006634862627834082, 0.0010637507075443864, -0.04521734267473221, -0.015402240678668022, 0.0032071289606392384, -0.003185402601957321, -0.01564290001988411, -0.009673194959759712, 0.01184582058340311, 0.014051870442926884, 0.008750665001571178, 0.006725110113620758, -0.012728240340948105, 0.013329890556633472, 0.002551998943090439, 0.0009125025244429708, -0.009726675227284431, -0.04093893989920616, 0.006557985208928585, 0.0025152312591671944, -0.025790730491280556, -0.026499340310692787, -0.028077000752091408, 0.0013052462600171566, 0.009465960785746574, -0.002897947560995817, -0.006237105466425419, 0.007734545506536961, -0.0005205944180488586, -0.027675900608301163, 0.009980705566704273, 0.03299716114997864, 0.00948601495474577, -0.007948465645313263, 0.007467145100235939, -0.00021893375378567725, 0.009125025011599064, 0.0035597626119852066, -0.033291302621364594, -0.01973411999642849, -0.00264558894559741, -0.01720719039440155, -0.023544570431113243, -0.008723925799131393, 0.025857580825686455, 0.01102356519550085, 0.00024149563978426158, 0.017675140872597694, 0.010000760667026043, -0.007039305288344622, -0.008643705397844315, -0.013757730834186077, -0.022742370143532753, 0.03756970167160034, 0.010809645056724548, 0.0017213876126334071, -0.035002660006284714, -0.009706620126962662, 0.01894529163837433, -0.02866528183221817, 0.016966531053185463, 0.007286650128662586, 0.0026221913285553455, 0.0023113389033824205, -0.02869202196598053, 0.00038083610706962645, 0.00173810007981956, -0.025122230872511864, 0.0032338688615709543, -0.0026506027206778526, 0.01636487990617752, -0.005545207764953375, 0.012393990531563759, -0.04246312007308006, -0.017581550404429436, -0.008951215073466301, 0.0036065576132386923, 0.007928410544991493, 0.02304988168179989, -0.0006639040657319129, 0.007059360388666391, 0.014827330596745014, -0.03355870023369789, -0.027461981400847435, -0.014452970586717129, 0.009439220651984215, 0.020108480006456375, -0.00756073510274291, -0.014947660267353058, -0.010649205185472965, -0.022474970668554306, 0.02624531090259552, 0.024039261043071747, 0.009933910332620144, -0.005628770217299461, 0.006845440249890089, 0.009272095747292042, 0.0007340965676121414, -0.012226865626871586, 0.017100229859352112, -0.0044756075367331505, 0.0020055000204592943, 0.028050260618329048, 0.0033124175388365984, -0.007320075295865536, 0.011685380712151527, 0.028932681307196617, 0.0028210701420903206, -0.03369240090250969, -0.003325787605717778, -0.003690120065584779, 0.052116263657808304, -0.011377870105206966, -0.014172201044857502, 0.006394202820956707, -0.020977530628442764, 0.001402178779244423, -0.10011456161737442, -0.006217050366103649, 0.03264954313635826, 0.00984700582921505, 0.013343260623514652, 0.03794405981898308, -0.020095109939575195, 0.010622465051710606, -0.010869810357689857, 0.020883940160274506, -0.043051403015851974, -0.013677510432898998, 0.01233382523059845, -0.0163782499730587, 0.015255170874297619, -0.012180070392787457, 0.0008640362648293376, -0.014198940247297287, -0.02295629121363163, 0.002424983773380518, -0.005224327556788921, -0.0238387119024992, -0.021097861230373383, -0.01804950088262558, 0.010094350203871727, 0.00553518021479249, -0.023584680631756783, -0.009766785427927971, 0.0036032150965183973, 0.030109241604804993, -0.015469091013073921, -0.018397120758891106, 0.011538310907781124, -0.004816542845219374, 0.0035731326788663864, -0.007032620254904032, -0.006093377713114023, -0.005645482800900936, 0.018343640491366386, -0.02802352048456669, -0.0016069069970399141, -0.004318510182201862, 0.029841842129826546, -0.014827330596745014, 0.03018946200609207, -0.010649205185472965, 0.006578040309250355, 0.011204060167074203, -0.018517451360821724, -0.015041250735521317, -0.022662151604890823, -0.006601437926292419, -0.04687522351741791, 0.003633297747001052, 0.030483601614832878, 0.0037268877495080233, 0.030483601614832878, -0.011150580830872059, -0.004706240259110928, -0.01393154077231884, -0.005461645312607288, 0.007420350331813097, -0.048051781952381134, 0.032462362200021744, 0.042142242193222046, 0.00408453494310379, -0.028264181688427925, 0.01026816014200449, 0.02712773159146309, -0.008616965264081955, -0.016993271186947823, 0.03254258260130882, -0.013269725255668163, 0.012393990531563759, -0.03334478288888931, -0.010889865458011627, -0.006698370445519686, -0.010869810357689857, -0.01234719529747963, -0.014519820921123028, -0.026031391695141792, -0.015108101069927216, 0.001643674448132515, -0.014961030334234238, 0.004315167665481567, -0.014439600519835949, -0.0034093500580638647, -0.022795850411057472, 0.008623650297522545, -0.02046946994960308, 0.021726250648498535, 0.01978760026395321, 0.02214072085916996, 0.026379011571407318, 0.014292530715465546, 0.014493080787360668, 0.0032372113782912493, -0.006273872684687376, 0.004575882572680712, 0.013617345131933689, 0.012414045631885529, 0.006497820373624563, -0.05233018100261688, 0.0030132639221847057, -4.415756120579317e-05, 0.0004984503611922264, 0.0034661726094782352, -0.017461219802498817, 0.007774655241519213, -0.007380240131169558, 0.01723393052816391, 0.020175330340862274, -0.03543050214648247, 0.04914812371134758, 0.008670445531606674, 0.01800939068198204, -0.026820221915841103, -0.010381805710494518, 0.016859570518136024, -0.008128960616886616, 0.018557561561465263, -0.010996825061738491, -0.001963718794286251, -0.02877224050462246, 0.005675565451383591, -0.006514532957226038, 0.006758535280823708, 0.021565811708569527, 0.005277807824313641, 0.025737250223755836, -0.01264133583754301, 0.0018901837756857276, 0.015442350879311562, -0.014800590462982655, 0.0038539026863873005, 0.035564202815294266, -0.008436470292508602, -0.032301921397447586, 0.016044000163674355, 0.028478100895881653, -0.0028444675263017416, 0.03366566076874733, -0.048773761838674545, -0.019226061180233955, 0.004749692510813475, -0.01901214011013508, -0.027328280732035637, -0.004689527675509453, -0.03307738155126572, 0.017046751454472542, 0.017755361273884773, -0.019279541447758675, 0.04192832112312317, 0.01881159096956253, -0.038077760487794876, -0.016097480431199074, -0.004244975280016661, 0.00039817532524466515, 0.0007178019150160253, 0.018209941685199738, 0.014760480262339115, -0.010943345725536346, 0.029868580400943756, 0.010348380543291569, 0.012948845513164997, 0.014974400401115417, 0.03789058327674866, -0.00225451635196805, -0.001352876890450716, -0.010883180424571037, -0.001277670729905367, -0.010134460404515266, -0.017354261130094528, 2.0603380107786506e-05, 0.006126802880316973, -0.0026706575881689787, 0.025964541360735893, 0.015415610745549202, -0.005184217821806669, 0.021712880581617355, -0.010682630352675915, 0.008102220483124256, 0.01023473497480154, 0.009733360260725021, -0.013597290962934494, 0.008088850416243076, 0.014305900782346725, 0.003660037647932768, -0.0009810237679630518, 0.01562952995300293, 0.0023247087374329567, -0.0237718615680933, -0.013430165126919746, -0.0049936953000724316, 0.020148590207099915, 0.027408501133322716, 0.028531581163406372, 0.007353500463068485, -0.013436850160360336, 0.019921300932765007, 0.024935051798820496, -0.00010262519936077297, 0.021699510514736176, -0.012835200875997543, -0.012721555307507515, -0.028986161574721336, -0.019159210845828056, -0.021833211183547974, -0.015896931290626526, -0.03412024304270744, -0.014225680381059647, 0.023357391357421875, -0.012561115436255932, -0.010782905854284763, -0.0069323452189564705, 0.015883561223745346, -0.042917702347040176, 0.023130100220441818, 0.026018021628260612, -0.01711359992623329, 0.0008310290868394077, 0.03305064141750336, -0.007761285174638033, 0.00756073510274291, 0.01720719039440155, -0.0163782499730587, 0.02375849150121212, 0.0052143000066280365, -0.002699068747460842, 0.018316900357604027, -0.005388110410422087, 0.014787220396101475, 0.010141145437955856, 6.0354323068168014e-06, -0.04698218032717705, -0.01800939068198204, -0.008550114929676056, -0.016150960698723793, 0.011478145606815815, 0.01566964015364647, 0.0220471303910017, 0.04813200235366821, 0.003058387665078044, 0.00014884570555295795, 0.0018617726163938642, 0.00760084530338645, 0.005337972659617662, 0.001055394415743649, -0.001843388774432242, -0.002155912574380636, -0.0070526753552258015, 0.007300020195543766, -0.024239810183644295, 0.01631140150129795, -0.04569866135716438, -0.0073401303961873055, 0.005662195384502411, -0.006283900234848261, 0.02623194083571434, 0.004983667749911547, -0.003365897573530674, 0.016832830384373665, 0.015241800807416439, 0.01647184044122696, 0.008931159973144531, -0.030777741223573685, 0.00896458514034748, 0.0007988575380295515, -0.019988151267170906, -0.024373510852456093, -0.009171820245683193, 0.02949422039091587, -0.006344065070152283, -0.021592549979686737, -0.02855832129716873, 0.003130251308903098, 0.0019854451529681683, -0.01308254525065422, -0.0011280938051640987, 0.012808460742235184, 0.02136526070535183, -0.03187408298254013, 0.02462754026055336, -0.01645847037434578, -0.019841080531477928, -0.03457482159137726, 0.001988787669688463, -0.00277093262411654, -0.044361662119627, -0.034868963062763214], "f2a3e62e-796a-4d57-9d89-92d937e98c08": [-0.009015240706503391, 0.007600816432386637, 0.016712183132767677, -0.024979015812277794, -0.005760691128671169, 0.018648434430360794, 0.0022297787945717573, 0.006272218190133572, -0.00926242209970951, -0.03309479355812073, 0.016217822209000587, 0.020941725000739098, -0.018799489364027977, 0.005104974843561649, -0.013917664997279644, -0.012455176562070847, 0.03954896330833435, -0.013794073835015297, 0.005781289655715227, -0.00899464264512062, -0.012407113797962666, 0.029222289100289345, -0.007518422789871693, 0.003920565824955702, -0.022369882091879845, -0.004926455207169056, -0.002619432285428047, -0.026063865050673485, -0.01553120743483305, -0.039878539741039276, -0.005111841019243002, -0.004988250322639942, -0.001386101939715445, -0.030787769705057144, -0.011823492124676704, -0.0056885965168476105, 0.006138328462839127, -0.01686323806643486, 0.024992747232317924, -0.008768060244619846, 0.01678084395825863, -0.007065257523208857, -0.009839178062975407, -0.006001005880534649, 8.840154623612761e-05, 0.03537435084581375, -0.01212560199201107, -0.018112875521183014, -0.011844090186059475, 0.01084850076586008, 0.03790108859539032, -0.007113320287317038, -0.020200181752443314, 0.005190801341086626, 0.014281569980084896, -0.010388469323515892, 0.026118794456124306, 0.011157476343214512, 0.00819130428135395, 0.017192812636494637, -0.0025713692884892225, -0.004459557589143515, 0.004171179607510567, 0.023633252829313278, 0.004840628243982792, -0.00817070621997118, 0.0008033383055590093, 0.017014293000102043, 0.019142797216773033, 0.0017474325140938163, -0.006886737886816263, 0.021463552489876747, 0.015146703459322453, 0.0036047231405973434, 0.03303986415266991, -0.009372279979288578, -0.002216046443209052, 0.004044156055897474, 0.004236408043652773, -0.0004441533819772303, 0.0012075823033228517, -0.024374794214963913, -0.0402081124484539, 0.008596406318247318, 0.0157921202480793, 0.018620969727635384, -0.0022005976643413305, -0.0009930154774338007, -0.0033712745644152164, -0.022946638986468315, 0.0034347863402217627, 0.005139305256307125, 0.02526739239692688, 0.019074134528636932, 0.00031519870390184224, 0.022287487983703613, 0.009324217215180397, 0.033451832830905914, 0.0013586373534053564, -0.024869157001376152, -0.0126954922452569, 0.021944181993603706, -0.02427866868674755, -0.010354137979447842, -0.022548401728272438, -0.004329100716859102, 0.01904667168855667, -0.013340909034013748, -0.002008345676586032, 0.0007758737774565816, -0.01108194887638092, 0.011802894063293934, -0.02154594473540783, -0.024374794214963913, 0.02530859038233757, 0.020735740661621094, 0.019637158140540123, -0.016629789024591446, -0.024333598092198372, -0.020474828779697418, 0.02475929819047451, -0.0006334013887681067, 0.0006866139592602849, -0.009042705409228802, 0.019760750234127045, 0.007381099741905928, -0.012290389277040958, 0.0004432951391208917, -0.030211012810468674, -0.021422354504466057, 0.01474846713244915, 0.017288940027356148, 0.019074134528636932, 0.018195269629359245, -0.01904667168855667, 0.024058952927589417, 0.008314894512295723, 0.0011372043518349528, -0.006234454456716776, -0.011095681227743626, 0.018717095255851746, 0.028590604662895203, 0.0021302197128534317, 0.007999052293598652, 0.0014436058700084686, 0.003989227116107941, 0.016107963398098946, 0.00897404458373785, 0.005383053328841925, 0.008033382706344128, 0.03117227368056774, -0.01680830866098404, -0.022026576101779938, -0.03702222555875778, -0.013189854100346565, 0.013965727761387825, -0.008369823917746544, 0.0030605816282331944, -0.014281569980084896, 0.007717540953308344, 0.011445854790508747, 0.024882890284061432, 0.009859776124358177, 0.0227131899446249, 0.0012024326715618372, 0.023907897993922234, 0.0211477093398571, -0.01052579190582037, 0.001725117559544742, -8.818697824608535e-05, -0.02848074585199356, 0.04809043928980827, -0.02011778950691223, 0.014501286670565605, -0.0041574472561478615, 0.015393884852528572, 0.017522387206554413, -0.0011929917382076383, -0.014556216076016426, -0.024470921605825424, -0.027739202603697777, 0.009550799615681171, 0.038697563111782074, 0.02477303147315979, -0.021779393777251244, -0.018099144101142883, 0.009303619153797626, -0.001999763073399663, 0.004174612928181887, 0.010608185082674026, 0.02643463760614395, 0.04276231676340103, 0.0071682496927678585, -0.013066262938082218, -0.6314651370048523, -0.04325667768716812, 0.029112432152032852, 0.005372754298150539, 0.005523809231817722, 0.0005102399736642838, 0.004878391977399588, -0.0005295510054565966, -0.00673224963247776, 0.04232288524508476, 0.0024237472098320723, 0.027560682967305183, -0.02429240196943283, -0.012702357955276966, 0.022424811497330666, -0.00944780744612217, -0.009406611323356628, 0.010367870330810547, -0.002791085746139288, -0.006285950541496277, -0.0028271328192204237, 0.04199330881237984, -0.007504690438508987, 0.005719494074583054, -0.001374944462440908, -0.008047115057706833, 0.0035137468948960304, 0.012997602112591267, 0.0013843853957951069, 0.02697019651532173, -0.01893681287765503, 0.0040098256431519985, 0.02109277993440628, 0.006632690783590078, 0.05152351036667824, -0.013038799166679382, -0.0221227016299963, 0.017137883231043816, 0.008314894512295723, 0.042350348085165024, -0.022012842819094658, -0.028123706579208374, 0.018030481413006783, -0.012462043203413486, -0.009935303591191769, -0.0036287547554820776, 0.006759714335203171, -0.0029713218100368977, -0.024512117728590965, 0.004940187558531761, 0.001344046788290143, -0.004703305661678314, -0.02525366097688675, 0.012565035372972488, 0.026132525876164436, -0.03383633494377136, 0.02578921988606453, -0.019623426720499992, 0.007477225735783577, 0.011164342984557152, 0.009063304401934147, 0.013807806186378002, -0.008617005310952663, -0.038779955357313156, -0.038203198462724686, 0.026105063036084175, -0.007326170802116394, -0.02103785052895546, 0.013862735591828823, -0.015709728002548218, 0.005434549413621426, 0.03147438168525696, -0.009591996669769287, -0.012228594161570072, 0.0004370726819615811, 0.01889561489224434, -0.0028202668763697147, -0.01084850076586008, -0.0034948650281876326, 0.010930893942713737, 0.015421349555253983, -0.008644470013678074, -0.02206777222454548, 0.0004990824963897467, 0.019719552248716354, -0.005159903783351183, 0.013361507095396519, -0.00998336635529995, 0.017687175422906876, -0.03117227368056774, -0.003182455664500594, 0.031886350363492966, -0.01477593183517456, -0.038697563111782074, -0.017206545919179916, 0.02797265164554119, -0.011672437191009521, -0.022314952686429024, 0.020845599472522736, -0.015929443761706352, 0.011500783264636993, -0.004037289880216122, 0.0007230903138406575, 0.023056495934724808, -0.0011938499519601464, -0.01691816747188568, -0.01496818382292986, 0.015462545678019524, 0.03523702919483185, -0.018703363835811615, -0.010196217335760593, -0.0016684718430042267, 0.023619519546628, -0.013725413009524345, 0.013773475773632526, -0.021230103448033333, 0.016121694818139076, 0.010972090996801853, 0.012407113797962666, -0.03103495016694069, 0.014611144550144672, -0.01851111277937889, 0.01899174228310585, -0.006169226486235857, 0.023056495934724808, 0.004833762068301439, 0.0018899048445746303, 0.0027859359979629517, -0.00011887004075106233, -0.006309982389211655, -0.003211636794731021, -0.025212464854121208, 0.031858887523412704, -0.01684950664639473, 0.004727337043732405, -0.0011560862185433507, 0.03795601800084114, -0.01733013615012169, 0.01555867213755846, -0.012434578500688076, -0.011459587141871452, -0.006546863820403814, 0.03891727700829506, 0.0157921202480793, -0.016094230115413666, -0.011040751822292805, -0.011706767603754997, 0.0008707123342901468, -0.004047589376568794, -0.028727928176522255, -0.02584414929151535, -0.029771581292152405, -0.006783745717257261, 0.020639615133404732, 0.0018847553292289376, -0.025967739522457123, -0.003742045955732465, -0.022960370406508446, -0.017673442140221596, -0.03526449203491211, -0.01051892526447773, 0.02853567525744438, -0.013725413009524345, 0.0016289915656670928, 0.02690153382718563, -0.024869157001376152, 0.015641065314412117, 0.018140340223908424, -0.028810320422053337, -0.029387077316641808, -0.009440941736102104, -0.016204088926315308, -0.01111628022044897, 0.01371168065816164, 0.00515647092834115, 0.010422799736261368, -0.02210896834731102, 0.0018607238307595253, 0.004188345279544592, 0.009564531967043877, 0.0023774008732289076, -0.008754327893257141, 0.006121163256466389, -0.016107963398098946, 0.029908902943134308, -0.002665778622031212, 0.0324905700981617, -0.010415934026241302, -0.008857320062816143, 0.02367444895207882, -0.0008750036358833313, 0.022960370406508446, -0.011741098016500473, 0.028563139960169792, -0.005486045498400927, 0.04965592175722122, 0.01106135081499815, 0.01419917680323124, 0.007264375686645508, 0.017055490985512733, 0.019293852150440216, 0.021381158381700516, 0.039274316281080246, -0.00045831481111235917, 0.023633252829313278, -0.018167804926633835, 0.026462102308869362, -0.029304683208465576, 0.018634703010320663, -0.005122140049934387, -0.003560093231499195, -0.01625901833176613, 0.014116782695055008, -0.020845599472522736, -0.029606793075799942, 0.006965698674321175, 0.007971587590873241, 0.03273775428533554, -0.03210606798529625, 0.012654295191168785, 0.024869157001376152, 0.002895794343203306, 0.0007891769055277109, -0.01737133227288723, 0.0005492911441251636, 0.031803958117961884, 0.009337949566543102, 0.0047170380130410194, -0.01288087759166956, -0.021257568150758743, 0.01730267144739628, -0.006038769613951445, 0.0247318334877491, -0.004037289880216122, 0.005207967013120651, -0.0006750273169018328, 0.030238477513194084, -0.01800301857292652, 0.02738216333091259, 0.006718517281115055, -0.015407617203891277, 0.001425582217052579, 0.013450766913592815, -0.0032476838678121567, 0.003834738861769438, 0.007731272839009762, 0.04064754396677017, 0.004270738922059536, -2.6686753699323162e-05, -0.007305572275072336, 0.0014281569747254252, 0.0006106572691351175, 0.00840415433049202, 0.007374233566224575, 0.0008295154548250139, 0.013162389397621155, 0.004020124673843384, -0.010223682038486004, 0.037214476615190506, 0.032847609370946884, -0.003077747067436576, -0.004257006570696831, 0.018291395157575607, 0.0036802508402615786, -0.004957352764904499, -0.03776376694440842, -0.001991180470213294, -0.03737926483154297, -0.02534978650510311, -0.004236408043652773, -0.01553120743483305, -0.021710732951760292, -0.008445351384580135, 0.004634643904864788, 0.0076351473107934, 0.01837378926575184, 0.0038416050374507904, -0.01473473571240902, 0.02434733137488365, 0.007113320287317038, -0.010532657615840435, -0.021449819207191467, 0.018346324563026428, 0.005565005820244551, -0.013842137530446053, -0.007738139014691114, -0.028233565390110016, 0.010113823227584362, -0.023399803787469864, -0.003233951749280095, 0.003076030407100916, -0.0005758974584750831, -0.004734203219413757, 0.009598863311111927, 0.007360501680523157, 0.010422799736261368, 0.011981413699686527, 0.0020358103793114424, 0.004174612928181887, -0.0023671016097068787, -0.0030966289341449738, -0.01395199541002512, -0.04784325882792473, -0.021738197654485703, -0.012764153070747852, -0.012331586331129074, -0.019884340465068817, -0.007381099741905928, -0.016547396779060364, -0.02430613338947296, -0.005836218595504761, 0.015187900513410568, -0.010683712549507618, -0.02900257334113121, 0.01892307959496975, 0.021957913413643837, -0.009221225045621395, -0.004164313431829214, 0.016162892803549767, 0.005146171431988478, -0.023056495934724808, -0.04270738735795021, -0.024567047134041786, 0.009640059433877468, 0.08662321418523788, 0.006265352480113506, -0.0029112431220710278, 0.013629286549985409, -0.018744559958577156, -0.015435081906616688, -0.023825503885746002, -0.005462014116346836, 0.010443397797644138, -0.017577316612005234, -0.0020495427306741476, -0.004315368831157684, 0.011960814706981182, -0.01955476589500904, 0.018717095255851746, 0.019170261919498444, 0.0140000581741333, -0.03883488476276398, -0.005602770019322634, -0.0025387550704181194, 0.010704311542212963, -0.0247318334877491, 0.001487377448938787, 0.02206777222454548, 0.017069222405552864, 0.02268572524189949, 0.03735179826617241, 0.007710674777626991, 0.006231021601706743, -0.03331450745463371, -0.006457604002207518, 0.04446512088179588, 0.017481191083788872, -0.005654265638440847, -0.016616057604551315, 0.01837378926575184, 0.02580295130610466, 0.031364526599645615, -0.0005728935357183218, -0.020722009241580963, 0.03166663646697998, 0.0338088721036911, 0.006625824607908726, -0.004408061504364014, 0.01690443605184555, -0.008287430740892887, -0.012832814827561378, 0.021202638745307922, -0.017288940027356148, 0.0002343070082133636, 0.019376246258616447, 0.014061853289604187, -0.02955186367034912, -0.012722956016659737, 0.019884340465068817, 0.019101599231362343, -0.008074579760432243, -0.024937817826867104, -0.01084163412451744, -0.007504690438508987, -0.024113882333040237, -0.020200181752443314, 0.007072123698890209, -0.003796975128352642, -0.023482196033000946, -0.006042202934622765, -0.0026503298431634903, 0.014652341604232788, 0.003917132504284382, 0.00867193378508091, 0.01691816747188568, 0.0010093224700540304, -0.019788213074207306, 0.00924182403832674, -0.012441445142030716, -0.00190878682769835, 0.01893681287765503, -0.0012290389277040958, 0.014830861240625381, 0.013677350245416164, -0.002020361600443721, -0.008589540608227253, 0.025418449193239212, 0.009386012330651283, -0.005764123983681202, 0.0007664328441023827, -0.014707271009683609, 0.0007321021403186023, -0.0070309266448020935, 0.03010115586221218, -0.0253223218023777, -0.005376187153160572, 0.02791772224009037, -0.02738216333091259, 9.221010986948386e-05, 0.036088429391384125, -0.015160435810685158, 0.017151616513729095, 0.011047618463635445, -0.011981413699686527, -0.027107518166303635, -0.058829084038734436, -0.03205113857984543, -0.02639343962073326, 0.01900547370314598, -0.011782295070588589, 0.016670987010002136, 0.0215322133153677, 0.01694563217461109, -0.017481191083788872, 0.03048565983772278, -0.019692087545990944, 0.008273698389530182, -0.014103050343692303, -0.008891650475561619, -0.01577838882803917, 0.005736659746617079, 0.03971375152468681, 0.018840687349438667, -0.014528751373291016, 0.011528247967362404, -0.024058952927589417, 0.029304683208465576, 0.0045282188802957535, -0.0023585190065205097, 0.02048856019973755, 0.006715084426105022, -0.026091329753398895, -0.006759714335203171, -0.019252654165029526, -0.006962265353649855, 0.01209813728928566, 0.01081416942179203, -0.027286037802696228, -0.031282130628824234, -0.013505696319043636, 0.005716061219573021, 0.017563585191965103, 0.0036596523132175207, -0.01030607521533966, -0.004020124673843384, -0.01624528504908085, -0.0009973067790269852, -0.007937257178127766, 0.03971375152468681, -0.027739202603697777, -0.02052975632250309, 0.02434733137488365, 0.0021799993701279163, 0.017824498936533928, -0.020708275958895683, 0.016712183132767677, -0.03441309183835983, 0.013375239446759224, -0.012455176562070847, -0.02637970820069313, 0.0039583295583724976, 0.01785196177661419, 0.02220509573817253, -0.007236910983920097, 0.02735470049083233, 0.0031618571374565363, 0.0034931483678519726, 0.014556216076016426, -0.0009698421927168965, 0.0028872117400169373, 0.004487022291868925, -0.02206777222454548, 0.007429162971675396, 0.00894657988101244, 0.01235218532383442, 0.017700906842947006, 0.03487998992204666, 0.0003654073516372591, -0.002013495424762368, 0.010223682038486004, 0.008582673966884613, -0.025212464854121208, -0.011528247967362404, -0.045618630945682526, -0.016986828297376633, -0.016107963398098946, -0.0025507707614451647, 0.016053033992648125, -0.025212464854121208, 0.004136849194765091, 0.024951551109552383, 0.00033300777431577444, 0.02157340943813324, -0.01528402604162693, 0.019307583570480347, 0.005496344529092312, -0.01004516240209341, 0.0057400926016271114, 0.004311935510486364, -0.02364698424935341, 0.0049470532685518265, -0.0247318334877491, 0.007745005190372467, 0.013182987459003925, 0.00920749269425869, 0.02106531523168087, 0.011377193033695221, -0.005235431250184774, -0.01838752068579197, 0.02580295130610466, -0.01851111277937889, -0.004936754237860441, 0.01189215388149023, -0.009173162281513214, 0.00840415433049202, -0.005671431310474873, -0.027492022141814232, -0.008301162160933018, -0.011150610633194447, 0.023386070504784584, 0.0007621414843015373, 0.031858887523412704, -0.003683683928102255, -0.028027581050992012, 0.015078042633831501, -0.016547396779060364, 0.022246291860938072, 0.0011715349974110723, 0.0314469188451767, 0.01941744238138199, 0.00250270776450634, 0.019843142479658127, 0.01499564852565527, 0.006509100086987019, 0.001701944274827838, 0.023949094116687775, 0.02164207212626934, -0.00607653334736824, -0.00646447017788887, 0.014336499385535717, 0.023056495934724808, -0.01473473571240902, -0.022328685969114304, 0.00872686319053173, 0.012262925505638123, -0.008891650475561619, -0.036610256880521774, -0.0043943291530013084, -0.048282694071531296, 0.010058894753456116, 0.008397288620471954, 0.011384059675037861, 0.001077125663869083, -0.016629789024591446, -0.007710674777626991, 0.022891709581017494, -0.018785757943987846, 0.04023557901382446, 0.0033592586405575275, 0.003848471213132143, -0.003992659971117973, -0.0007136493804864585, -0.007284973748028278, 0.011425255797803402, -0.0034948650281876326, 0.004957352764904499, -0.015984373167157173, 0.019650891423225403, 0.006591493729501963, 0.004854360595345497, 0.0121050039306283, -0.013883333653211594, -0.000944094150327146, 0.031831420958042145, 0.003506880719214678, -0.02908496744930744, 0.008836721070110798, -0.02628358267247677, 0.011150610633194447, -0.030403265729546547, -0.0032476838678121567, -0.01159690972417593, -0.028755392879247665, -0.02952439896762371, 0.02523992955684662, 0.04677214100956917, -0.0017697474686428905, -0.006213856395334005, -0.010079492814838886, -0.011281067505478859, 0.028082510456442833, -0.019678356125950813, 0.00709958840161562, -0.0005904879653826356, -0.03463280573487282, -0.014830861240625381, 0.005475746002048254, -0.0013062830548733473, -0.0014453224139288068, -0.006227588281035423, -0.0015517475549131632, 0.021724464371800423, 0.010065760463476181, 0.018209001049399376, -0.009221225045621395, 0.018703363835811615, -0.028837785124778748, -0.006454171147197485, -0.0049813841469585896, -0.008115776814520359, -0.001108881551772356, -0.011995146051049232, -0.041444018483161926, -0.025954006239771843, 0.0020443929824978113, 0.016753381118178368, -0.01904667168855667, -0.013787208124995232, 0.012262925505638123, 0.0008080587722361088, -0.003209920134395361, 0.0030416997615247965, -0.030375801026821136, 0.0021731331944465637, -0.026118794456124306, -0.028315959498286247, 0.0454263798892498, -0.028343424201011658, 0.00974991824477911, -0.014872058294713497, 0.03361661732196808, 0.0007175115752033889, -0.039686284959316254, -0.020255111157894135, -0.012043208815157413, 0.003597856964915991, -0.03636307641863823, -0.013340909034013748, 0.0016247002640739083, -0.015544939786195755, -0.01900547370314598, 0.011013288050889969, 0.02165580354630947, -0.0027035423554480076, 0.01690443605184555, 0.01844245009124279, 0.012674893252551556, 0.007147651165723801, -0.007978454232215881, 0.009907838888466358, -0.026544494554400444, 0.0002656337746884674, -0.0262973140925169, -0.0037489121314138174, -0.02154594473540783, 0.044053152203559875, 0.016753381118178368, -0.024429723620414734, -0.04803550988435745, -0.043421465903520584, -0.03595110774040222, -0.008658201433718204, -0.022438542917370796, 0.009022107347846031, 0.023070229217410088, 0.01057385466992855, 0.00539335235953331, 0.02850821055471897, -0.011184941045939922, 0.029771581292152405, -0.01058072131127119, 0.005482612177729607, -0.0013191570760682225, 0.0011063066776841879, 0.02900257334113121, 0.0055547067895531654, -0.010862232185900211, -0.009585130959749222, -0.014116782695055008, 0.003920565824955702, -0.008843587711453438, 0.03726940602064133, 0.011562579311430454, -0.027698006480932236, 0.012791617773473263, 0.0041059511713683605, 0.01845618337392807, -0.0023121724370867014, -0.002451211679726839, -0.018607238307595253, 0.005513510201126337, 0.03108987957239151, 0.007552753202617168, -0.037077151238918304, -0.0039754947647452354, 0.03227085620164871, 0.0015362986596301198, 0.012681759893894196, -0.022932905703783035, -0.0010934326564893126, -0.0029112431220710278, -0.03971375152468681, 0.010477729141712189, 0.0057881553657352924, -0.009495871141552925, 0.0121050039306283, -0.006873005535453558, -0.0040063923224806786, -0.027093786746263504, 0.003048565937206149, -0.010052028112113476, -0.004768533632159233, 0.030650446191430092, -0.03542928025126457, -0.006419840268790722, -9.532132389722392e-05, -0.00578472251072526, -0.008658201433718204, -0.0007329604122787714, 0.01474846713244915, -0.002020361600443721, -0.027080053463578224, -0.008356091566383839, -0.0006321139517240226, -0.0317215658724308, 0.0030502823647111654, -0.020749473944306374, 0.002133652800694108, -0.006258486304432154, -0.027835329994559288, -0.008239367045462132, -0.04548130929470062, 0.019197726622223854, 0.012482641264796257, -0.009248689748346806, 0.012716090306639671, -0.009516469202935696, -0.00775187136605382, -0.005750391632318497, 0.030815234407782555, 0.20235885679721832, -0.02528112567961216, 0.006117730401456356, 0.0035772586707025766, -0.048282694071531296, 0.007827399298548698, 0.028727928176522255, -0.012599365785717964, -0.009180028922855854, 0.018140340223908424, 0.0015526057686656713, -0.0024237472098320723, -0.0274782907217741, 0.004411494825035334, -0.014322767034173012, -0.011562579311430454, -0.0443827249109745, -0.03323211520910263, -0.027670541778206825, -0.029222289100289345, -0.01261996477842331, 0.004974517971277237, 0.006642989814281464, -0.0018590072868391871, 0.031199738383293152, 0.03438562527298927, -0.016135428100824356, 0.002317321952432394, 0.037187010049819946, 0.011899019591510296, -0.0067494153045117855, -0.0008986060274764895, 0.009413477033376694, -0.005894580855965614, -0.007738139014691114, 0.00025275975349359214, 0.005036313086748123, -0.006028470583260059, 0.006086832843720913, -0.002537038642913103, 0.018566040322184563, -0.026668084785342216, 0.005434549413621426, -0.00950960349291563, -0.0048989905044436455, 0.0409771203994751, -0.007456627674400806, -0.032902538776397705, 0.003362691728398204, 0.037598978728055954, -0.016217822209000587, 0.0006394092342816293, 0.0023018731735646725, 0.02381177246570587, -0.008253099396824837, 0.014446357265114784, -0.007827399298548698, 0.016670987010002136, -0.010690579190850258, 0.020667079836130142, -0.013526294380426407, 0.019815677776932716, 0.007154517341405153, 0.03438562527298927, -0.013780341483652592, 0.008802390657365322, 0.0039754947647452354, -0.007024060469120741, -0.002348219742998481, -0.01587451435625553, 0.0014410309959203005, -0.0037695106584578753, 0.005122140049934387, 0.006756281014531851, -0.007758737541735172, -0.02750575542449951, 0.030156085267663002, 0.01103388611227274, 0.026544494554400444, 0.022466007620096207, -0.016670987010002136, -0.010381602682173252, -0.015641065314412117, -0.010827901773154736, -0.009028973057866096, -0.02000793069601059, 0.016533663496375084, -0.013491963967680931, -0.032463107258081436, 0.0037214476615190506, 0.009907838888466358, -0.03125466778874397, -0.01451501902192831, -0.002914676209911704, 0.013821538537740707, -0.005207967013120651, 0.00869939848780632, 0.010395335033535957, -0.004040723200887442, -0.012180531397461891, -0.01058072131127119, 0.0549565814435482, -0.007374233566224575, 0.0037523452192544937, -0.015599869191646576, -0.009131965227425098, 0.016149159520864487, -0.0020478260703384876, -0.0056611318141222, -0.015105506405234337, 0.004953919444233179, -0.03114480897784233, 0.004456124734133482, -0.012283523567020893, -0.021408623084425926, 0.0178794264793396, -0.0027687707915902138, -0.043036963790655136, 0.020364969968795776, -0.00396176241338253, 0.01105448417365551, -0.01319671981036663, 0.014054987579584122, 0.01800301857292652, -0.005142738576978445, -0.014817128889262676, -0.012825948186218739, -0.014899522997438908, -0.01573719084262848, -0.012043208815157413, 0.023289944976568222, -0.01998046599328518, 0.02206777222454548, 0.006162360310554504, -0.0026108494494110346, 0.01691816747188568, 0.027807865291833878, -0.01625901833176613, -0.017151616513729095, 0.007305572275072336, 0.021806858479976654, -0.01896427758038044, 0.006498801056295633, -0.006536564789712429, 0.028727928176522255, -0.020145252346992493, 0.013560625724494457, 0.009784248657524586, -0.0024649440310895443, -0.011226138100028038, -0.03787362575531006, -0.006598359905183315, 0.004820029716938734, -0.014981916174292564, -0.011562579311430454, -0.009550799615681171, -0.00819817092269659, -0.007999052293598652, -0.012771019712090492, 0.009660658426582813, -0.02265826053917408, 0.028727928176522255, -0.000594779325183481, 0.004809730686247349, 0.0022108969278633595, -0.011947082355618477, -0.17522387206554413, 0.022301221266388893, -0.0020976054947823286, -0.013814672827720642, 0.0152702946215868, 0.006131462752819061, -0.012647428549826145, 0.007765603717416525, -0.007312438450753689, 0.003364408388733864, -0.006622391287237406, -0.028645534068346024, -0.011013288050889969, 0.0052663288079202175, -0.008658201433718204, -0.00724377715960145, 0.00036862585693597794, 0.01446008961647749, 0.029634257778525352, 0.023825503885746002, -0.009083902463316917, -0.021408623084425926, 0.008589540608227253, 0.011205540038645267, -0.01242771279066801, -0.01025801245123148, -0.01958223059773445, -0.004648376256227493, -0.015119238756597042, -0.015146703459322453, -0.007291839923709631, -0.018181538209319115, 0.0004177616792730987, 0.007161383517086506, 0.019650891423225403, 0.0026520462706685066, -0.005197667516767979, 0.0060593681409955025, -0.016670987010002136, 0.006255052983760834, 0.02430613338947296, 0.02944200672209263, 0.007092722225934267, 0.00817070621997118, -0.010203083045780659, 0.0008535469532944262, 0.009619461372494698, -0.03199620917439461, -0.025967739522457123, -0.014611144550144672, -0.015132971107959747, -0.02787652611732483, -0.006498801056295633, 0.005482612177729607, -0.009200626984238625, -0.001128621632233262, 0.007820532657206059, 0.011335995979607105, -0.004047589376568794, -0.013340909034013748, -0.004133415874093771, -0.03251803666353226, 0.03416591137647629, 0.012949539348483086, -0.013938263058662415, -0.03996093198657036, -0.0029078100342303514, 0.012482641264796257, -0.015654798597097397, 0.014054987579584122, 0.0140000581741333, -0.005348722450435162, -0.011226138100028038, -0.0248004961758852, 0.0058705490082502365, 0.009434076026082039, -0.02425120398402214, 0.009866642765700817, -0.0077724698930978775, 0.012825948186218739, -0.006632690783590078, 0.0025301724672317505, -0.026146259158849716, -0.007717540953308344, -0.01338897179812193, -0.001568054547533393, -0.005764123983681202, 0.0056885965168476105, 0.009495871141552925, -0.0004031711141578853, 0.01945863850414753, -0.031337060034275055, -0.021463552489876747, -0.0033420934341847897, 0.023509660735726357, 0.01690443605184555, 0.02478676289319992, -0.01635514385998249, -0.015297758392989635, 0.0001303493627347052, 0.00462091201916337, 0.01683577336370945, 0.02738216333091259, -0.0031206603161990643, 0.01639634184539318, -0.006124596577137709, 0.0022847079671919346, -0.010086358524858952, 0.03998839482665062, -0.0017989284824579954, -0.013759743422269821, 0.02048856019973755, -0.0012187397805973887, 0.006416407413780689, 0.015709728002548218, 0.036720115691423416, -0.0035360618494451046, -0.023509660735726357, -0.007552753202617168, -0.0116175077855587, 0.030430730432271957, -0.009166296571493149, -0.009537067264318466, 0.004823463037610054, -0.02738216333091259, -0.0005943502183072269, -0.12238206714391708, -0.026214919984340668, 0.030842699110507965, 0.024017754942178726, 0.008637603372335434, 0.039246853440999985, -0.017041757702827454, 0.005417384207248688, -0.0017242592293769121, 0.025061409920454025, -0.03056805208325386, -0.006948533002287149, 0.011960814706981182, -0.0041437153704464436, -0.0031944713555276394, -0.005534108262509108, 0.003335227258503437, -0.016616057604551315, -0.019884340465068817, 0.026201188564300537, 0.0020031961612403393, -0.027231108397245407, -0.0009277870994992554, -0.0059220450930297375, -0.0017766135279089212, 0.0042432742193341255, -0.03177649527788162, -0.00038042705273255706, 0.02375684306025505, 0.023825503885746002, -0.010079492814838886, -0.031337060034275055, -0.003455384634435177, 0.008568941615521908, -0.00817070621997118, -0.005341856274753809, -0.02370191365480423, -0.0152702946215868, 0.023454733192920685, -0.02426493726670742, 0.007106454111635685, 0.006927934940904379, 0.03515463322401047, 0.000523543159943074, 0.01477593183517456, -0.005750391632318497, -0.01496818382292986, 0.010106957517564297, -0.02415507845580578, -0.01079357136040926, -0.05630234256386757, -0.0012582200579345226, -0.043915826827287674, 0.0019465505611151457, 0.048255227506160736, 0.0152702946215868, 0.017714640125632286, -0.025116337463259697, 0.00486122677102685, -0.015421349555253983, -0.018263930454850197, -0.006340879946947098, -0.03012862056493759, 0.020282575860619545, 0.026050133630633354, -0.003652786137536168, -0.015078042633831501, 0.0035257625859230757, 0.024072684347629547, -0.008074579760432243, -0.004627778194844723, 0.004270738922059536, -0.008603272959589958, 0.022795582190155983, -0.01738506555557251, -0.03372647613286972, 0.0026520462706685066, -0.010429665446281433, -0.011507649905979633, -0.008026516996324062, -0.026105063036084175, -0.01628648303449154, 0.010930893942713737, -0.013491963967680931, 0.014103050343692303, 0.01023054774850607, -0.00727124186232686, -0.01734386757016182, -0.003824439598247409, -0.020708275958895683, -0.0017834797035902739, 0.020406166091561317, 0.0009938736911863089, 0.004250140395015478, -0.015668530017137527, 0.011768562719225883, -0.006763147190213203, 0.002339636906981468, -0.00617265934124589, 0.009729319252073765, 0.006622391287237406, 0.01081416942179203, -0.04597567021846771, 0.0024700937792658806, 0.0014024089323356748, -0.0033609753008931875, 0.0006831808714196086, 0.0013182987459003925, 0.008218768984079361, 0.0041093844920396805, 0.004456124734133482, 0.015943175181746483, -0.04806297644972801, 0.04652496054768562, -0.025033945217728615, 0.009317351505160332, -0.03628068044781685, -0.010566988959908485, 0.023976558819413185, -0.011013288050889969, 0.021422354504466057, -0.009852910414338112, -0.0063786436803638935, -0.021463552489876747, 0.009111367166042328, -0.006653289310634136, 0.02157340943813324, 0.0044252267107367516, 0.0005982124130241573, 0.025610700249671936, -0.0037489121314138174, -0.011521382257342339, 0.02378430776298046, -0.02223256044089794, 0.005678297486156225, 0.04166373610496521, -0.0023138890974223614, -0.025528306141495705, 0.017645979300141335, 0.04100458323955536, 0.008266831748187542, 0.030293406918644905, -0.039741214364767075, -0.021902984008193016, -0.006406107917428017, -0.025130070745944977, -0.03479759395122528, 0.013725413009524345, -0.033946193754673004, 0.030403265729546547, 0.02694273181259632, -0.01505057793110609, 0.04199330881237984, 0.01419917680323124, -0.030211012810468674, -0.008541477844119072, -0.000932936673052609, -0.004318801686167717, 0.017508655786514282, 0.019060403108596802, 0.01051892526447773, -0.0016178340883925557, 0.03490745276212692, 0.021188905462622643, -0.0023447866551578045, 0.01694563217461109, 0.020268844440579414, -0.008342359215021133, 0.00709958840161562, -0.011390925385057926, 0.0008677083533257246, -0.01998046599328518, -0.02528112567961216, 0.0033386603463441133, 0.01734386757016182, -0.0031069281976670027, 0.021999111399054527, 0.004868092946708202, -0.011933350004255772, 0.0227131899446249, -0.005465446971356869, 0.01783823035657406, 0.015572404488921165, -0.010477729141712189, 0.0021714165341109037, 0.0004935037577524781, 0.02587161399424076, -0.0017328419489786029, 0.004408061504364014, 0.005911746062338352, -0.0002965313906315714, 0.002267542527988553, -0.010381602682173252, -0.007291839923709631, 0.014762199483811855, 0.00283228256739676, 0.01261309813708067, 0.017536120489239693, -0.015970639884471893, 0.014020657166838646, 0.009550799615681171, -0.00631684809923172, 0.034468021243810654, -0.006282517686486244, 0.005575305316597223, -0.03051312454044819, -0.00971558690071106, -0.01424037292599678, -0.026091329753398895, -0.029606793075799942, 0.005201100837439299, 0.014432624913752079, -0.008905382826924324, -0.0008569800411351025, 0.0029713218100368977, 0.016121694818139076, -0.04311935603618622, 0.012949539348483086, 0.014295302331447601, -0.029304683208465576, -0.014013790525496006, 0.02745082601904869, -0.0005484328721649945, 0.007703808601945639, 0.030375801026821136, -0.014116782695055008, 0.01234531868249178, -0.00196714885532856, 0.020296309143304825, 0.008397288620471954, -0.008658201433718204, 0.02260333113372326, 0.004013258498162031, 0.007992186583578587, -0.016162892803549767, -0.023509660735726357, -0.007044658996164799, -0.008328626863658428, 0.0032270855735987425, 0.0068970369175076485, 0.013217318803071976, 0.05484672263264656, 4.741927477880381e-05, -0.010182484984397888, 0.010354137979447842, -0.009859776124358177, -0.003311195643618703, 0.006042202934622765, -0.001096865744329989, -0.008658201433718204, -0.019884340465068817, 0.01741253025829792, -0.032353248447179794, -0.0015062593156471848, -0.033534225076436996, -0.012496373616158962, 0.007950989529490471, 0.0032785816583782434, 0.036115892231464386, 0.00047075969632714987, -0.0023241881281137466, 0.016217822209000587, 0.003048565937206149, 0.02573429048061371, 0.01550374273210764, -0.013114326633512974, 0.015709728002548218, -0.009667524136602879, 0.0027138416189700365, -0.027080053463578224, -0.006392376031726599, 0.02381177246570587, 0.008816123008728027, -0.0184699147939682, -0.02261706255376339, -0.004219242837280035, 0.006110864225775003, -0.019774481654167175, -0.00512900622561574, 0.010003965348005295, 0.008548343554139137, -0.0024752432946115732, 0.03265535831451416, -0.011370327323675156, -0.010443397797644138, -0.03207860514521599, 0.004414927680045366, -0.01680830866098404, -0.02791772224009037, -0.03152931109070778]}, "text_id_to_ref_doc_id": {"2874d249-b6a1-492e-b3a6-9dfcfe5ceae6": "fcf383f1-14bf-42de-8764-d9d7a9626c5d", "f2a3e62e-796a-4d57-9d89-92d937e98c08": "fcf383f1-14bf-42de-8764-d9d7a9626c5d"}, "metadata_dict": {"2874d249-b6a1-492e-b3a6-9dfcfe5ceae6": {"file_path": "/Users/leader/Downloads/AI_Army/ML_Basics/NLP/My_ChatBot/AI_agents/Sukoon_Github/langgraph/prompts/sample_data.txt", "file_name": "sample_data.txt", "file_type": "text/plain", "file_size": 5100, "creation_date": "2024-07-03", "last_modified_date": "2024-07-02", "_node_type": "TextNode", "document_id": "fcf383f1-14bf-42de-8764-d9d7a9626c5d", "doc_id": "fcf383f1-14bf-42de-8764-d9d7a9626c5d", "ref_doc_id": "fcf383f1-14bf-42de-8764-d9d7a9626c5d"}, "f2a3e62e-796a-4d57-9d89-92d937e98c08": {"file_path": "/Users/leader/Downloads/AI_Army/ML_Basics/NLP/My_ChatBot/AI_agents/Sukoon_Github/langgraph/prompts/sample_data.txt", "file_name": "sample_data.txt", "file_type": "text/plain", "file_size": 5100, "creation_date": "2024-07-03", "last_modified_date": "2024-07-02", "_node_type": "TextNode", "document_id": "fcf383f1-14bf-42de-8764-d9d7a9626c5d", "doc_id": "fcf383f1-14bf-42de-8764-d9d7a9626c5d", "ref_doc_id": "fcf383f1-14bf-42de-8764-d9d7a9626c5d"}}}
|
Sukoon_Github/langgraph/storage/docstore.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"docstore/metadata": {"fcf383f1-14bf-42de-8764-d9d7a9626c5d": {"doc_hash": "2eb1b839006ff0b4b60105f1ac6582cf6e98a09ce6453e7b0025456339829c05"}, "2874d249-b6a1-492e-b3a6-9dfcfe5ceae6": {"doc_hash": "951c1f77849d43d7358ba7d3fc9473fd77e6becf4a690eab48a80bab9b6951d7", "ref_doc_id": "fcf383f1-14bf-42de-8764-d9d7a9626c5d"}, "f2a3e62e-796a-4d57-9d89-92d937e98c08": {"doc_hash": "68afef16befd98b3a1878f46a55d1040fc5427dc4aafb04ced6e4bff94448215", "ref_doc_id": "fcf383f1-14bf-42de-8764-d9d7a9626c5d"}}, "docstore/data": {"2874d249-b6a1-492e-b3a6-9dfcfe5ceae6": {"__data__": {"id_": "2874d249-b6a1-492e-b3a6-9dfcfe5ceae6", "embedding": null, "metadata": {"file_path": "/Users/leader/Downloads/AI_Army/ML_Basics/NLP/My_ChatBot/AI_agents/Sukoon_Github/langgraph/prompts/sample_data.txt", "file_name": "sample_data.txt", "file_type": "text/plain", "file_size": 5100, "creation_date": "2024-07-03", "last_modified_date": "2024-07-02"}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {"1": {"node_id": "fcf383f1-14bf-42de-8764-d9d7a9626c5d", "node_type": "4", "metadata": {"file_path": "/Users/leader/Downloads/AI_Army/ML_Basics/NLP/My_ChatBot/AI_agents/Sukoon_Github/langgraph/prompts/sample_data.txt", "file_name": "sample_data.txt", "file_type": "text/plain", "file_size": 5100, "creation_date": "2024-07-03", "last_modified_date": "2024-07-02"}, "hash": "2eb1b839006ff0b4b60105f1ac6582cf6e98a09ce6453e7b0025456339829c05", "class_name": "RelatedNodeInfo"}, "3": {"node_id": "f2a3e62e-796a-4d57-9d89-92d937e98c08", "node_type": "1", "metadata": {}, "hash": "dfc1359bbfa81dec20bb61d640680f1736a1973f7c7526b45cfaea33ec309a34", "class_name": "RelatedNodeInfo"}}, "text": "### Immediate Care for Handling Mental Health Crisis\n\nWhat is Immediate Care?\n1. Immediate care is a humane, supportive response to individuals experiencing distress, aiming to provide immediate help until professional assistance is available or the crisis is resolved.\n2. It is accessible to all, not limited to mental health professionals.\n3. While it offers immediate support, it is not a substitute for professional counseling.\n\nImportance of Immediate Care\n1. Mental health disorders can affect anyone, regardless of age, gender, race, or socioeconomic status.\n2. Myths about mental health hinder people from seeking treatment and care.\n3. Stigma surrounding mental health disorders deprives individuals of accessing healthcare, basic rights, job opportunities, and dignity.\n4. Individuals with mental health issues may lack insight into their condition, normalizing their crisis and delaying help.\n5. Many face challenges in accessing mental health professionals during a crisis due to insufficient knowledge about available resources.\n6. Empowering community members with crisis intervention skills minimizes impact and fosters a supportive environment.\n\nDifference between Immediate Care and Psychological First Aid (PFA)\n- Immediate Care:\n 1. Addresses short-term crises and everyday stressors.\n 2. Community-based and easily accessible.\n- Psychological First Aid (PFA):\n 1. Targets severe, long-lasting problems.\n 2. Requires trained professionals and controlled environments.\n\nWho Can Provide Immediate Care?\n- Community members\n- Mental health professionals\n- Police\n- Emergency medical teams\n- Counselors\n- Neighbors\n- NGOs\n- Relatives or family members\n\nWhat is Mental Health Crisis?\n1. Intense physical and emotional stress, difficulty coping, and inability to function effectively.\n2. Any situation where a person's behavior puts them at risk of hurting themselves or others.\n\nLife Span Model of Mental Health Crisis\n- Childhood: Bullying, separation from parents, parental disharmony, peer pressure, child abuse, sibling rivalry, academic pressure, physical illness/disability, death of a family member.\n- Adolescence: Identity crisis, sexual abuse, menarche, body image issues, substance use, relationship failures, technology addiction, career issues.\n- Young Adulthood: Migration, higher education, technology addiction, loss of job, loss of loved ones, workplace stress, pregnancy-related events, marital issues, career issues, parenting, financial issues.\n- Middle Age: Family issues, divorce, death of spouse, physical illness, children's marriage decisions, property issues, health issues, empty nest.\n- Old Age: Retirement, health issues, dependency, caregiving, loss of spouse, stress of unfinished business, issues in interpersonal relationships, isolation, social support, mobility.\n\nImmediate Care During Disasters\n1. Common Reactions:\n - Emotional: Sadness, crying spells, anxiety, irritability, mood swings, hopelessness, sensitivity to criticism, anger, aggression.\n - Physical: Tiredness, increased heartbeat, sweating, shaking, weight changes, headaches, body aches, digestive problems.\n - Behavioral: Social withdrawal, changes in sleep or appetite, increased substance use, acting out of character.\n - Cognitive: Difficulty concentrating, racing thoughts, forgetfulness, negative thinking patterns.\n\nHow to Approach Someone in Crisis\n1. Notice signs and approach with care to establish rapport.\n2. Engage the person in conversation about what could be bothering them.\n3. Allow the person to choose when to open up.\n4. Express concern and willingness to help.\n5. Respect how the person interprets their symptoms.\n6. Give full attention and listen without interrupting.\n7. Avoid giving simple, unrealistic reassurances.\n\nAnatomy of a First Aider\n- Face the speaker, keep open posture, lean slightly forward, maintain eye contact.\n- Avoid physical contact unless appropriate, maintain respectful distance.\n- Building skills: undivided concentration, mindful presence, nonverbal cues, active listening.\n- Empathy: Express care, supportive statements, ask questions, paraphrase, acknowledge emotions.\n- Be non-judgmental: Treat with respect, avoid evaluative comments, maintain a neutral facial expression.\n\nClarifying Confidentiality\n- Reflect the speaker's words and feelings to ensure correct understanding.\n- Summarize what has been shared to clarify.\n- Always ask for permission before sharing any information.\n\nProbing Skills\n- Use open-ended questions to encourage exploration.\n- Avoid \"why\" questions, use pauses or silence.\n- Emphasize \"I\" messages over \"you\" messages.\n\nWhat Immediate Care is Not\n- It is not obtaining details of traumatic experiences, treating, labeling or diagnosing, counseling, or something only professionals can do.\n\nDon'ts in Immediate Care\n- Do not pressure someone to tell their story.", "mimetype": "text/plain", "start_char_idx": 0, "end_char_idx": 4864, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "f2a3e62e-796a-4d57-9d89-92d937e98c08": {"__data__": {"id_": "f2a3e62e-796a-4d57-9d89-92d937e98c08", "embedding": null, "metadata": {"file_path": "/Users/leader/Downloads/AI_Army/ML_Basics/NLP/My_ChatBot/AI_agents/Sukoon_Github/langgraph/prompts/sample_data.txt", "file_name": "sample_data.txt", "file_type": "text/plain", "file_size": 5100, "creation_date": "2024-07-03", "last_modified_date": "2024-07-02"}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {"1": {"node_id": "fcf383f1-14bf-42de-8764-d9d7a9626c5d", "node_type": "4", "metadata": {"file_path": "/Users/leader/Downloads/AI_Army/ML_Basics/NLP/My_ChatBot/AI_agents/Sukoon_Github/langgraph/prompts/sample_data.txt", "file_name": "sample_data.txt", "file_type": "text/plain", "file_size": 5100, "creation_date": "2024-07-03", "last_modified_date": "2024-07-02"}, "hash": "2eb1b839006ff0b4b60105f1ac6582cf6e98a09ce6453e7b0025456339829c05", "class_name": "RelatedNodeInfo"}, "2": {"node_id": "2874d249-b6a1-492e-b3a6-9dfcfe5ceae6", "node_type": "1", "metadata": {"file_path": "/Users/leader/Downloads/AI_Army/ML_Basics/NLP/My_ChatBot/AI_agents/Sukoon_Github/langgraph/prompts/sample_data.txt", "file_name": "sample_data.txt", "file_type": "text/plain", "file_size": 5100, "creation_date": "2024-07-03", "last_modified_date": "2024-07-02"}, "hash": "951c1f77849d43d7358ba7d3fc9473fd77e6becf4a690eab48a80bab9b6951d7", "class_name": "RelatedNodeInfo"}}, "text": "- Avoid physical contact unless appropriate, maintain respectful distance.\n- Building skills: undivided concentration, mindful presence, nonverbal cues, active listening.\n- Empathy: Express care, supportive statements, ask questions, paraphrase, acknowledge emotions.\n- Be non-judgmental: Treat with respect, avoid evaluative comments, maintain a neutral facial expression.\n\nClarifying Confidentiality\n- Reflect the speaker's words and feelings to ensure correct understanding.\n- Summarize what has been shared to clarify.\n- Always ask for permission before sharing any information.\n\nProbing Skills\n- Use open-ended questions to encourage exploration.\n- Avoid \"why\" questions, use pauses or silence.\n- Emphasize \"I\" messages over \"you\" messages.\n\nWhat Immediate Care is Not\n- It is not obtaining details of traumatic experiences, treating, labeling or diagnosing, counseling, or something only professionals can do.\n\nDon'ts in Immediate Care\n- Do not pressure someone to tell their story.\n- Do not interrupt or rush the story.\n- Do not give simple, unrealistic reassurances.\n- Do not give false promises or minimize their loss.\n- Do not touch if unsure, and avoid criticizing existing services in front of people in need.", "mimetype": "text/plain", "start_char_idx": 3876, "end_char_idx": 5097, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}}, "docstore/ref_doc_info": {"fcf383f1-14bf-42de-8764-d9d7a9626c5d": {"node_ids": ["2874d249-b6a1-492e-b3a6-9dfcfe5ceae6", "f2a3e62e-796a-4d57-9d89-92d937e98c08"], "metadata": {"file_path": "/Users/leader/Downloads/AI_Army/ML_Basics/NLP/My_ChatBot/AI_agents/Sukoon_Github/langgraph/prompts/sample_data.txt", "file_name": "sample_data.txt", "file_type": "text/plain", "file_size": 5100, "creation_date": "2024-07-03", "last_modified_date": "2024-07-02"}}}}
|
Sukoon_Github/langgraph/storage/graph_store.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"graph_dict": {}}
|
Sukoon_Github/langgraph/storage/image__vector_store.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"embedding_dict": {}, "text_id_to_ref_doc_id": {}, "metadata_dict": {}}
|
Sukoon_Github/langgraph/storage/index_store.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"index_store/data": {"d91718ba-b824-4557-9df0-c536043fe929": {"__type__": "vector_store", "__data__": "{\"index_id\": \"d91718ba-b824-4557-9df0-c536043fe929\", \"summary\": null, \"nodes_dict\": {\"2874d249-b6a1-492e-b3a6-9dfcfe5ceae6\": \"2874d249-b6a1-492e-b3a6-9dfcfe5ceae6\", \"f2a3e62e-796a-4d57-9d89-92d937e98c08\": \"f2a3e62e-796a-4d57-9d89-92d937e98c08\"}, \"doc_id_dict\": {}, \"embeddings_dict\": {}}"}}}
|
Sukoon_Github/langgraph/sukoon-frontend/.gitignore
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
| 2 |
+
|
| 3 |
+
# dependencies
|
| 4 |
+
/node_modules
|
| 5 |
+
/.pnp
|
| 6 |
+
.pnp.js
|
| 7 |
+
|
| 8 |
+
# testing
|
| 9 |
+
/coverage
|
| 10 |
+
|
| 11 |
+
# production
|
| 12 |
+
/build
|
| 13 |
+
|
| 14 |
+
# misc
|
| 15 |
+
.DS_Store
|
| 16 |
+
.env.local
|
| 17 |
+
.env.development.local
|
| 18 |
+
.env.test.local
|
| 19 |
+
.env.production.local
|
| 20 |
+
|
| 21 |
+
npm-debug.log*
|
| 22 |
+
yarn-debug.log*
|
| 23 |
+
yarn-error.log*
|
Sukoon_Github/langgraph/sukoon-frontend/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
In the project directory, you can run:
|
| 2 |
+
|
| 3 |
+
### `npm start`
|
| 4 |
+
|
| 5 |
+
Runs the app in the development mode.\
|
| 6 |
+
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
| 7 |
+
|
| 8 |
+
The page will reload when you make changes.\
|
| 9 |
+
You may also see any lint errors in the console.
|
| 10 |
+
|
| 11 |
+
### `npm test`
|
| 12 |
+
|
| 13 |
+
Launches the test runner in the interactive watch mode.\
|
| 14 |
+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
| 15 |
+
|
| 16 |
+
### `npm run build`
|
| 17 |
+
|
| 18 |
+
Builds the app for production to the `build` folder.\
|
| 19 |
+
It correctly bundles React in production mode and optimizes the build for the best performance.
|
| 20 |
+
|
| 21 |
+
The build is minified and the filenames include the hashes.\
|
| 22 |
+
Your app is ready to be deployed!
|
| 23 |
+
|
| 24 |
+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
| 25 |
+
|
| 26 |
+
### `npm run eject`
|
| 27 |
+
|
| 28 |
+
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
| 29 |
+
|
| 30 |
+
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
| 31 |
+
|
| 32 |
+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
| 33 |
+
|
| 34 |
+
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
| 35 |
+
|
| 36 |
+
### Making a Progressive Web App
|
| 37 |
+
|
| 38 |
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@alloc/quick-lru/index.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare namespace QuickLRU {
|
| 2 |
+
interface Options<KeyType, ValueType> {
|
| 3 |
+
/**
|
| 4 |
+
The maximum number of milliseconds an item should remain in the cache.
|
| 5 |
+
|
| 6 |
+
@default Infinity
|
| 7 |
+
|
| 8 |
+
By default, `maxAge` will be `Infinity`, which means that items will never expire.
|
| 9 |
+
Lazy expiration upon the next write or read call.
|
| 10 |
+
|
| 11 |
+
Individual expiration of an item can be specified by the `set(key, value, maxAge)` method.
|
| 12 |
+
*/
|
| 13 |
+
readonly maxAge?: number;
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
The maximum number of items before evicting the least recently used items.
|
| 17 |
+
*/
|
| 18 |
+
readonly maxSize: number;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
Called right before an item is evicted from the cache.
|
| 22 |
+
|
| 23 |
+
Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`).
|
| 24 |
+
*/
|
| 25 |
+
onEviction?: (key: KeyType, value: ValueType) => void;
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
declare class QuickLRU<KeyType, ValueType>
|
| 30 |
+
implements Iterable<[KeyType, ValueType]> {
|
| 31 |
+
/**
|
| 32 |
+
The stored item count.
|
| 33 |
+
*/
|
| 34 |
+
readonly size: number;
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
Simple ["Least Recently Used" (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29).
|
| 38 |
+
|
| 39 |
+
The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop.
|
| 40 |
+
|
| 41 |
+
@example
|
| 42 |
+
```
|
| 43 |
+
import QuickLRU = require('quick-lru');
|
| 44 |
+
|
| 45 |
+
const lru = new QuickLRU({maxSize: 1000});
|
| 46 |
+
|
| 47 |
+
lru.set('🦄', '🌈');
|
| 48 |
+
|
| 49 |
+
lru.has('🦄');
|
| 50 |
+
//=> true
|
| 51 |
+
|
| 52 |
+
lru.get('🦄');
|
| 53 |
+
//=> '🌈'
|
| 54 |
+
```
|
| 55 |
+
*/
|
| 56 |
+
constructor(options: QuickLRU.Options<KeyType, ValueType>);
|
| 57 |
+
|
| 58 |
+
[Symbol.iterator](): IterableIterator<[KeyType, ValueType]>;
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
Set an item. Returns the instance.
|
| 62 |
+
|
| 63 |
+
Individual expiration of an item can be specified with the `maxAge` option. If not specified, the global `maxAge` value will be used in case it is specified in the constructor, otherwise the item will never expire.
|
| 64 |
+
|
| 65 |
+
@returns The list instance.
|
| 66 |
+
*/
|
| 67 |
+
set(key: KeyType, value: ValueType, options?: {maxAge?: number}): this;
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
Get an item.
|
| 71 |
+
|
| 72 |
+
@returns The stored item or `undefined`.
|
| 73 |
+
*/
|
| 74 |
+
get(key: KeyType): ValueType | undefined;
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
Check if an item exists.
|
| 78 |
+
*/
|
| 79 |
+
has(key: KeyType): boolean;
|
| 80 |
+
|
| 81 |
+
/**
|
| 82 |
+
Get an item without marking it as recently used.
|
| 83 |
+
|
| 84 |
+
@returns The stored item or `undefined`.
|
| 85 |
+
*/
|
| 86 |
+
peek(key: KeyType): ValueType | undefined;
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
Delete an item.
|
| 90 |
+
|
| 91 |
+
@returns `true` if the item is removed or `false` if the item doesn't exist.
|
| 92 |
+
*/
|
| 93 |
+
delete(key: KeyType): boolean;
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
Delete all items.
|
| 97 |
+
*/
|
| 98 |
+
clear(): void;
|
| 99 |
+
|
| 100 |
+
/**
|
| 101 |
+
Update the `maxSize` in-place, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee.
|
| 102 |
+
|
| 103 |
+
Useful for on-the-fly tuning of cache sizes in live systems.
|
| 104 |
+
*/
|
| 105 |
+
resize(maxSize: number): void;
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
Iterable for all the keys.
|
| 109 |
+
*/
|
| 110 |
+
keys(): IterableIterator<KeyType>;
|
| 111 |
+
|
| 112 |
+
/**
|
| 113 |
+
Iterable for all the values.
|
| 114 |
+
*/
|
| 115 |
+
values(): IterableIterator<ValueType>;
|
| 116 |
+
|
| 117 |
+
/**
|
| 118 |
+
Iterable for all entries, starting with the oldest (ascending in recency).
|
| 119 |
+
*/
|
| 120 |
+
entriesAscending(): IterableIterator<[KeyType, ValueType]>;
|
| 121 |
+
|
| 122 |
+
/**
|
| 123 |
+
Iterable for all entries, starting with the newest (descending in recency).
|
| 124 |
+
*/
|
| 125 |
+
entriesDescending(): IterableIterator<[KeyType, ValueType]>;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
export = QuickLRU;
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@alloc/quick-lru/index.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
class QuickLRU {
|
| 4 |
+
constructor(options = {}) {
|
| 5 |
+
if (!(options.maxSize && options.maxSize > 0)) {
|
| 6 |
+
throw new TypeError('`maxSize` must be a number greater than 0');
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
if (typeof options.maxAge === 'number' && options.maxAge === 0) {
|
| 10 |
+
throw new TypeError('`maxAge` must be a number greater than 0');
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
this.maxSize = options.maxSize;
|
| 14 |
+
this.maxAge = options.maxAge || Infinity;
|
| 15 |
+
this.onEviction = options.onEviction;
|
| 16 |
+
this.cache = new Map();
|
| 17 |
+
this.oldCache = new Map();
|
| 18 |
+
this._size = 0;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
_emitEvictions(cache) {
|
| 22 |
+
if (typeof this.onEviction !== 'function') {
|
| 23 |
+
return;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
for (const [key, item] of cache) {
|
| 27 |
+
this.onEviction(key, item.value);
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
_deleteIfExpired(key, item) {
|
| 32 |
+
if (typeof item.expiry === 'number' && item.expiry <= Date.now()) {
|
| 33 |
+
if (typeof this.onEviction === 'function') {
|
| 34 |
+
this.onEviction(key, item.value);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
return this.delete(key);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
return false;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
_getOrDeleteIfExpired(key, item) {
|
| 44 |
+
const deleted = this._deleteIfExpired(key, item);
|
| 45 |
+
if (deleted === false) {
|
| 46 |
+
return item.value;
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
_getItemValue(key, item) {
|
| 51 |
+
return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
_peek(key, cache) {
|
| 55 |
+
const item = cache.get(key);
|
| 56 |
+
|
| 57 |
+
return this._getItemValue(key, item);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
_set(key, value) {
|
| 61 |
+
this.cache.set(key, value);
|
| 62 |
+
this._size++;
|
| 63 |
+
|
| 64 |
+
if (this._size >= this.maxSize) {
|
| 65 |
+
this._size = 0;
|
| 66 |
+
this._emitEvictions(this.oldCache);
|
| 67 |
+
this.oldCache = this.cache;
|
| 68 |
+
this.cache = new Map();
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
_moveToRecent(key, item) {
|
| 73 |
+
this.oldCache.delete(key);
|
| 74 |
+
this._set(key, item);
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
* _entriesAscending() {
|
| 78 |
+
for (const item of this.oldCache) {
|
| 79 |
+
const [key, value] = item;
|
| 80 |
+
if (!this.cache.has(key)) {
|
| 81 |
+
const deleted = this._deleteIfExpired(key, value);
|
| 82 |
+
if (deleted === false) {
|
| 83 |
+
yield item;
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
for (const item of this.cache) {
|
| 89 |
+
const [key, value] = item;
|
| 90 |
+
const deleted = this._deleteIfExpired(key, value);
|
| 91 |
+
if (deleted === false) {
|
| 92 |
+
yield item;
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
get(key) {
|
| 98 |
+
if (this.cache.has(key)) {
|
| 99 |
+
const item = this.cache.get(key);
|
| 100 |
+
|
| 101 |
+
return this._getItemValue(key, item);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
if (this.oldCache.has(key)) {
|
| 105 |
+
const item = this.oldCache.get(key);
|
| 106 |
+
if (this._deleteIfExpired(key, item) === false) {
|
| 107 |
+
this._moveToRecent(key, item);
|
| 108 |
+
return item.value;
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
set(key, value, {maxAge = this.maxAge === Infinity ? undefined : Date.now() + this.maxAge} = {}) {
|
| 114 |
+
if (this.cache.has(key)) {
|
| 115 |
+
this.cache.set(key, {
|
| 116 |
+
value,
|
| 117 |
+
maxAge
|
| 118 |
+
});
|
| 119 |
+
} else {
|
| 120 |
+
this._set(key, {value, expiry: maxAge});
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
has(key) {
|
| 125 |
+
if (this.cache.has(key)) {
|
| 126 |
+
return !this._deleteIfExpired(key, this.cache.get(key));
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
if (this.oldCache.has(key)) {
|
| 130 |
+
return !this._deleteIfExpired(key, this.oldCache.get(key));
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
return false;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
peek(key) {
|
| 137 |
+
if (this.cache.has(key)) {
|
| 138 |
+
return this._peek(key, this.cache);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
if (this.oldCache.has(key)) {
|
| 142 |
+
return this._peek(key, this.oldCache);
|
| 143 |
+
}
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
delete(key) {
|
| 147 |
+
const deleted = this.cache.delete(key);
|
| 148 |
+
if (deleted) {
|
| 149 |
+
this._size--;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
return this.oldCache.delete(key) || deleted;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
clear() {
|
| 156 |
+
this.cache.clear();
|
| 157 |
+
this.oldCache.clear();
|
| 158 |
+
this._size = 0;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
resize(newSize) {
|
| 162 |
+
if (!(newSize && newSize > 0)) {
|
| 163 |
+
throw new TypeError('`maxSize` must be a number greater than 0');
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
const items = [...this._entriesAscending()];
|
| 167 |
+
const removeCount = items.length - newSize;
|
| 168 |
+
if (removeCount < 0) {
|
| 169 |
+
this.cache = new Map(items);
|
| 170 |
+
this.oldCache = new Map();
|
| 171 |
+
this._size = items.length;
|
| 172 |
+
} else {
|
| 173 |
+
if (removeCount > 0) {
|
| 174 |
+
this._emitEvictions(items.slice(0, removeCount));
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
this.oldCache = new Map(items.slice(removeCount));
|
| 178 |
+
this.cache = new Map();
|
| 179 |
+
this._size = 0;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
this.maxSize = newSize;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
* keys() {
|
| 186 |
+
for (const [key] of this) {
|
| 187 |
+
yield key;
|
| 188 |
+
}
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
* values() {
|
| 192 |
+
for (const [, value] of this) {
|
| 193 |
+
yield value;
|
| 194 |
+
}
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
* [Symbol.iterator]() {
|
| 198 |
+
for (const item of this.cache) {
|
| 199 |
+
const [key, value] = item;
|
| 200 |
+
const deleted = this._deleteIfExpired(key, value);
|
| 201 |
+
if (deleted === false) {
|
| 202 |
+
yield [key, value.value];
|
| 203 |
+
}
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
for (const item of this.oldCache) {
|
| 207 |
+
const [key, value] = item;
|
| 208 |
+
if (!this.cache.has(key)) {
|
| 209 |
+
const deleted = this._deleteIfExpired(key, value);
|
| 210 |
+
if (deleted === false) {
|
| 211 |
+
yield [key, value.value];
|
| 212 |
+
}
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
* entriesDescending() {
|
| 218 |
+
let items = [...this.cache];
|
| 219 |
+
for (let i = items.length - 1; i >= 0; --i) {
|
| 220 |
+
const item = items[i];
|
| 221 |
+
const [key, value] = item;
|
| 222 |
+
const deleted = this._deleteIfExpired(key, value);
|
| 223 |
+
if (deleted === false) {
|
| 224 |
+
yield [key, value.value];
|
| 225 |
+
}
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
items = [...this.oldCache];
|
| 229 |
+
for (let i = items.length - 1; i >= 0; --i) {
|
| 230 |
+
const item = items[i];
|
| 231 |
+
const [key, value] = item;
|
| 232 |
+
if (!this.cache.has(key)) {
|
| 233 |
+
const deleted = this._deleteIfExpired(key, value);
|
| 234 |
+
if (deleted === false) {
|
| 235 |
+
yield [key, value.value];
|
| 236 |
+
}
|
| 237 |
+
}
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
* entriesAscending() {
|
| 242 |
+
for (const [key, value] of this._entriesAscending()) {
|
| 243 |
+
yield [key, value.value];
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
get size() {
|
| 248 |
+
if (!this._size) {
|
| 249 |
+
return this.oldCache.size;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
let oldCacheSize = 0;
|
| 253 |
+
for (const key of this.oldCache.keys()) {
|
| 254 |
+
if (!this.cache.has(key)) {
|
| 255 |
+
oldCacheSize++;
|
| 256 |
+
}
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
return Math.min(this._size + oldCacheSize, this.maxSize);
|
| 260 |
+
}
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
module.exports = QuickLRU;
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@alloc/quick-lru/license
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
| 4 |
+
|
| 5 |
+
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:
|
| 6 |
+
|
| 7 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
| 8 |
+
|
| 9 |
+
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.
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@alloc/quick-lru/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@alloc/quick-lru",
|
| 3 |
+
"version": "5.2.0",
|
| 4 |
+
"description": "Simple “Least Recently Used” (LRU) cache",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"repository": "sindresorhus/quick-lru",
|
| 7 |
+
"funding": "https://github.com/sponsors/sindresorhus",
|
| 8 |
+
"author": {
|
| 9 |
+
"name": "Sindre Sorhus",
|
| 10 |
+
"email": "sindresorhus@gmail.com",
|
| 11 |
+
"url": "https://sindresorhus.com"
|
| 12 |
+
},
|
| 13 |
+
"engines": {
|
| 14 |
+
"node": ">=10"
|
| 15 |
+
},
|
| 16 |
+
"scripts": {
|
| 17 |
+
"test": "xo && nyc ava && tsd"
|
| 18 |
+
},
|
| 19 |
+
"files": [
|
| 20 |
+
"index.js",
|
| 21 |
+
"index.d.ts"
|
| 22 |
+
],
|
| 23 |
+
"keywords": [
|
| 24 |
+
"lru",
|
| 25 |
+
"quick",
|
| 26 |
+
"cache",
|
| 27 |
+
"caching",
|
| 28 |
+
"least",
|
| 29 |
+
"recently",
|
| 30 |
+
"used",
|
| 31 |
+
"fast",
|
| 32 |
+
"map",
|
| 33 |
+
"hash",
|
| 34 |
+
"buffer"
|
| 35 |
+
],
|
| 36 |
+
"devDependencies": {
|
| 37 |
+
"ava": "^2.0.0",
|
| 38 |
+
"coveralls": "^3.0.3",
|
| 39 |
+
"nyc": "^15.0.0",
|
| 40 |
+
"tsd": "^0.11.0",
|
| 41 |
+
"xo": "^0.26.0"
|
| 42 |
+
}
|
| 43 |
+
}
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@alloc/quick-lru/readme.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# quick-lru [](https://travis-ci.org/sindresorhus/quick-lru) [](https://coveralls.io/github/sindresorhus/quick-lru?branch=master)
|
| 2 |
+
|
| 3 |
+
> Simple [“Least Recently Used” (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29)
|
| 4 |
+
|
| 5 |
+
Useful when you need to cache something and limit memory usage.
|
| 6 |
+
|
| 7 |
+
Inspired by the [`hashlru` algorithm](https://github.com/dominictarr/hashlru#algorithm), but instead uses [`Map`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map) to support keys of any type, not just strings, and values can be `undefined`.
|
| 8 |
+
|
| 9 |
+
## Install
|
| 10 |
+
|
| 11 |
+
```
|
| 12 |
+
$ npm install quick-lru
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
## Usage
|
| 16 |
+
|
| 17 |
+
```js
|
| 18 |
+
const QuickLRU = require('quick-lru');
|
| 19 |
+
|
| 20 |
+
const lru = new QuickLRU({maxSize: 1000});
|
| 21 |
+
|
| 22 |
+
lru.set('🦄', '🌈');
|
| 23 |
+
|
| 24 |
+
lru.has('🦄');
|
| 25 |
+
//=> true
|
| 26 |
+
|
| 27 |
+
lru.get('🦄');
|
| 28 |
+
//=> '🌈'
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
## API
|
| 32 |
+
|
| 33 |
+
### new QuickLRU(options?)
|
| 34 |
+
|
| 35 |
+
Returns a new instance.
|
| 36 |
+
|
| 37 |
+
### options
|
| 38 |
+
|
| 39 |
+
Type: `object`
|
| 40 |
+
|
| 41 |
+
#### maxSize
|
| 42 |
+
|
| 43 |
+
*Required*\
|
| 44 |
+
Type: `number`
|
| 45 |
+
|
| 46 |
+
The maximum number of items before evicting the least recently used items.
|
| 47 |
+
|
| 48 |
+
#### maxAge
|
| 49 |
+
|
| 50 |
+
Type: `number`\
|
| 51 |
+
Default: `Infinity`
|
| 52 |
+
|
| 53 |
+
The maximum number of milliseconds an item should remain in cache.
|
| 54 |
+
By default maxAge will be Infinity, which means that items will never expire.
|
| 55 |
+
|
| 56 |
+
Lazy expiration happens upon the next `write` or `read` call.
|
| 57 |
+
|
| 58 |
+
Individual expiration of an item can be specified by the `set(key, value, options)` method.
|
| 59 |
+
|
| 60 |
+
#### onEviction
|
| 61 |
+
|
| 62 |
+
*Optional*\
|
| 63 |
+
Type: `(key, value) => void`
|
| 64 |
+
|
| 65 |
+
Called right before an item is evicted from the cache.
|
| 66 |
+
|
| 67 |
+
Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`).
|
| 68 |
+
|
| 69 |
+
### Instance
|
| 70 |
+
|
| 71 |
+
The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop.
|
| 72 |
+
|
| 73 |
+
Both `key` and `value` can be of any type.
|
| 74 |
+
|
| 75 |
+
#### .set(key, value, options?)
|
| 76 |
+
|
| 77 |
+
Set an item. Returns the instance.
|
| 78 |
+
|
| 79 |
+
Individual expiration of an item can be specified with the `maxAge` option. If not specified, the global `maxAge` value will be used in case it is specified on the constructor, otherwise the item will never expire.
|
| 80 |
+
|
| 81 |
+
#### .get(key)
|
| 82 |
+
|
| 83 |
+
Get an item.
|
| 84 |
+
|
| 85 |
+
#### .has(key)
|
| 86 |
+
|
| 87 |
+
Check if an item exists.
|
| 88 |
+
|
| 89 |
+
#### .peek(key)
|
| 90 |
+
|
| 91 |
+
Get an item without marking it as recently used.
|
| 92 |
+
|
| 93 |
+
#### .delete(key)
|
| 94 |
+
|
| 95 |
+
Delete an item.
|
| 96 |
+
|
| 97 |
+
Returns `true` if the item is removed or `false` if the item doesn't exist.
|
| 98 |
+
|
| 99 |
+
#### .clear()
|
| 100 |
+
|
| 101 |
+
Delete all items.
|
| 102 |
+
|
| 103 |
+
#### .resize(maxSize)
|
| 104 |
+
|
| 105 |
+
Update the `maxSize`, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee.
|
| 106 |
+
|
| 107 |
+
Useful for on-the-fly tuning of cache sizes in live systems.
|
| 108 |
+
|
| 109 |
+
#### .keys()
|
| 110 |
+
|
| 111 |
+
Iterable for all the keys.
|
| 112 |
+
|
| 113 |
+
#### .values()
|
| 114 |
+
|
| 115 |
+
Iterable for all the values.
|
| 116 |
+
|
| 117 |
+
#### .entriesAscending()
|
| 118 |
+
|
| 119 |
+
Iterable for all entries, starting with the oldest (ascending in recency).
|
| 120 |
+
|
| 121 |
+
#### .entriesDescending()
|
| 122 |
+
|
| 123 |
+
Iterable for all entries, starting with the newest (descending in recency).
|
| 124 |
+
|
| 125 |
+
#### .size
|
| 126 |
+
|
| 127 |
+
The stored item count.
|
| 128 |
+
|
| 129 |
+
---
|
| 130 |
+
|
| 131 |
+
<div align="center">
|
| 132 |
+
<b>
|
| 133 |
+
<a href="https://tidelift.com/subscription/pkg/npm-quick-lru?utm_source=npm-quick-lru&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
| 134 |
+
</b>
|
| 135 |
+
<br>
|
| 136 |
+
<sub>
|
| 137 |
+
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
| 138 |
+
</sub>
|
| 139 |
+
</div>
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2021 Martin Heidegger
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/Readme.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @leichtgewicht/ip-codec
|
| 2 |
+
|
| 3 |
+
Small package to encode or decode IP addresses from buffers to strings.
|
| 4 |
+
Supports IPV4 and IPV6.
|
| 5 |
+
|
| 6 |
+
## Usage
|
| 7 |
+
|
| 8 |
+
The basics are straigthforward
|
| 9 |
+
|
| 10 |
+
```js
|
| 11 |
+
import { encode, decode, sizeOf, familyOf } from '@leichtgewicht/ip-codec'
|
| 12 |
+
|
| 13 |
+
const uint8Array = encode("127.0.0.1")
|
| 14 |
+
const str = decode(uint8Array)
|
| 15 |
+
|
| 16 |
+
try {
|
| 17 |
+
switch sizeOf(str) {
|
| 18 |
+
case 4: // IPv4
|
| 19 |
+
case 16: // IPv6
|
| 20 |
+
}
|
| 21 |
+
switch familyOf(str) {
|
| 22 |
+
case: 1: // IPv4
|
| 23 |
+
case: 2: // IPv6
|
| 24 |
+
}
|
| 25 |
+
} catch (err) {
|
| 26 |
+
// Invalid IP
|
| 27 |
+
}
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
By default the library will work with Uint8Array's but you can bring your own buffer:
|
| 31 |
+
|
| 32 |
+
```js
|
| 33 |
+
const buf = Buffer.alloc(4)
|
| 34 |
+
encode('127.0.0.1', buf)
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
It is also possible to de-encode at a location inside a given buffer
|
| 38 |
+
|
| 39 |
+
```js
|
| 40 |
+
const buf = Buffer.alloc(10)
|
| 41 |
+
encode('127.0.0.1', buf, 4)
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
Allocation of a buffer may be difficult if you don't know what type the buffer:
|
| 45 |
+
you can pass in a generator to allocate it for you:
|
| 46 |
+
|
| 47 |
+
```js
|
| 48 |
+
encode('127.0.0.1', Buffer.alloc)
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
You can also de/encode ipv4 or ipv6 specifically:
|
| 52 |
+
|
| 53 |
+
```js
|
| 54 |
+
import { v4, v6 } from '@leichtgewicht/ip-codec'
|
| 55 |
+
|
| 56 |
+
v4.decode(v4.encode('127.0.0.1'))
|
| 57 |
+
v6.decode(v6.encode('::'))
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## History
|
| 61 |
+
|
| 62 |
+
The code in this package was originally extracted from [node-ip](https://github.com/indutny/node-ip) and since improved.
|
| 63 |
+
|
| 64 |
+
Notable changes are the removal of the `Buffer` dependency and better support for detection of
|
| 65 |
+
formats and allocation of buffers.
|
| 66 |
+
|
| 67 |
+
## License
|
| 68 |
+
|
| 69 |
+
[MIT](./LICENSE)
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/index.cjs
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// GENERATED FILE. DO NOT EDIT.
|
| 2 |
+
var ipCodec = (function(exports) {
|
| 3 |
+
"use strict";
|
| 4 |
+
|
| 5 |
+
Object.defineProperty(exports, "__esModule", {
|
| 6 |
+
value: true
|
| 7 |
+
});
|
| 8 |
+
exports.decode = decode;
|
| 9 |
+
exports.encode = encode;
|
| 10 |
+
exports.familyOf = familyOf;
|
| 11 |
+
exports.name = void 0;
|
| 12 |
+
exports.sizeOf = sizeOf;
|
| 13 |
+
exports.v6 = exports.v4 = void 0;
|
| 14 |
+
const v4Regex = /^(\d{1,3}\.){3,3}\d{1,3}$/;
|
| 15 |
+
const v4Size = 4;
|
| 16 |
+
const v6Regex = /^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;
|
| 17 |
+
const v6Size = 16;
|
| 18 |
+
const v4 = {
|
| 19 |
+
name: 'v4',
|
| 20 |
+
size: v4Size,
|
| 21 |
+
isFormat: ip => v4Regex.test(ip),
|
| 22 |
+
|
| 23 |
+
encode(ip, buff, offset) {
|
| 24 |
+
offset = ~~offset;
|
| 25 |
+
buff = buff || new Uint8Array(offset + v4Size);
|
| 26 |
+
const max = ip.length;
|
| 27 |
+
let n = 0;
|
| 28 |
+
|
| 29 |
+
for (let i = 0; i < max;) {
|
| 30 |
+
const c = ip.charCodeAt(i++);
|
| 31 |
+
|
| 32 |
+
if (c === 46) {
|
| 33 |
+
// "."
|
| 34 |
+
buff[offset++] = n;
|
| 35 |
+
n = 0;
|
| 36 |
+
} else {
|
| 37 |
+
n = n * 10 + (c - 48);
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
buff[offset] = n;
|
| 42 |
+
return buff;
|
| 43 |
+
},
|
| 44 |
+
|
| 45 |
+
decode(buff, offset) {
|
| 46 |
+
offset = ~~offset;
|
| 47 |
+
return `${buff[offset++]}.${buff[offset++]}.${buff[offset++]}.${buff[offset]}`;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
};
|
| 51 |
+
exports.v4 = v4;
|
| 52 |
+
const v6 = {
|
| 53 |
+
name: 'v6',
|
| 54 |
+
size: v6Size,
|
| 55 |
+
isFormat: ip => ip.length > 0 && v6Regex.test(ip),
|
| 56 |
+
|
| 57 |
+
encode(ip, buff, offset) {
|
| 58 |
+
offset = ~~offset;
|
| 59 |
+
let end = offset + v6Size;
|
| 60 |
+
let fill = -1;
|
| 61 |
+
let hexN = 0;
|
| 62 |
+
let decN = 0;
|
| 63 |
+
let prevColon = true;
|
| 64 |
+
let useDec = false;
|
| 65 |
+
buff = buff || new Uint8Array(offset + v6Size); // Note: This algorithm needs to check if the offset
|
| 66 |
+
// could exceed the buffer boundaries as it supports
|
| 67 |
+
// non-standard compliant encodings that may go beyond
|
| 68 |
+
// the boundary limits. if (offset < end) checks should
|
| 69 |
+
// not be necessary...
|
| 70 |
+
|
| 71 |
+
for (let i = 0; i < ip.length; i++) {
|
| 72 |
+
let c = ip.charCodeAt(i);
|
| 73 |
+
|
| 74 |
+
if (c === 58) {
|
| 75 |
+
// :
|
| 76 |
+
if (prevColon) {
|
| 77 |
+
if (fill !== -1) {
|
| 78 |
+
// Not Standard! (standard doesn't allow multiple ::)
|
| 79 |
+
// We need to treat
|
| 80 |
+
if (offset < end) buff[offset] = 0;
|
| 81 |
+
if (offset < end - 1) buff[offset + 1] = 0;
|
| 82 |
+
offset += 2;
|
| 83 |
+
} else if (offset < end) {
|
| 84 |
+
// :: in the middle
|
| 85 |
+
fill = offset;
|
| 86 |
+
}
|
| 87 |
+
} else {
|
| 88 |
+
// : ends the previous number
|
| 89 |
+
if (useDec === true) {
|
| 90 |
+
// Non-standard! (ipv4 should be at end only)
|
| 91 |
+
// A ipv4 address should not be found anywhere else but at
|
| 92 |
+
// the end. This codec also support putting characters
|
| 93 |
+
// after the ipv4 address..
|
| 94 |
+
if (offset < end) buff[offset] = decN;
|
| 95 |
+
offset++;
|
| 96 |
+
} else {
|
| 97 |
+
if (offset < end) buff[offset] = hexN >> 8;
|
| 98 |
+
if (offset < end - 1) buff[offset + 1] = hexN & 0xff;
|
| 99 |
+
offset += 2;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
hexN = 0;
|
| 103 |
+
decN = 0;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
prevColon = true;
|
| 107 |
+
useDec = false;
|
| 108 |
+
} else if (c === 46) {
|
| 109 |
+
// . indicates IPV4 notation
|
| 110 |
+
if (offset < end) buff[offset] = decN;
|
| 111 |
+
offset++;
|
| 112 |
+
decN = 0;
|
| 113 |
+
hexN = 0;
|
| 114 |
+
prevColon = false;
|
| 115 |
+
useDec = true;
|
| 116 |
+
} else {
|
| 117 |
+
prevColon = false;
|
| 118 |
+
|
| 119 |
+
if (c >= 97) {
|
| 120 |
+
c -= 87; // a-f ... 97~102 -87 => 10~15
|
| 121 |
+
} else if (c >= 65) {
|
| 122 |
+
c -= 55; // A-F ... 65~70 -55 => 10~15
|
| 123 |
+
} else {
|
| 124 |
+
c -= 48; // 0-9 ... starting from charCode 48
|
| 125 |
+
|
| 126 |
+
decN = decN * 10 + c;
|
| 127 |
+
} // We don't know yet if its a dec or hex number
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
hexN = (hexN << 4) + c;
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
if (prevColon === false) {
|
| 135 |
+
// Commiting last number
|
| 136 |
+
if (useDec === true) {
|
| 137 |
+
if (offset < end) buff[offset] = decN;
|
| 138 |
+
offset++;
|
| 139 |
+
} else {
|
| 140 |
+
if (offset < end) buff[offset] = hexN >> 8;
|
| 141 |
+
if (offset < end - 1) buff[offset + 1] = hexN & 0xff;
|
| 142 |
+
offset += 2;
|
| 143 |
+
}
|
| 144 |
+
} else if (fill === 0) {
|
| 145 |
+
// Not Standard! (standard doesn't allow multiple ::)
|
| 146 |
+
// This means that a : was found at the start AND end which means the
|
| 147 |
+
// end needs to be treated as 0 entry...
|
| 148 |
+
if (offset < end) buff[offset] = 0;
|
| 149 |
+
if (offset < end - 1) buff[offset + 1] = 0;
|
| 150 |
+
offset += 2;
|
| 151 |
+
} else if (fill !== -1) {
|
| 152 |
+
// Non-standard! (standard doens't allow multiple ::)
|
| 153 |
+
// Here we find that there has been a :: somewhere in the middle
|
| 154 |
+
// and the end. To treat the end with priority we need to move all
|
| 155 |
+
// written data two bytes to the right.
|
| 156 |
+
offset += 2;
|
| 157 |
+
|
| 158 |
+
for (let i = Math.min(offset - 1, end - 1); i >= fill + 2; i--) {
|
| 159 |
+
buff[i] = buff[i - 2];
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
buff[fill] = 0;
|
| 163 |
+
buff[fill + 1] = 0;
|
| 164 |
+
fill = offset;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
if (fill !== offset && fill !== -1) {
|
| 168 |
+
// Move the written numbers to the end while filling the everything
|
| 169 |
+
// "fill" to the bytes with zeros.
|
| 170 |
+
if (offset > end - 2) {
|
| 171 |
+
// Non Standard support, when the cursor exceeds bounds.
|
| 172 |
+
offset = end - 2;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
while (end > fill) {
|
| 176 |
+
buff[--end] = offset < end && offset > fill ? buff[--offset] : 0;
|
| 177 |
+
}
|
| 178 |
+
} else {
|
| 179 |
+
// Fill the rest with zeros
|
| 180 |
+
while (offset < end) {
|
| 181 |
+
buff[offset++] = 0;
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
return buff;
|
| 186 |
+
},
|
| 187 |
+
|
| 188 |
+
decode(buff, offset) {
|
| 189 |
+
offset = ~~offset;
|
| 190 |
+
let result = '';
|
| 191 |
+
|
| 192 |
+
for (let i = 0; i < v6Size; i += 2) {
|
| 193 |
+
if (i !== 0) {
|
| 194 |
+
result += ':';
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
result += (buff[offset + i] << 8 | buff[offset + i + 1]).toString(16);
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
return result.replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3').replace(/:{3,4}/, '::');
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
};
|
| 204 |
+
exports.v6 = v6;
|
| 205 |
+
const name = 'ip';
|
| 206 |
+
exports.name = name;
|
| 207 |
+
|
| 208 |
+
function sizeOf(ip) {
|
| 209 |
+
if (v4.isFormat(ip)) return v4.size;
|
| 210 |
+
if (v6.isFormat(ip)) return v6.size;
|
| 211 |
+
throw Error(`Invalid ip address: ${ip}`);
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
function familyOf(string) {
|
| 215 |
+
return sizeOf(string) === v4.size ? 1 : 2;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
function encode(ip, buff, offset) {
|
| 219 |
+
offset = ~~offset;
|
| 220 |
+
const size = sizeOf(ip);
|
| 221 |
+
|
| 222 |
+
if (typeof buff === 'function') {
|
| 223 |
+
buff = buff(offset + size);
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
if (size === v4.size) {
|
| 227 |
+
return v4.encode(ip, buff, offset);
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
return v6.encode(ip, buff, offset);
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
function decode(buff, offset, length) {
|
| 234 |
+
offset = ~~offset;
|
| 235 |
+
length = length || buff.length - offset;
|
| 236 |
+
|
| 237 |
+
if (length === v4.size) {
|
| 238 |
+
return v4.decode(buff, offset, length);
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
if (length === v6.size) {
|
| 242 |
+
return v6.decode(buff, offset, length);
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
throw Error(`Invalid buffer size needs to be ${v4.size} for v4 or ${v6.size} for v6.`);
|
| 246 |
+
}
|
| 247 |
+
return "default" in exports ? exports.default : exports;
|
| 248 |
+
})({});
|
| 249 |
+
if (typeof define === 'function' && define.amd) define([], function() { return ipCodec; });
|
| 250 |
+
else if (typeof module === 'object' && typeof exports==='object') module.exports = ipCodec;
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/index.mjs
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const v4Regex = /^(\d{1,3}\.){3,3}\d{1,3}$/
|
| 2 |
+
const v4Size = 4
|
| 3 |
+
const v6Regex = /^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i
|
| 4 |
+
const v6Size = 16
|
| 5 |
+
|
| 6 |
+
export const v4 = {
|
| 7 |
+
name: 'v4',
|
| 8 |
+
size: v4Size,
|
| 9 |
+
isFormat: ip => v4Regex.test(ip),
|
| 10 |
+
encode (ip, buff, offset) {
|
| 11 |
+
offset = ~~offset
|
| 12 |
+
buff = buff || new Uint8Array(offset + v4Size)
|
| 13 |
+
const max = ip.length
|
| 14 |
+
let n = 0
|
| 15 |
+
for (let i = 0; i < max;) {
|
| 16 |
+
const c = ip.charCodeAt(i++)
|
| 17 |
+
if (c === 46) { // "."
|
| 18 |
+
buff[offset++] = n
|
| 19 |
+
n = 0
|
| 20 |
+
} else {
|
| 21 |
+
n = n * 10 + (c - 48)
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
buff[offset] = n
|
| 25 |
+
return buff
|
| 26 |
+
},
|
| 27 |
+
decode (buff, offset) {
|
| 28 |
+
offset = ~~offset
|
| 29 |
+
return `${buff[offset++]}.${buff[offset++]}.${buff[offset++]}.${buff[offset]}`
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
export const v6 = {
|
| 34 |
+
name: 'v6',
|
| 35 |
+
size: v6Size,
|
| 36 |
+
isFormat: ip => ip.length > 0 && v6Regex.test(ip),
|
| 37 |
+
encode (ip, buff, offset) {
|
| 38 |
+
offset = ~~offset
|
| 39 |
+
let end = offset + v6Size
|
| 40 |
+
let fill = -1
|
| 41 |
+
let hexN = 0
|
| 42 |
+
let decN = 0
|
| 43 |
+
let prevColon = true
|
| 44 |
+
let useDec = false
|
| 45 |
+
buff = buff || new Uint8Array(offset + v6Size)
|
| 46 |
+
// Note: This algorithm needs to check if the offset
|
| 47 |
+
// could exceed the buffer boundaries as it supports
|
| 48 |
+
// non-standard compliant encodings that may go beyond
|
| 49 |
+
// the boundary limits. if (offset < end) checks should
|
| 50 |
+
// not be necessary...
|
| 51 |
+
for (let i = 0; i < ip.length; i++) {
|
| 52 |
+
let c = ip.charCodeAt(i)
|
| 53 |
+
if (c === 58) { // :
|
| 54 |
+
if (prevColon) {
|
| 55 |
+
if (fill !== -1) {
|
| 56 |
+
// Not Standard! (standard doesn't allow multiple ::)
|
| 57 |
+
// We need to treat
|
| 58 |
+
if (offset < end) buff[offset] = 0
|
| 59 |
+
if (offset < end - 1) buff[offset + 1] = 0
|
| 60 |
+
offset += 2
|
| 61 |
+
} else if (offset < end) {
|
| 62 |
+
// :: in the middle
|
| 63 |
+
fill = offset
|
| 64 |
+
}
|
| 65 |
+
} else {
|
| 66 |
+
// : ends the previous number
|
| 67 |
+
if (useDec === true) {
|
| 68 |
+
// Non-standard! (ipv4 should be at end only)
|
| 69 |
+
// A ipv4 address should not be found anywhere else but at
|
| 70 |
+
// the end. This codec also support putting characters
|
| 71 |
+
// after the ipv4 address..
|
| 72 |
+
if (offset < end) buff[offset] = decN
|
| 73 |
+
offset++
|
| 74 |
+
} else {
|
| 75 |
+
if (offset < end) buff[offset] = hexN >> 8
|
| 76 |
+
if (offset < end - 1) buff[offset + 1] = hexN & 0xff
|
| 77 |
+
offset += 2
|
| 78 |
+
}
|
| 79 |
+
hexN = 0
|
| 80 |
+
decN = 0
|
| 81 |
+
}
|
| 82 |
+
prevColon = true
|
| 83 |
+
useDec = false
|
| 84 |
+
} else if (c === 46) { // . indicates IPV4 notation
|
| 85 |
+
if (offset < end) buff[offset] = decN
|
| 86 |
+
offset++
|
| 87 |
+
decN = 0
|
| 88 |
+
hexN = 0
|
| 89 |
+
prevColon = false
|
| 90 |
+
useDec = true
|
| 91 |
+
} else {
|
| 92 |
+
prevColon = false
|
| 93 |
+
if (c >= 97) {
|
| 94 |
+
c -= 87 // a-f ... 97~102 -87 => 10~15
|
| 95 |
+
} else if (c >= 65) {
|
| 96 |
+
c -= 55 // A-F ... 65~70 -55 => 10~15
|
| 97 |
+
} else {
|
| 98 |
+
c -= 48 // 0-9 ... starting from charCode 48
|
| 99 |
+
decN = decN * 10 + c
|
| 100 |
+
}
|
| 101 |
+
// We don't know yet if its a dec or hex number
|
| 102 |
+
hexN = (hexN << 4) + c
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
if (prevColon === false) {
|
| 106 |
+
// Commiting last number
|
| 107 |
+
if (useDec === true) {
|
| 108 |
+
if (offset < end) buff[offset] = decN
|
| 109 |
+
offset++
|
| 110 |
+
} else {
|
| 111 |
+
if (offset < end) buff[offset] = hexN >> 8
|
| 112 |
+
if (offset < end - 1) buff[offset + 1] = hexN & 0xff
|
| 113 |
+
offset += 2
|
| 114 |
+
}
|
| 115 |
+
} else if (fill === 0) {
|
| 116 |
+
// Not Standard! (standard doesn't allow multiple ::)
|
| 117 |
+
// This means that a : was found at the start AND end which means the
|
| 118 |
+
// end needs to be treated as 0 entry...
|
| 119 |
+
if (offset < end) buff[offset] = 0
|
| 120 |
+
if (offset < end - 1) buff[offset + 1] = 0
|
| 121 |
+
offset += 2
|
| 122 |
+
} else if (fill !== -1) {
|
| 123 |
+
// Non-standard! (standard doens't allow multiple ::)
|
| 124 |
+
// Here we find that there has been a :: somewhere in the middle
|
| 125 |
+
// and the end. To treat the end with priority we need to move all
|
| 126 |
+
// written data two bytes to the right.
|
| 127 |
+
offset += 2
|
| 128 |
+
for (let i = Math.min(offset - 1, end - 1); i >= fill + 2; i--) {
|
| 129 |
+
buff[i] = buff[i - 2]
|
| 130 |
+
}
|
| 131 |
+
buff[fill] = 0
|
| 132 |
+
buff[fill + 1] = 0
|
| 133 |
+
fill = offset
|
| 134 |
+
}
|
| 135 |
+
if (fill !== offset && fill !== -1) {
|
| 136 |
+
// Move the written numbers to the end while filling the everything
|
| 137 |
+
// "fill" to the bytes with zeros.
|
| 138 |
+
if (offset > end - 2) {
|
| 139 |
+
// Non Standard support, when the cursor exceeds bounds.
|
| 140 |
+
offset = end - 2
|
| 141 |
+
}
|
| 142 |
+
while (end > fill) {
|
| 143 |
+
buff[--end] = offset < end && offset > fill ? buff[--offset] : 0
|
| 144 |
+
}
|
| 145 |
+
} else {
|
| 146 |
+
// Fill the rest with zeros
|
| 147 |
+
while (offset < end) {
|
| 148 |
+
buff[offset++] = 0
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
return buff
|
| 152 |
+
},
|
| 153 |
+
decode (buff, offset) {
|
| 154 |
+
offset = ~~offset
|
| 155 |
+
let result = ''
|
| 156 |
+
for (let i = 0; i < v6Size; i += 2) {
|
| 157 |
+
if (i !== 0) {
|
| 158 |
+
result += ':'
|
| 159 |
+
}
|
| 160 |
+
result += (buff[offset + i] << 8 | buff[offset + i + 1]).toString(16)
|
| 161 |
+
}
|
| 162 |
+
return result
|
| 163 |
+
.replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3')
|
| 164 |
+
.replace(/:{3,4}/, '::')
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
export const name = 'ip'
|
| 169 |
+
export function sizeOf (ip) {
|
| 170 |
+
if (v4.isFormat(ip)) return v4.size
|
| 171 |
+
if (v6.isFormat(ip)) return v6.size
|
| 172 |
+
throw Error(`Invalid ip address: ${ip}`)
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
export function familyOf (string) {
|
| 176 |
+
return sizeOf(string) === v4.size ? 1 : 2
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
export function encode (ip, buff, offset) {
|
| 180 |
+
offset = ~~offset
|
| 181 |
+
const size = sizeOf(ip)
|
| 182 |
+
if (typeof buff === 'function') {
|
| 183 |
+
buff = buff(offset + size)
|
| 184 |
+
}
|
| 185 |
+
if (size === v4.size) {
|
| 186 |
+
return v4.encode(ip, buff, offset)
|
| 187 |
+
}
|
| 188 |
+
return v6.encode(ip, buff, offset)
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
export function decode (buff, offset, length) {
|
| 192 |
+
offset = ~~offset
|
| 193 |
+
length = length || (buff.length - offset)
|
| 194 |
+
if (length === v4.size) {
|
| 195 |
+
return v4.decode(buff, offset, length)
|
| 196 |
+
}
|
| 197 |
+
if (length === v6.size) {
|
| 198 |
+
return v6.decode(buff, offset, length)
|
| 199 |
+
}
|
| 200 |
+
throw Error(`Invalid buffer size needs to be ${v4.size} for v4 or ${v6.size} for v6.`)
|
| 201 |
+
}
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@leichtgewicht/ip-codec",
|
| 3 |
+
"version": "2.0.5",
|
| 4 |
+
"description": "Small package to encode or decode IP addresses from buffers to strings.",
|
| 5 |
+
"main": "index.cjs",
|
| 6 |
+
"types": "types",
|
| 7 |
+
"exports": {
|
| 8 |
+
".": {
|
| 9 |
+
"types": "./types/index.d.ts",
|
| 10 |
+
"import": "./index.mjs",
|
| 11 |
+
"require": "./index.cjs"
|
| 12 |
+
}
|
| 13 |
+
},
|
| 14 |
+
"scripts": {
|
| 15 |
+
"lint": "standard && dtslint --localTs node_modules/typescript/lib types",
|
| 16 |
+
"test": "npm run lint && npm run unit",
|
| 17 |
+
"unit": "fresh-tape test.mjs",
|
| 18 |
+
"coverage": "c8 npm run unit",
|
| 19 |
+
"prepare": "npx @leichtgewicht/esm2umd ipCodec"
|
| 20 |
+
},
|
| 21 |
+
"repository": {
|
| 22 |
+
"type": "git",
|
| 23 |
+
"url": "git+https://github.com/martinheidegger/ip-codec.git"
|
| 24 |
+
},
|
| 25 |
+
"keywords": [
|
| 26 |
+
"ip",
|
| 27 |
+
"ipv4",
|
| 28 |
+
"ipv6",
|
| 29 |
+
"codec",
|
| 30 |
+
"codecs",
|
| 31 |
+
"buffer",
|
| 32 |
+
"conversion"
|
| 33 |
+
],
|
| 34 |
+
"author": "Martin Heidegger",
|
| 35 |
+
"license": "MIT",
|
| 36 |
+
"bugs": {
|
| 37 |
+
"url": "https://github.com/martinheidegger/ip-codec/issues"
|
| 38 |
+
},
|
| 39 |
+
"homepage": "https://github.com/martinheidegger/ip-codec#readme",
|
| 40 |
+
"devDependencies": {
|
| 41 |
+
"@definitelytyped/dtslint": "0.2.19",
|
| 42 |
+
"@leichtgewicht/esm2umd": "^0.4.0",
|
| 43 |
+
"c8": "^9.1.0",
|
| 44 |
+
"fresh-tape": "^5.5.3",
|
| 45 |
+
"standard": "^17.1.0",
|
| 46 |
+
"typescript": "^5.4.3"
|
| 47 |
+
}
|
| 48 |
+
}
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@leichtgewicht/ip-codec/types/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
interface Encoder {
|
| 2 |
+
(ip: string): Uint8Array;
|
| 3 |
+
<TIn extends Uint8Array = Uint8Array> (ip: string, buff: TIn, offset?: number): TIn;
|
| 4 |
+
}
|
| 5 |
+
type Decoder = (ip: Uint8Array, offset?: number) => string;
|
| 6 |
+
|
| 7 |
+
interface Codec<TName extends string, TSize extends number> {
|
| 8 |
+
name: TName;
|
| 9 |
+
size: TSize;
|
| 10 |
+
encode: Encoder;
|
| 11 |
+
decode: Decoder;
|
| 12 |
+
isFormat(ip: string): boolean;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export function sizeOf(ip: string): 4 | 16;
|
| 16 |
+
export function familyOf(ip: string): 1 | 2;
|
| 17 |
+
export const v4: Codec<"ipv4", 4>;
|
| 18 |
+
export const v6: Codec<"ipv6", 16>;
|
| 19 |
+
export const name: "ip";
|
| 20 |
+
export const encode: {
|
| 21 |
+
(ip: string): Uint8Array;
|
| 22 |
+
<TIn extends Uint8Array = Uint8Array> (ip: string, buff: TIn | ((size: number) => TIn), offset?: number): TIn
|
| 23 |
+
};
|
| 24 |
+
export function decode(ip: Uint8Array, offset?: number, length?: number): string;
|
| 25 |
+
|
| 26 |
+
export {};
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/.editorconfig
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EditorConfig is awesome: http://EditorConfig.org
|
| 2 |
+
|
| 3 |
+
# top-most EditorConfig file
|
| 4 |
+
root = true
|
| 5 |
+
|
| 6 |
+
# Copied from Node.js to ease compatibility in PR.
|
| 7 |
+
[*]
|
| 8 |
+
charset = utf-8
|
| 9 |
+
end_of_line = lf
|
| 10 |
+
indent_size = 2
|
| 11 |
+
indent_style = space
|
| 12 |
+
insert_final_newline = true
|
| 13 |
+
trim_trailing_whitespace = true
|
| 14 |
+
quote_type = single
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/CHANGELOG.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
## [0.11.0](https://github.com/pkgjs/parseargs/compare/v0.10.0...v0.11.0) (2022-10-08)
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
### Features
|
| 7 |
+
|
| 8 |
+
* add `default` option parameter ([#142](https://github.com/pkgjs/parseargs/issues/142)) ([cd20847](https://github.com/pkgjs/parseargs/commit/cd20847a00b2f556aa9c085ac83b942c60868ec1))
|
| 9 |
+
|
| 10 |
+
## [0.10.0](https://github.com/pkgjs/parseargs/compare/v0.9.1...v0.10.0) (2022-07-21)
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
### Features
|
| 14 |
+
|
| 15 |
+
* add parsed meta-data to returned properties ([#129](https://github.com/pkgjs/parseargs/issues/129)) ([91bfb4d](https://github.com/pkgjs/parseargs/commit/91bfb4d3f7b6937efab1b27c91c45d1205f1497e))
|
| 16 |
+
|
| 17 |
+
## [0.9.1](https://github.com/pkgjs/parseargs/compare/v0.9.0...v0.9.1) (2022-06-20)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
### Bug Fixes
|
| 21 |
+
|
| 22 |
+
* **runtime:** support node 14+ ([#135](https://github.com/pkgjs/parseargs/issues/135)) ([6a1c5a6](https://github.com/pkgjs/parseargs/commit/6a1c5a6f7cadf2f035e004027e2742e3c4ce554b))
|
| 23 |
+
|
| 24 |
+
## [0.9.0](https://github.com/pkgjs/parseargs/compare/v0.8.0...v0.9.0) (2022-05-23)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
### ⚠ BREAKING CHANGES
|
| 28 |
+
|
| 29 |
+
* drop handling of electron arguments (#121)
|
| 30 |
+
|
| 31 |
+
### Code Refactoring
|
| 32 |
+
|
| 33 |
+
* drop handling of electron arguments ([#121](https://github.com/pkgjs/parseargs/issues/121)) ([a2ffd53](https://github.com/pkgjs/parseargs/commit/a2ffd537c244a062371522b955acb45a404fc9f2))
|
| 34 |
+
|
| 35 |
+
## [0.8.0](https://github.com/pkgjs/parseargs/compare/v0.7.1...v0.8.0) (2022-05-16)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
### ⚠ BREAKING CHANGES
|
| 39 |
+
|
| 40 |
+
* switch type:string option arguments to greedy, but with error for suspect cases in strict mode (#88)
|
| 41 |
+
* positionals now opt-in when strict:true (#116)
|
| 42 |
+
* create result.values with null prototype (#111)
|
| 43 |
+
|
| 44 |
+
### Features
|
| 45 |
+
|
| 46 |
+
* create result.values with null prototype ([#111](https://github.com/pkgjs/parseargs/issues/111)) ([9d539c3](https://github.com/pkgjs/parseargs/commit/9d539c3d57f269c160e74e0656ad4fa84ff92ec2))
|
| 47 |
+
* positionals now opt-in when strict:true ([#116](https://github.com/pkgjs/parseargs/issues/116)) ([3643338](https://github.com/pkgjs/parseargs/commit/364333826b746e8a7dc5505b4b22fd19ac51df3b))
|
| 48 |
+
* switch type:string option arguments to greedy, but with error for suspect cases in strict mode ([#88](https://github.com/pkgjs/parseargs/issues/88)) ([c2b5e72](https://github.com/pkgjs/parseargs/commit/c2b5e72161991dfdc535909f1327cc9b970fe7e8))
|
| 49 |
+
|
| 50 |
+
### [0.7.1](https://github.com/pkgjs/parseargs/compare/v0.7.0...v0.7.1) (2022-04-15)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
### Bug Fixes
|
| 54 |
+
|
| 55 |
+
* resist pollution ([#106](https://github.com/pkgjs/parseargs/issues/106)) ([ecf2dec](https://github.com/pkgjs/parseargs/commit/ecf2dece0a9f2a76d789384d5d71c68ffe64022a))
|
| 56 |
+
|
| 57 |
+
## [0.7.0](https://github.com/pkgjs/parseargs/compare/v0.6.0...v0.7.0) (2022-04-13)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
### Features
|
| 61 |
+
|
| 62 |
+
* Add strict mode to parser ([#74](https://github.com/pkgjs/parseargs/issues/74)) ([8267d02](https://github.com/pkgjs/parseargs/commit/8267d02083a87b8b8a71fcce08348d1e031ea91c))
|
| 63 |
+
|
| 64 |
+
## [0.6.0](https://github.com/pkgjs/parseargs/compare/v0.5.0...v0.6.0) (2022-04-11)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
### ⚠ BREAKING CHANGES
|
| 68 |
+
|
| 69 |
+
* rework results to remove redundant `flags` property and store value true for boolean options (#83)
|
| 70 |
+
* switch to existing ERR_INVALID_ARG_VALUE (#97)
|
| 71 |
+
|
| 72 |
+
### Code Refactoring
|
| 73 |
+
|
| 74 |
+
* rework results to remove redundant `flags` property and store value true for boolean options ([#83](https://github.com/pkgjs/parseargs/issues/83)) ([be153db](https://github.com/pkgjs/parseargs/commit/be153dbed1d488cb7b6e27df92f601ba7337713d))
|
| 75 |
+
* switch to existing ERR_INVALID_ARG_VALUE ([#97](https://github.com/pkgjs/parseargs/issues/97)) ([084a23f](https://github.com/pkgjs/parseargs/commit/084a23f9fde2da030b159edb1c2385f24579ce40))
|
| 76 |
+
|
| 77 |
+
## [0.5.0](https://github.com/pkgjs/parseargs/compare/v0.4.0...v0.5.0) (2022-04-10)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
### ⚠ BREAKING CHANGES
|
| 81 |
+
|
| 82 |
+
* Require type to be specified for each supplied option (#95)
|
| 83 |
+
|
| 84 |
+
### Features
|
| 85 |
+
|
| 86 |
+
* Require type to be specified for each supplied option ([#95](https://github.com/pkgjs/parseargs/issues/95)) ([02cd018](https://github.com/pkgjs/parseargs/commit/02cd01885b8aaa59f2db8308f2d4479e64340068))
|
| 87 |
+
|
| 88 |
+
## [0.4.0](https://github.com/pkgjs/parseargs/compare/v0.3.0...v0.4.0) (2022-03-12)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
### ⚠ BREAKING CHANGES
|
| 92 |
+
|
| 93 |
+
* parsing, revisit short option groups, add support for combined short and value (#75)
|
| 94 |
+
* restructure configuration to take options bag (#63)
|
| 95 |
+
|
| 96 |
+
### Code Refactoring
|
| 97 |
+
|
| 98 |
+
* parsing, revisit short option groups, add support for combined short and value ([#75](https://github.com/pkgjs/parseargs/issues/75)) ([a92600f](https://github.com/pkgjs/parseargs/commit/a92600fa6c214508ab1e016fa55879a314f541af))
|
| 99 |
+
* restructure configuration to take options bag ([#63](https://github.com/pkgjs/parseargs/issues/63)) ([b412095](https://github.com/pkgjs/parseargs/commit/b4120957d90e809ee8b607b06e747d3e6a6b213e))
|
| 100 |
+
|
| 101 |
+
## [0.3.0](https://github.com/pkgjs/parseargs/compare/v0.2.0...v0.3.0) (2022-02-06)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
### Features
|
| 105 |
+
|
| 106 |
+
* **parser:** support short-option groups ([#59](https://github.com/pkgjs/parseargs/issues/59)) ([882067b](https://github.com/pkgjs/parseargs/commit/882067bc2d7cbc6b796f8e5a079a99bc99d4e6ba))
|
| 107 |
+
|
| 108 |
+
## [0.2.0](https://github.com/pkgjs/parseargs/compare/v0.1.1...v0.2.0) (2022-02-05)
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
### Features
|
| 112 |
+
|
| 113 |
+
* basic support for shorts ([#50](https://github.com/pkgjs/parseargs/issues/50)) ([a2f36d7](https://github.com/pkgjs/parseargs/commit/a2f36d7da4145af1c92f76806b7fe2baf6beeceb))
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
### Bug Fixes
|
| 117 |
+
|
| 118 |
+
* always store value for a=b ([#43](https://github.com/pkgjs/parseargs/issues/43)) ([a85e8dc](https://github.com/pkgjs/parseargs/commit/a85e8dc06379fd2696ee195cc625de8fac6aee42))
|
| 119 |
+
* support single dash as positional ([#49](https://github.com/pkgjs/parseargs/issues/49)) ([d795bf8](https://github.com/pkgjs/parseargs/commit/d795bf877d068fd67aec381f30b30b63f97109ad))
|
| 120 |
+
|
| 121 |
+
### [0.1.1](https://github.com/pkgjs/parseargs/compare/v0.1.0...v0.1.1) (2022-01-25)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
### Bug Fixes
|
| 125 |
+
|
| 126 |
+
* only use arrays in results for multiples ([#42](https://github.com/pkgjs/parseargs/issues/42)) ([c357584](https://github.com/pkgjs/parseargs/commit/c357584847912506319ed34a0840080116f4fd65))
|
| 127 |
+
|
| 128 |
+
## 0.1.0 (2022-01-22)
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
### Features
|
| 132 |
+
|
| 133 |
+
* expand scenarios covered by default arguments for environments ([#20](https://github.com/pkgjs/parseargs/issues/20)) ([582ada7](https://github.com/pkgjs/parseargs/commit/582ada7be0eca3a73d6e0bd016e7ace43449fa4c))
|
| 134 |
+
* update readme and include contributing guidelines ([8edd6fc](https://github.com/pkgjs/parseargs/commit/8edd6fc863cd705f6fac732724159ebe8065a2b0))
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
### Bug Fixes
|
| 138 |
+
|
| 139 |
+
* do not strip excess leading dashes on long option names ([#21](https://github.com/pkgjs/parseargs/issues/21)) ([f848590](https://github.com/pkgjs/parseargs/commit/f848590ebf3249ed5979ff47e003fa6e1a8ec5c0))
|
| 140 |
+
* name & readme ([3f057c1](https://github.com/pkgjs/parseargs/commit/3f057c1b158a1bdbe878c64b57460c58e56e465f))
|
| 141 |
+
* package.json values ([9bac300](https://github.com/pkgjs/parseargs/commit/9bac300e00cd76c77076bf9e75e44f8929512da9))
|
| 142 |
+
* update readme name ([957d8d9](https://github.com/pkgjs/parseargs/commit/957d8d96e1dcb48297c0a14345d44c0123b2883e))
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
### Build System
|
| 146 |
+
|
| 147 |
+
* first release as minor ([421c6e2](https://github.com/pkgjs/parseargs/commit/421c6e2569a8668ad14fac5a5af5be60479a7571))
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/README.md
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!-- omit in toc -->
|
| 2 |
+
# parseArgs
|
| 3 |
+
|
| 4 |
+
[![Coverage][coverage-image]][coverage-url]
|
| 5 |
+
|
| 6 |
+
Polyfill of `util.parseArgs()`
|
| 7 |
+
|
| 8 |
+
## `util.parseArgs([config])`
|
| 9 |
+
|
| 10 |
+
<!-- YAML
|
| 11 |
+
added: v18.3.0
|
| 12 |
+
changes:
|
| 13 |
+
- version: REPLACEME
|
| 14 |
+
pr-url: https://github.com/nodejs/node/pull/43459
|
| 15 |
+
description: add support for returning detailed parse information
|
| 16 |
+
using `tokens` in input `config` and returned properties.
|
| 17 |
+
-->
|
| 18 |
+
|
| 19 |
+
> Stability: 1 - Experimental
|
| 20 |
+
|
| 21 |
+
* `config` {Object} Used to provide arguments for parsing and to configure
|
| 22 |
+
the parser. `config` supports the following properties:
|
| 23 |
+
* `args` {string\[]} array of argument strings. **Default:** `process.argv`
|
| 24 |
+
with `execPath` and `filename` removed.
|
| 25 |
+
* `options` {Object} Used to describe arguments known to the parser.
|
| 26 |
+
Keys of `options` are the long names of options and values are an
|
| 27 |
+
{Object} accepting the following properties:
|
| 28 |
+
* `type` {string} Type of argument, which must be either `boolean` or `string`.
|
| 29 |
+
* `multiple` {boolean} Whether this option can be provided multiple
|
| 30 |
+
times. If `true`, all values will be collected in an array. If
|
| 31 |
+
`false`, values for the option are last-wins. **Default:** `false`.
|
| 32 |
+
* `short` {string} A single character alias for the option.
|
| 33 |
+
* `default` {string | boolean | string\[] | boolean\[]} The default option
|
| 34 |
+
value when it is not set by args. It must be of the same type as the
|
| 35 |
+
the `type` property. When `multiple` is `true`, it must be an array.
|
| 36 |
+
* `strict` {boolean} Should an error be thrown when unknown arguments
|
| 37 |
+
are encountered, or when arguments are passed that do not match the
|
| 38 |
+
`type` configured in `options`.
|
| 39 |
+
**Default:** `true`.
|
| 40 |
+
* `allowPositionals` {boolean} Whether this command accepts positional
|
| 41 |
+
arguments.
|
| 42 |
+
**Default:** `false` if `strict` is `true`, otherwise `true`.
|
| 43 |
+
* `tokens` {boolean} Return the parsed tokens. This is useful for extending
|
| 44 |
+
the built-in behavior, from adding additional checks through to reprocessing
|
| 45 |
+
the tokens in different ways.
|
| 46 |
+
**Default:** `false`.
|
| 47 |
+
|
| 48 |
+
* Returns: {Object} The parsed command line arguments:
|
| 49 |
+
* `values` {Object} A mapping of parsed option names with their {string}
|
| 50 |
+
or {boolean} values.
|
| 51 |
+
* `positionals` {string\[]} Positional arguments.
|
| 52 |
+
* `tokens` {Object\[] | undefined} See [parseArgs tokens](#parseargs-tokens)
|
| 53 |
+
section. Only returned if `config` includes `tokens: true`.
|
| 54 |
+
|
| 55 |
+
Provides a higher level API for command-line argument parsing than interacting
|
| 56 |
+
with `process.argv` directly. Takes a specification for the expected arguments
|
| 57 |
+
and returns a structured object with the parsed options and positionals.
|
| 58 |
+
|
| 59 |
+
```mjs
|
| 60 |
+
import { parseArgs } from 'node:util';
|
| 61 |
+
const args = ['-f', '--bar', 'b'];
|
| 62 |
+
const options = {
|
| 63 |
+
foo: {
|
| 64 |
+
type: 'boolean',
|
| 65 |
+
short: 'f'
|
| 66 |
+
},
|
| 67 |
+
bar: {
|
| 68 |
+
type: 'string'
|
| 69 |
+
}
|
| 70 |
+
};
|
| 71 |
+
const {
|
| 72 |
+
values,
|
| 73 |
+
positionals
|
| 74 |
+
} = parseArgs({ args, options });
|
| 75 |
+
console.log(values, positionals);
|
| 76 |
+
// Prints: [Object: null prototype] { foo: true, bar: 'b' } []
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
```cjs
|
| 80 |
+
const { parseArgs } = require('node:util');
|
| 81 |
+
const args = ['-f', '--bar', 'b'];
|
| 82 |
+
const options = {
|
| 83 |
+
foo: {
|
| 84 |
+
type: 'boolean',
|
| 85 |
+
short: 'f'
|
| 86 |
+
},
|
| 87 |
+
bar: {
|
| 88 |
+
type: 'string'
|
| 89 |
+
}
|
| 90 |
+
};
|
| 91 |
+
const {
|
| 92 |
+
values,
|
| 93 |
+
positionals
|
| 94 |
+
} = parseArgs({ args, options });
|
| 95 |
+
console.log(values, positionals);
|
| 96 |
+
// Prints: [Object: null prototype] { foo: true, bar: 'b' } []
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
`util.parseArgs` is experimental and behavior may change. Join the
|
| 100 |
+
conversation in [pkgjs/parseargs][] to contribute to the design.
|
| 101 |
+
|
| 102 |
+
### `parseArgs` `tokens`
|
| 103 |
+
|
| 104 |
+
Detailed parse information is available for adding custom behaviours by
|
| 105 |
+
specifying `tokens: true` in the configuration.
|
| 106 |
+
The returned tokens have properties describing:
|
| 107 |
+
|
| 108 |
+
* all tokens
|
| 109 |
+
* `kind` {string} One of 'option', 'positional', or 'option-terminator'.
|
| 110 |
+
* `index` {number} Index of element in `args` containing token. So the
|
| 111 |
+
source argument for a token is `args[token.index]`.
|
| 112 |
+
* option tokens
|
| 113 |
+
* `name` {string} Long name of option.
|
| 114 |
+
* `rawName` {string} How option used in args, like `-f` of `--foo`.
|
| 115 |
+
* `value` {string | undefined} Option value specified in args.
|
| 116 |
+
Undefined for boolean options.
|
| 117 |
+
* `inlineValue` {boolean | undefined} Whether option value specified inline,
|
| 118 |
+
like `--foo=bar`.
|
| 119 |
+
* positional tokens
|
| 120 |
+
* `value` {string} The value of the positional argument in args (i.e. `args[index]`).
|
| 121 |
+
* option-terminator token
|
| 122 |
+
|
| 123 |
+
The returned tokens are in the order encountered in the input args. Options
|
| 124 |
+
that appear more than once in args produce a token for each use. Short option
|
| 125 |
+
groups like `-xy` expand to a token for each option. So `-xxx` produces
|
| 126 |
+
three tokens.
|
| 127 |
+
|
| 128 |
+
For example to use the returned tokens to add support for a negated option
|
| 129 |
+
like `--no-color`, the tokens can be reprocessed to change the value stored
|
| 130 |
+
for the negated option.
|
| 131 |
+
|
| 132 |
+
```mjs
|
| 133 |
+
import { parseArgs } from 'node:util';
|
| 134 |
+
|
| 135 |
+
const options = {
|
| 136 |
+
'color': { type: 'boolean' },
|
| 137 |
+
'no-color': { type: 'boolean' },
|
| 138 |
+
'logfile': { type: 'string' },
|
| 139 |
+
'no-logfile': { type: 'boolean' },
|
| 140 |
+
};
|
| 141 |
+
const { values, tokens } = parseArgs({ options, tokens: true });
|
| 142 |
+
|
| 143 |
+
// Reprocess the option tokens and overwrite the returned values.
|
| 144 |
+
tokens
|
| 145 |
+
.filter((token) => token.kind === 'option')
|
| 146 |
+
.forEach((token) => {
|
| 147 |
+
if (token.name.startsWith('no-')) {
|
| 148 |
+
// Store foo:false for --no-foo
|
| 149 |
+
const positiveName = token.name.slice(3);
|
| 150 |
+
values[positiveName] = false;
|
| 151 |
+
delete values[token.name];
|
| 152 |
+
} else {
|
| 153 |
+
// Resave value so last one wins if both --foo and --no-foo.
|
| 154 |
+
values[token.name] = token.value ?? true;
|
| 155 |
+
}
|
| 156 |
+
});
|
| 157 |
+
|
| 158 |
+
const color = values.color;
|
| 159 |
+
const logfile = values.logfile ?? 'default.log';
|
| 160 |
+
|
| 161 |
+
console.log({ logfile, color });
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
```cjs
|
| 165 |
+
const { parseArgs } = require('node:util');
|
| 166 |
+
|
| 167 |
+
const options = {
|
| 168 |
+
'color': { type: 'boolean' },
|
| 169 |
+
'no-color': { type: 'boolean' },
|
| 170 |
+
'logfile': { type: 'string' },
|
| 171 |
+
'no-logfile': { type: 'boolean' },
|
| 172 |
+
};
|
| 173 |
+
const { values, tokens } = parseArgs({ options, tokens: true });
|
| 174 |
+
|
| 175 |
+
// Reprocess the option tokens and overwrite the returned values.
|
| 176 |
+
tokens
|
| 177 |
+
.filter((token) => token.kind === 'option')
|
| 178 |
+
.forEach((token) => {
|
| 179 |
+
if (token.name.startsWith('no-')) {
|
| 180 |
+
// Store foo:false for --no-foo
|
| 181 |
+
const positiveName = token.name.slice(3);
|
| 182 |
+
values[positiveName] = false;
|
| 183 |
+
delete values[token.name];
|
| 184 |
+
} else {
|
| 185 |
+
// Resave value so last one wins if both --foo and --no-foo.
|
| 186 |
+
values[token.name] = token.value ?? true;
|
| 187 |
+
}
|
| 188 |
+
});
|
| 189 |
+
|
| 190 |
+
const color = values.color;
|
| 191 |
+
const logfile = values.logfile ?? 'default.log';
|
| 192 |
+
|
| 193 |
+
console.log({ logfile, color });
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
Example usage showing negated options, and when an option is used
|
| 197 |
+
multiple ways then last one wins.
|
| 198 |
+
|
| 199 |
+
```console
|
| 200 |
+
$ node negate.js
|
| 201 |
+
{ logfile: 'default.log', color: undefined }
|
| 202 |
+
$ node negate.js --no-logfile --no-color
|
| 203 |
+
{ logfile: false, color: false }
|
| 204 |
+
$ node negate.js --logfile=test.log --color
|
| 205 |
+
{ logfile: 'test.log', color: true }
|
| 206 |
+
$ node negate.js --no-logfile --logfile=test.log --color --no-color
|
| 207 |
+
{ logfile: 'test.log', color: false }
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
-----
|
| 211 |
+
|
| 212 |
+
<!-- omit in toc -->
|
| 213 |
+
## Table of Contents
|
| 214 |
+
- [`util.parseArgs([config])`](#utilparseargsconfig)
|
| 215 |
+
- [Scope](#scope)
|
| 216 |
+
- [Version Matchups](#version-matchups)
|
| 217 |
+
- [🚀 Getting Started](#-getting-started)
|
| 218 |
+
- [🙌 Contributing](#-contributing)
|
| 219 |
+
- [💡 `process.mainArgs` Proposal](#-processmainargs-proposal)
|
| 220 |
+
- [Implementation:](#implementation)
|
| 221 |
+
- [📃 Examples](#-examples)
|
| 222 |
+
- [F.A.Qs](#faqs)
|
| 223 |
+
- [Links & Resources](#links--resources)
|
| 224 |
+
|
| 225 |
+
-----
|
| 226 |
+
|
| 227 |
+
## Scope
|
| 228 |
+
|
| 229 |
+
It is already possible to build great arg parsing modules on top of what Node.js provides; the prickly API is abstracted away by these modules. Thus, process.parseArgs() is not necessarily intended for library authors; it is intended for developers of simple CLI tools, ad-hoc scripts, deployed Node.js applications, and learning materials.
|
| 230 |
+
|
| 231 |
+
It is exceedingly difficult to provide an API which would both be friendly to these Node.js users while being extensible enough for libraries to build upon. We chose to prioritize these use cases because these are currently not well-served by Node.js' API.
|
| 232 |
+
|
| 233 |
+
----
|
| 234 |
+
|
| 235 |
+
## Version Matchups
|
| 236 |
+
|
| 237 |
+
| Node.js | @pkgjs/parseArgs |
|
| 238 |
+
| -- | -- |
|
| 239 |
+
| [v18.3.0](https://nodejs.org/docs/latest-v18.x/api/util.html#utilparseargsconfig) | [v0.9.1](https://github.com/pkgjs/parseargs/tree/v0.9.1#utilparseargsconfig) |
|
| 240 |
+
| [v16.17.0](https://nodejs.org/dist/latest-v16.x/docs/api/util.html#utilparseargsconfig), [v18.7.0](https://nodejs.org/docs/latest-v18.x/api/util.html#utilparseargsconfig) | [0.10.0](https://github.com/pkgjs/parseargs/tree/v0.10.0#utilparseargsconfig) |
|
| 241 |
+
|
| 242 |
+
----
|
| 243 |
+
|
| 244 |
+
## 🚀 Getting Started
|
| 245 |
+
|
| 246 |
+
1. **Install dependencies.**
|
| 247 |
+
|
| 248 |
+
```bash
|
| 249 |
+
npm install
|
| 250 |
+
```
|
| 251 |
+
|
| 252 |
+
2. **Open the index.js file and start editing!**
|
| 253 |
+
|
| 254 |
+
3. **Test your code by calling parseArgs through our test file**
|
| 255 |
+
|
| 256 |
+
```bash
|
| 257 |
+
npm test
|
| 258 |
+
```
|
| 259 |
+
|
| 260 |
+
----
|
| 261 |
+
|
| 262 |
+
## 🙌 Contributing
|
| 263 |
+
|
| 264 |
+
Any person who wants to contribute to the initiative is welcome! Please first read the [Contributing Guide](CONTRIBUTING.md)
|
| 265 |
+
|
| 266 |
+
Additionally, reading the [`Examples w/ Output`](#-examples-w-output) section of this document will be the best way to familiarize yourself with the target expected behavior for parseArgs() once it is fully implemented.
|
| 267 |
+
|
| 268 |
+
This package was implemented using [tape](https://www.npmjs.com/package/tape) as its test harness.
|
| 269 |
+
|
| 270 |
+
----
|
| 271 |
+
|
| 272 |
+
## 💡 `process.mainArgs` Proposal
|
| 273 |
+
|
| 274 |
+
> Note: This can be moved forward independently of the `util.parseArgs()` proposal/work.
|
| 275 |
+
|
| 276 |
+
### Implementation:
|
| 277 |
+
|
| 278 |
+
```javascript
|
| 279 |
+
process.mainArgs = process.argv.slice(process._exec ? 1 : 2)
|
| 280 |
+
```
|
| 281 |
+
|
| 282 |
+
----
|
| 283 |
+
|
| 284 |
+
## 📃 Examples
|
| 285 |
+
|
| 286 |
+
```js
|
| 287 |
+
const { parseArgs } = require('@pkgjs/parseargs');
|
| 288 |
+
```
|
| 289 |
+
|
| 290 |
+
```js
|
| 291 |
+
const { parseArgs } = require('@pkgjs/parseargs');
|
| 292 |
+
// specify the options that may be used
|
| 293 |
+
const options = {
|
| 294 |
+
foo: { type: 'string'},
|
| 295 |
+
bar: { type: 'boolean' },
|
| 296 |
+
};
|
| 297 |
+
const args = ['--foo=a', '--bar'];
|
| 298 |
+
const { values, positionals } = parseArgs({ args, options });
|
| 299 |
+
// values = { foo: 'a', bar: true }
|
| 300 |
+
// positionals = []
|
| 301 |
+
```
|
| 302 |
+
|
| 303 |
+
```js
|
| 304 |
+
const { parseArgs } = require('@pkgjs/parseargs');
|
| 305 |
+
// type:string & multiple
|
| 306 |
+
const options = {
|
| 307 |
+
foo: {
|
| 308 |
+
type: 'string',
|
| 309 |
+
multiple: true,
|
| 310 |
+
},
|
| 311 |
+
};
|
| 312 |
+
const args = ['--foo=a', '--foo', 'b'];
|
| 313 |
+
const { values, positionals } = parseArgs({ args, options });
|
| 314 |
+
// values = { foo: [ 'a', 'b' ] }
|
| 315 |
+
// positionals = []
|
| 316 |
+
```
|
| 317 |
+
|
| 318 |
+
```js
|
| 319 |
+
const { parseArgs } = require('@pkgjs/parseargs');
|
| 320 |
+
// shorts
|
| 321 |
+
const options = {
|
| 322 |
+
foo: {
|
| 323 |
+
short: 'f',
|
| 324 |
+
type: 'boolean'
|
| 325 |
+
},
|
| 326 |
+
};
|
| 327 |
+
const args = ['-f', 'b'];
|
| 328 |
+
const { values, positionals } = parseArgs({ args, options, allowPositionals: true });
|
| 329 |
+
// values = { foo: true }
|
| 330 |
+
// positionals = ['b']
|
| 331 |
+
```
|
| 332 |
+
|
| 333 |
+
```js
|
| 334 |
+
const { parseArgs } = require('@pkgjs/parseargs');
|
| 335 |
+
// unconfigured
|
| 336 |
+
const options = {};
|
| 337 |
+
const args = ['-f', '--foo=a', '--bar', 'b'];
|
| 338 |
+
const { values, positionals } = parseArgs({ strict: false, args, options, allowPositionals: true });
|
| 339 |
+
// values = { f: true, foo: 'a', bar: true }
|
| 340 |
+
// positionals = ['b']
|
| 341 |
+
```
|
| 342 |
+
|
| 343 |
+
----
|
| 344 |
+
|
| 345 |
+
## F.A.Qs
|
| 346 |
+
|
| 347 |
+
- Is `cmd --foo=bar baz` the same as `cmd baz --foo=bar`?
|
| 348 |
+
- yes
|
| 349 |
+
- Does the parser execute a function?
|
| 350 |
+
- no
|
| 351 |
+
- Does the parser execute one of several functions, depending on input?
|
| 352 |
+
- no
|
| 353 |
+
- Can subcommands take options that are distinct from the main command?
|
| 354 |
+
- no
|
| 355 |
+
- Does it output generated help when no options match?
|
| 356 |
+
- no
|
| 357 |
+
- Does it generated short usage? Like: `usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]`
|
| 358 |
+
- no (no usage/help at all)
|
| 359 |
+
- Does the user provide the long usage text? For each option? For the whole command?
|
| 360 |
+
- no
|
| 361 |
+
- Do subcommands (if implemented) have their own usage output?
|
| 362 |
+
- no
|
| 363 |
+
- Does usage print if the user runs `cmd --help`?
|
| 364 |
+
- no
|
| 365 |
+
- Does it set `process.exitCode`?
|
| 366 |
+
- no
|
| 367 |
+
- Does usage print to stderr or stdout?
|
| 368 |
+
- N/A
|
| 369 |
+
- Does it check types? (Say, specify that an option is a boolean, number, etc.)
|
| 370 |
+
- no
|
| 371 |
+
- Can an option have more than one type? (string or false, for example)
|
| 372 |
+
- no
|
| 373 |
+
- Can the user define a type? (Say, `type: path` to call `path.resolve()` on the argument.)
|
| 374 |
+
- no
|
| 375 |
+
- Does a `--foo=0o22` mean 0, 22, 18, or "0o22"?
|
| 376 |
+
- `"0o22"`
|
| 377 |
+
- Does it coerce types?
|
| 378 |
+
- no
|
| 379 |
+
- Does `--no-foo` coerce to `--foo=false`? For all options? Only boolean options?
|
| 380 |
+
- no, it sets `{values:{'no-foo': true}}`
|
| 381 |
+
- Is `--foo` the same as `--foo=true`? Only for known booleans? Only at the end?
|
| 382 |
+
- no, they are not the same. There is no special handling of `true` as a value so it is just another string.
|
| 383 |
+
- Does it read environment variables? Ie, is `FOO=1 cmd` the same as `cmd --foo=1`?
|
| 384 |
+
- no
|
| 385 |
+
- Do unknown arguments raise an error? Are they parsed? Are they treated as positional arguments?
|
| 386 |
+
- no, they are parsed, not treated as positionals
|
| 387 |
+
- Does `--` signal the end of options?
|
| 388 |
+
- yes
|
| 389 |
+
- Is `--` included as a positional?
|
| 390 |
+
- no
|
| 391 |
+
- Is `program -- foo` the same as `program foo`?
|
| 392 |
+
- yes, both store `{positionals:['foo']}`
|
| 393 |
+
- Does the API specify whether a `--` was present/relevant?
|
| 394 |
+
- no
|
| 395 |
+
- Is `-bar` the same as `--bar`?
|
| 396 |
+
- no, `-bar` is a short option or options, with expansion logic that follows the
|
| 397 |
+
[Utility Syntax Guidelines in POSIX.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html). `-bar` expands to `-b`, `-a`, `-r`.
|
| 398 |
+
- Is `---foo` the same as `--foo`?
|
| 399 |
+
- no
|
| 400 |
+
- the first is a long option named `'-foo'`
|
| 401 |
+
- the second is a long option named `'foo'`
|
| 402 |
+
- Is `-` a positional? ie, `bash some-test.sh | tap -`
|
| 403 |
+
- yes
|
| 404 |
+
|
| 405 |
+
## Links & Resources
|
| 406 |
+
|
| 407 |
+
* [Initial Tooling Issue](https://github.com/nodejs/tooling/issues/19)
|
| 408 |
+
* [Initial Proposal](https://github.com/nodejs/node/pull/35015)
|
| 409 |
+
* [parseArgs Proposal](https://github.com/nodejs/node/pull/42675)
|
| 410 |
+
|
| 411 |
+
[coverage-image]: https://img.shields.io/nycrc/pkgjs/parseargs
|
| 412 |
+
[coverage-url]: https://github.com/pkgjs/parseargs/blob/main/.nycrc
|
| 413 |
+
[pkgjs/parseargs]: https://github.com/pkgjs/parseargs
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/examples/is-default-value.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
// This example shows how to understand if a default value is used or not.
|
| 4 |
+
|
| 5 |
+
// 1. const { parseArgs } = require('node:util'); // from node
|
| 6 |
+
// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
|
| 7 |
+
const { parseArgs } = require('..'); // in repo
|
| 8 |
+
|
| 9 |
+
const options = {
|
| 10 |
+
file: { short: 'f', type: 'string', default: 'FOO' },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
const { values, tokens } = parseArgs({ options, tokens: true });
|
| 14 |
+
|
| 15 |
+
const isFileDefault = !tokens.some((token) => token.kind === 'option' &&
|
| 16 |
+
token.name === 'file'
|
| 17 |
+
);
|
| 18 |
+
|
| 19 |
+
console.log(values);
|
| 20 |
+
console.log(`Is the file option [${values.file}] the default value? ${isFileDefault}`);
|
| 21 |
+
|
| 22 |
+
// Try the following:
|
| 23 |
+
// node is-default-value.js
|
| 24 |
+
// node is-default-value.js -f FILE
|
| 25 |
+
// node is-default-value.js --file FILE
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
// This is an example of using tokens to add a custom behaviour.
|
| 4 |
+
//
|
| 5 |
+
// Require the use of `=` for long options and values by blocking
|
| 6 |
+
// the use of space separated values.
|
| 7 |
+
// So allow `--foo=bar`, and not allow `--foo bar`.
|
| 8 |
+
//
|
| 9 |
+
// Note: this is not a common behaviour, most CLIs allow both forms.
|
| 10 |
+
|
| 11 |
+
// 1. const { parseArgs } = require('node:util'); // from node
|
| 12 |
+
// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
|
| 13 |
+
const { parseArgs } = require('..'); // in repo
|
| 14 |
+
|
| 15 |
+
const options = {
|
| 16 |
+
file: { short: 'f', type: 'string' },
|
| 17 |
+
log: { type: 'string' },
|
| 18 |
+
};
|
| 19 |
+
|
| 20 |
+
const { values, tokens } = parseArgs({ options, tokens: true });
|
| 21 |
+
|
| 22 |
+
const badToken = tokens.find((token) => token.kind === 'option' &&
|
| 23 |
+
token.value != null &&
|
| 24 |
+
token.rawName.startsWith('--') &&
|
| 25 |
+
!token.inlineValue
|
| 26 |
+
);
|
| 27 |
+
if (badToken) {
|
| 28 |
+
throw new Error(`Option value for '${badToken.rawName}' must be inline, like '${badToken.rawName}=VALUE'`);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
console.log(values);
|
| 32 |
+
|
| 33 |
+
// Try the following:
|
| 34 |
+
// node limit-long-syntax.js -f FILE --log=LOG
|
| 35 |
+
// node limit-long-syntax.js --file FILE
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/examples/negate.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
// This example is used in the documentation.
|
| 4 |
+
|
| 5 |
+
// How might I add my own support for --no-foo?
|
| 6 |
+
|
| 7 |
+
// 1. const { parseArgs } = require('node:util'); // from node
|
| 8 |
+
// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
|
| 9 |
+
const { parseArgs } = require('..'); // in repo
|
| 10 |
+
|
| 11 |
+
const options = {
|
| 12 |
+
'color': { type: 'boolean' },
|
| 13 |
+
'no-color': { type: 'boolean' },
|
| 14 |
+
'logfile': { type: 'string' },
|
| 15 |
+
'no-logfile': { type: 'boolean' },
|
| 16 |
+
};
|
| 17 |
+
const { values, tokens } = parseArgs({ options, tokens: true });
|
| 18 |
+
|
| 19 |
+
// Reprocess the option tokens and overwrite the returned values.
|
| 20 |
+
tokens
|
| 21 |
+
.filter((token) => token.kind === 'option')
|
| 22 |
+
.forEach((token) => {
|
| 23 |
+
if (token.name.startsWith('no-')) {
|
| 24 |
+
// Store foo:false for --no-foo
|
| 25 |
+
const positiveName = token.name.slice(3);
|
| 26 |
+
values[positiveName] = false;
|
| 27 |
+
delete values[token.name];
|
| 28 |
+
} else {
|
| 29 |
+
// Resave value so last one wins if both --foo and --no-foo.
|
| 30 |
+
values[token.name] = token.value ?? true;
|
| 31 |
+
}
|
| 32 |
+
});
|
| 33 |
+
|
| 34 |
+
const color = values.color;
|
| 35 |
+
const logfile = values.logfile ?? 'default.log';
|
| 36 |
+
|
| 37 |
+
console.log({ logfile, color });
|
| 38 |
+
|
| 39 |
+
// Try the following:
|
| 40 |
+
// node negate.js
|
| 41 |
+
// node negate.js --no-logfile --no-color
|
| 42 |
+
// negate.js --logfile=test.log --color
|
| 43 |
+
// node negate.js --no-logfile --logfile=test.log --color --no-color
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
// This is an example of using tokens to add a custom behaviour.
|
| 4 |
+
//
|
| 5 |
+
// Throw an error if an option is used more than once.
|
| 6 |
+
|
| 7 |
+
// 1. const { parseArgs } = require('node:util'); // from node
|
| 8 |
+
// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
|
| 9 |
+
const { parseArgs } = require('..'); // in repo
|
| 10 |
+
|
| 11 |
+
const options = {
|
| 12 |
+
ding: { type: 'boolean', short: 'd' },
|
| 13 |
+
beep: { type: 'boolean', short: 'b' }
|
| 14 |
+
};
|
| 15 |
+
const { values, tokens } = parseArgs({ options, tokens: true });
|
| 16 |
+
|
| 17 |
+
const seenBefore = new Set();
|
| 18 |
+
tokens.forEach((token) => {
|
| 19 |
+
if (token.kind !== 'option') return;
|
| 20 |
+
if (seenBefore.has(token.name)) {
|
| 21 |
+
throw new Error(`option '${token.name}' used multiple times`);
|
| 22 |
+
}
|
| 23 |
+
seenBefore.add(token.name);
|
| 24 |
+
});
|
| 25 |
+
|
| 26 |
+
console.log(values);
|
| 27 |
+
|
| 28 |
+
// Try the following:
|
| 29 |
+
// node no-repeated-options --ding --beep
|
| 30 |
+
// node no-repeated-options --beep -b
|
| 31 |
+
// node no-repeated-options -ddd
|
Sukoon_Github/langgraph/sukoon-frontend/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This is an example of using tokens to add a custom behaviour.
|
| 2 |
+
//
|
| 3 |
+
// This adds a option order check so that --some-unstable-option
|
| 4 |
+
// may only be used after --enable-experimental-options
|
| 5 |
+
//
|
| 6 |
+
// Note: this is not a common behaviour, the order of different options
|
| 7 |
+
// does not usually matter.
|
| 8 |
+
|
| 9 |
+
import { parseArgs } from '../index.js';
|
| 10 |
+
|
| 11 |
+
function findTokenIndex(tokens, target) {
|
| 12 |
+
return tokens.findIndex((token) => token.kind === 'option' &&
|
| 13 |
+
token.name === target
|
| 14 |
+
);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const experimentalName = 'enable-experimental-options';
|
| 18 |
+
const unstableName = 'some-unstable-option';
|
| 19 |
+
|
| 20 |
+
const options = {
|
| 21 |
+
[experimentalName]: { type: 'boolean' },
|
| 22 |
+
[unstableName]: { type: 'boolean' },
|
| 23 |
+
};
|
| 24 |
+
|
| 25 |
+
const { values, tokens } = parseArgs({ options, tokens: true });
|
| 26 |
+
|
| 27 |
+
const experimentalIndex = findTokenIndex(tokens, experimentalName);
|
| 28 |
+
const unstableIndex = findTokenIndex(tokens, unstableName);
|
| 29 |
+
if (unstableIndex !== -1 &&
|
| 30 |
+
((experimentalIndex === -1) || (unstableIndex < experimentalIndex))) {
|
| 31 |
+
throw new Error(`'--${experimentalName}' must be specified before '--${unstableName}'`);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
console.log(values);
|
| 35 |
+
|
| 36 |
+
/* eslint-disable max-len */
|
| 37 |
+
// Try the following:
|
| 38 |
+
// node ordered-options.mjs
|
| 39 |
+
// node ordered-options.mjs --some-unstable-option
|
| 40 |
+
// node ordered-options.mjs --some-unstable-option --enable-experimental-options
|
| 41 |
+
// node ordered-options.mjs --enable-experimental-options --some-unstable-option
|