Docker image using Dev Container in VSCode @FlamingFury00

Update
This commit is contained in:
IntelligenzaArtificiale
2023-05-02 22:12:14 +02:00
committed by GitHub
8 changed files with 128 additions and 29 deletions
+19
View File
@@ -0,0 +1,19 @@
# Use an official Python base image from the Docker Hub
FROM python:3.10
# Install browsers
RUN apt-get update && apt-get install -y \
chromium-driver firefox-esr \
ca-certificates
# Install utilities
RUN apt-get install -y curl jq wget git
# Declare working directory
WORKDIR /workspace/FreeAutoGPT
# Copy the current directory contents into the Workspace.
COPY . /workspace/FreeAutoGPT
# Install any necessary packages specified in requirements.txt.
RUN pip install -r requirements.txt
+40
View File
@@ -0,0 +1,40 @@
{
"dockerComposeFile": "./docker-compose.yml",
"service": "free-autogpt",
"workspaceFolder": "/workspace/FreeAutoGPT",
"shutdownAction": "stopCompose",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"username": "vscode",
"userUid": "6942",
"userGid": "6942",
"upgradePackages": "true"
},
"ghcr.io/devcontainers/features/desktop-lite:1": {},
"ghcr.io/devcontainers/features/python:1": "none",
"ghcr.io/devcontainers/features/node:1": "none",
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python"
}
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
+12
View File
@@ -0,0 +1,12 @@
# To boot the app run the following:
# docker-compose run auto-gpt
version: '3.10'
services:
free-autogpt:
build:
dockerfile: .devcontainer/Dockerfile
context: ../
tty: true
volumes:
- ../:/workspace/FreeAutoGPT
+13
View File
@@ -0,0 +1,13 @@
################################################################################
### FREE-AUTOGPT - GENERAL SETTINGS
################################################################################
### CHATGPT
## CHATGPT_TOKEN - ChatGPT Token (Go to https://chat.openai.com/chat and open the developer tools by F12.
## Find the __Secure-next-auth.session-token cookie in Application > Storage > Cookies > https://chat.openai.com
## Copy the value in the Cooki2e Value field.)
CHATGPT_TOKEN=your-chatgpt-token
### HUGGINGFACE
## HUGGINGFACE_TOKEN - HuggingFace Token (Check https://huggingface.co/settings/tokens to get your token)
HUGGINGFACE_TOKEN=your-huggingface-token
+17 -12
View File
@@ -4,6 +4,7 @@
# General
import os
import pandas as pd
from dotenv import load_dotenv
from langchain.experimental.autonomous_agents.autogpt.agent import AutoGPT
from FreeLLM import ChatGPTAPI # FREE CHATGPT API
from FreeLLM import HuggingChatAPI # FREE HUGGINGCHAT API
@@ -17,6 +18,7 @@ import nest_asyncio
# Needed synce jupyter runs an async eventloop
nest_asyncio.apply()
load_dotenv()
select_model = input("Select the model you want to use (1 or 2) \n \
1) ChatGPT \n \
@@ -24,12 +26,13 @@ select_model = input("Select the model you want to use (1 or 2) \n \
>>> ")
if select_model == "1":
print("Chatgpt token : \n \
Go to https://chat.openai.com/chat and open the developer tools by F12. \n \
Find the __Secure-next-auth.session-token cookie in Application > Storage > Cookies > https://chat.openai.com \n \
Copy the value in the Cooki2e Value field.")
CG_TOKEN = input("Insert chatgpt token >>> ")
os.environ["CHATGPT_TOKEN"] = CG_TOKEN
CG_TOKEN = os.getenv("CHATGPT_TOKEN", "your-chatgpt-token")
if (CG_TOKEN != "your-chatgpt-token"):
os.environ["CHATGPT_TOKEN"] = CG_TOKEN
else:
raise ValueError("ChatGPT Token EMPTY. Edit the .env file and put your ChatGPT token")
start_chat = input("Do you want start a chat from existing chat? (y/n): ") # ask if you want start a chat from existing chat
if start_chat == "y":
chat_id = input("Insert chat-id (chat.openai.com/c/(IS THIS ->)58XXXX0f-XXXX-XXXX-XXXX-faXXXXd2b50f) ->") # ask the chat id
@@ -38,13 +41,15 @@ if select_model == "1":
llm= ChatGPTAPI.ChatGPT(token=os.environ["CHATGPT_TOKEN"])
elif select_model == "2":
llm=HuggingChatAPI.HuggingChat()
print("You must provide the huggingface token and chatgpt token")
print("Huggingface token, check https://huggingface.co/settings/tokens for get your token")
HF_TOKEN = input("Insert huggingface token >>> ")
os.environ["HUGGINGFACEHUB_API_TOKEN"] = HF_TOKEN
HF_TOKEN = os.getenv("HUGGINGFACE_TOKEN", "your-huggingface-token")
if (HF_TOKEN != "your-huggingface-token"):
os.environ["HUGGINGFACEHUB_API_TOKEN"] = HF_TOKEN
else:
raise ValueError("HuggingFace Token EMPTY. Edit the .env file and put your HuggingFace token")
# Tools
import os
+16 -10
View File
@@ -1,4 +1,5 @@
import os
from dotenv import load_dotenv
from collections import deque
from typing import Dict, List, Optional, Any
from langchain.vectorstores import FAISS
@@ -14,18 +15,21 @@ from langchain.chains.base import Chain
from langchain.experimental import BabyAGI
import faiss
load_dotenv()
select_model = input("Select the model you want to use (1 or 2) \n \
1) ChatGPT \n \
2) HuggingChat \n \
>>> ")
if select_model == "1":
print("Chatgpt token : \n \
Go to https://chat.openai.com/chat and open the developer tools by F12. \n \
Find the __Secure-next-auth.session-token cookie in Application > Storage > Cookies > https://chat.openai.com \n \
Copy the value in the Cooki2e Value field.")
CG_TOKEN = input("Insert chatgpt token >>> ")
os.environ["CHATGPT_TOKEN"] = CG_TOKEN
CG_TOKEN = os.getenv("CHATGPT_TOKEN", "your-chatgpt-token")
if (CG_TOKEN != "your-chatgpt-token"):
os.environ["CHATGPT_TOKEN"] = CG_TOKEN
else:
raise ValueError("ChatGPT Token EMPTY. Edit the .env file and put your ChatGPT token")
start_chat = input("Do you want start a chat from existing chat? (y/n): ") # ask if you want start a chat from existing chat
if start_chat == "y":
chat_id = input("Insert chat-id (chat.openai.com/c/(IS THIS ->)58XXXX0f-XXXX-XXXX-XXXX-faXXXXd2b50f) ->") # ask the chat id
@@ -37,10 +41,12 @@ elif select_model == "2":
print("You must provide the huggingface token and chatgpt token")
print("Huggingface token, check https://huggingface.co/settings/tokens for get your token")
HF_TOKEN = input("Insert huggingface token >>> ")
os.environ["HUGGINGFACEHUB_API_TOKEN"] = HF_TOKEN
HF_TOKEN = os.getenv("HUGGINGFACE_TOKEN", "your-huggingface-token")
if (HF_TOKEN != "your-huggingface-token"):
os.environ["HUGGINGFACEHUB_API_TOKEN"] = HF_TOKEN
else:
raise ValueError("HuggingFace Token EMPTY. Edit the .env file and put your HuggingFace token")
+9 -6
View File
@@ -1,9 +1,11 @@
from dotenv import load_dotenv
from langchain import LLMChain, PromptTemplate
from FreeLLM import ChatGPTAPI # FREE CHATGPT API
from FreeLLM import HuggingChatAPI # FREE HUGGINGCHAT API
from langchain.memory import ConversationBufferWindowMemory
import os
load_dotenv()
#### LOG IN FOR CHATGPT FREE LLM
select_model = input("Select the model you want to use (1 or 2) \n \
@@ -12,12 +14,13 @@ select_model = input("Select the model you want to use (1 or 2) \n \
>>> ")
if select_model == "1":
print("Chatgpt token : \n \
Go to https://chat.openai.com/chat and open the developer tools by F12. \n \
Find the __Secure-next-auth.session-token cookie in Application > Storage > Cookies > https://chat.openai.com \n \
Copy the value in the Cooki2e Value field.")
CG_TOKEN = input("Insert chatgpt token >>> ")
os.environ["CHATGPT_TOKEN"] = CG_TOKEN
CG_TOKEN = os.getenv("CHATGPT_TOKEN", "your-chatgpt-token")
if (CG_TOKEN != "your-chatgpt-token"):
os.environ["CHATGPT_TOKEN"] = CG_TOKEN
else:
raise ValueError("ChatGPT Token EMPTY. Edit the .env file and put your ChatGPT token")
start_chat = input("Do you want start a chat from existing chat? (y/n): ") # ask if you want start a chat from existing chat
if start_chat == "y":
chat_id = input("Insert chat-id (chat.openai.com/c/(IS THIS ->)58XXXX0f-XXXX-XXXX-XXXX-faXXXXd2b50f) ->") # ask the chat id
+2 -1
View File
@@ -17,4 +17,5 @@ torch
pytest-playwright
undetected-chromedriver>=3.2.1
markdownify>=0.11.6
hugchat
hugchat
python-dotenv