Giter Site home page Giter Site logo

crawl-chat-gpt's Introduction

Hướng dẫn sử dụng

Phần này hiểu đơn giản là sẽ chạy 1 socket server để nhận dữ liệu từ script được nhúng thêm vào web của chat gpt. Script vẫn đang phát triển, chat gpt có thể thay đổi các chính sách nên có gì cứ liên hệ với mình.

Các bước test chat gpt

  • Cài đặt Tempermonkey. Đây là extentions để giúp ta có thể nhúng các script tự viết vào web site
  • Cài đặt CSP. Việc nhúng script vào web site sau đó gửi thông tin đến server của mình tại local bị chrome block nên cần cài extentions này để block CSP của Chrome.
  • Cài đặt yarn hoặc npm tuỳ vào sở thích, sau đó chạy yarn hoặc npm install để cài package
  • Thêm script của tampermonkey từ file .tampermonkey-script.js
  • Chạy server bằng câu lệnh yarn start hoặc npm start
  • Mở web site chat gpt nhớ bật 2 extentions vừa cài đặt bên trên sau đó nếu xuất hiện dòng API connected! như ảnh .success.png là được.
  • Có thể test thử bằng cách gửi http POST request bằng postman tới địa chỉ như bên dưới để test câu trả lời.

http://localhost:8766/v1/chat/completions

{
  "messages": "Tôi có câu hỏi: Tôi có đẹp trai không? Vui lòng trả lời theo mẫu: Tôi đẹp trai hay không: Đẹp trai thì có gì sai: Đẹp trai có kiếm được tiền không:",
  "model": "gpt-3.5"
}

Tuỳ vào câu trả lời mà chat gpt sẽ trả về phần div wrap câu hỏi khác nhau, phần này cần kiểm tra kĩ sau đó sửa phần PLEASE CHECK HERE ở file .tampermonkey-script.js để lấy được đúng data. Tham khảo ảnh chat-gpt-answer.png để biết cách lấy class name đúng.

Chạy crawl câu hỏi

Trong file .crawl-data-sempai.js sẽ có 2 function chính getData() là function chạy cronjob duyệt qua data sau đó gửi request sang server đã kết nối với chat gpt. Còn lại function dataToCSV() dành để xử lý dữ liệu. Phần này mọi người có thể sửa tuỳ thích sao cho hợp lý đúng theo phần mong muốn.

  • Copy file câu hỏi vào folder chính, nhớ copy file csv, đổi tên tuỳ thích nhưng nhớ đổi tên trùng với phần ``QUESTION_FILENAME`
  • Chạy cronjob bằng lệnh node crawl-data-sempai.js. Sau khi lấy data xong có thể comment functions getData() sau đó chạy tiếp function dataToCSV()

crawl-chat-gpt's People

Contributors

zsodur avatar spectrum184 avatar

Stargazers

backluejapanit avatar

Watchers

backluejapanit avatar

Forkers

backluejapanit

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.