GithubHelp home page GithubHelp logo

chat-app's People

Contributors

ed-roh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

chat-app's Issues

I am facing an error

Hi, i am a new react devloper so i am facing a small issue . I have copied your code word to word till 01:06:01 mins in your youtube video but when i type a message in it ,it doesn't get saved in the chat

the error i am getting is

             
       POST https://api.chatengine.io/chats/149632/messages/ 500
    at createError (createError.js:16:15)
    at settle (settle.js:17:12)
    at XMLHttpRequest.onloadend (xhr.js:66:7)

but in the video you are not facing this type of issue rn,
so please help if you can.

Thanks!

FastAPI backend login issue status code 422

Tried to swap out node.js for FastAPI as there are some additional business logic thats currently only in Python:

server-fastapi/routers/auth.py

import logging
from fastapi import APIRouter, Request
from pydantic import BaseModel
from typing import Union
import requests
    
router = APIRouter(prefix="/auth", 
                   tags=["auth"], 
                   responses={404: {"description": "Not found"}}
                   )

class User(BaseModel):
    username: str
    secret: str
    email: Union[str, None] = None
    first_name: Union[str, None] = None
    last_name: Union[str, None] = None
    
@router.post("/login")
async def login(user: User):
    payload={}
    response = requests.get('https://api.chatengine.io/users/me', 
        headers={ 
            "Content-Type": "application/json",    
            "Project-ID": <MY_PROJECT_ID>,
            "User-Name": user.username,  
            "User-Secret": user.secret  
        },
        data=payload
    )
    logging.info("response: {}".format(response))
    logging.info("type(response): {}".format(type(response)))
    
    return response.json()
 
@router.post("/signup")
async def signup(user: User):
    response = requests.post('https://api.chatengine.io/users/', 
        data={
            "username": user.username,
            "secret": user.secret,
            "email": user.email,
            "first_name": user.first_name,
            "last_name": user.last_name,
        },
        headers={ "Private-Key": PRIVATE_KEY }
    )
    return {"response": response.json()}

server-fastapi/main.py

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
# pip install "uvicorn[standard]"

from pydantic import BaseModel
from typing import Union

import requests
from routers import auth, openai

app = FastAPI()

origins = [
    "http://localhost:5173", 
]
 
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

app.include_router(auth.router)
app.include_router(openai.router)

cd server-fastapi
uvicorn main:app --reload --port 1337

Status code 422:

But

FastAPI Swagger /auth/login works

as well as standalone test_login.py as well as in Isomnia

import requests

url = "https://api.chatengine.io/users/me/"

payload={}
headers = {
  'Project-ID': '<MY_PROJECT>',
  'User-Name': 'testUser',
  'User-Secret': 'testUser'
}

response = requests.request("GET", url, headers=headers, data=payload)


print(response.json())

So not sure why 422 when trying to authenticate with FastAPI fails:

Failed to load resource: the server responded with a status of 422 (Unprocessable Entity) and No resource with given URL found.

Is this related to how payload must be altered in the client/src/state/api.js payload?

Screenshot 2024-01-25 at 00 09 12

Error on the server side.

I am a new developer and I am seeing an error which states that "import { Configuration, OpenAIApi } from "openai"; SyntaxError: The requested module 'openai' does not provide an export named 'Configuration' "

This import is done in ./server/index.js

Can you please help me out with this error? Why is it showing? I have checked each line of code and there's no mistake in the code.

Just thank you for the great chat-app example

Hi ) I am not nodejs-developer but I watched your great learning video with big interest :)
Ed-Roh, I want to express "thank you for the great chat-app example" :)
After "movie watch" I tried to redevelop your chatgpt project onto c# mini-project but I catched epic fail (chatgpt not available at my country, some geo-blocking, etc.). I tried to use the sk-key from your video: sk-zkk2S....yOMn
but I noticed that Api-key you temporary generated was blocked (obsolete) , heh.
So sad/too bad :)
Cheers up,
[m][e]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.