Closed leducgiachoang closed 1 year ago
@leducgiachoang this package is node.js-only, so you need to put it in a backend API route that you can call from your frontend.
if you try to put node.js modules in browser / frontend code, you'll random errors like this one.
@leducgiachoanggói này chỉ dành cho node.js, vì vậy bạn cần đặt gói này vào tuyến API phụ trợ mà bạn có thể gọi từ giao diện người dùng của mình.
nếu bạn cố gắng đặt các mô-đun node.js trong mã trình duyệt/giao diện người dùng, bạn sẽ gặp các lỗi ngẫu nhiên như lỗi này.
Could you please guide me on how to track chat process using nodejs?
@leducgiachoanggói này chỉ dành cho node.js, vì vậy bạn cần đặt gói này vào tuyến API phụ trợ mà bạn có thể gọi từ giao diện người dùng của mình.
nếu bạn cố gắng đặt các mô-đun node.js trong mã trình duyệt/giao diện người dùng, bạn sẽ gặp các lỗi ngẫu nhiên như lỗi này.
@transitive-bullshit I tried to follow your instructions, but it seems that the conversation is not being recorded. I don't have much experience with nodejs, so please help me. Here is my code.
router.post('/', async function(req, res, next) { var {ChatGPTAPI, ChatGPTUnofficialProxyAPI} = await import("chatgpt") const api = new ChatGPTUnofficialProxyAPI({accessToken: "sess-code"}); const prompt = req.body.prompt; const conversationId = req.body.conversationId; const parentMessageId = req.body.parentMessageId const send = await api.sendMessage(prompt, { conversationId: conversationId, parentMessageId: parentMessageId }) console.log(send) res.json({ title: send.text, parentMessageId: send.parentMessageId, conversationId: send.conversationId }); });
npm 安装了buffer 在main.js中引入了buffer `import * as buffer from "buffer"
if (typeof (window).global === "undefined"){
(window).global = window;
}
if (typeof (window).Buffer === "undefined") {
(window).Buffer = buffer.Buffer
}`
npm 安装了buffer 在main.js中引入了buffer `import * as buffer from "buffer"
if (typeof (window).global === "undefined"){ (window).global = window; } if (typeof (window).Buffer === "undefined") { (window).Buffer = buffer.Buffer }` @wzwei1990 It seems to have worked, but unfortunately it produced another error.
npm 又安装了unfetch 修改了源码替换了fetch
npm 又安装了unfetch 修改了源码替换了fetch
@wzwei1990 How does it work? I installed it but can't use it. I'm writing with the Vue.js library.
@wzwei1990
npm 又安装了unfetch 修改了源码替换了fetch
@wzwei1990 How does it work? I installed it but can't use it. I'm writing with the Vue.js library. 我用的vue3 需要删除一下.vite文件夹 重新编译
@leducgiachoang @wzwei1990 none of this code should ever be run on the browser. It is insecure and unsupporteed.
It is only intended to be used from a Node.js server.
npm 又安装了không tìm nạp và không tìm nạp
@wzwei1990Làm thế nào nó hoạt động? Tôi đã cài đặt nó nhưng không thể sử dụng nó. Tôi đang viết bằng thư viện Vue.js. 我用的vue3 需要删除一下.vite文件夹 重新编译
@wzwei1990 It cannot be added
@leducgiachoang @wzwei1990 none of this code should ever be run on the browser. It is insecure and unsupporteed.
It is only intended to be used from a Node.js server.
@transitive-bullshit Can you create a similar library for Vuejs?
@transitive-bullshit Please take a look at this simple tool that I have created.:
https://chrome.google.com/webstore/detail/chatgpt-extension/dcbcnpnaccfjoikaofjgcipcfbmfkpmj
@leducgiachoang @wzwei1990 none of this code should ever be run on the browser. It is insecure and unsupporteed. It is only intended to be used from a Node.js server.
@transitive-bullshit Can you create a similar library for Vuejs? https://www.npmjs.com/package/unfetch npm i unfetch 先安装unfetch 再去找chatgpt位置,你应该是找错位置了 我是修改的源码 \node_modules\chatgpt\build\index.js 里面
@leducgiachoang @wzwei1990không mã nào trong số này được chạy trên trình duyệt. Nó không an toàn và không được hỗ trợ. Nó chỉ được dự định sử dụng từ máy chủ Node.js.
@transitive-bullshitBạn có thể tạo một thư viện tương tự cho Vuejs không? https://www.npmjs.com/package/unfetch npm i unfetch 先安装unfetch 再去找chatgpt位置,你应该是找错位置了 我是修改的源码 \node_modules\chatgpt\build\index.js 里面
@wzwei1990 This is my code, and it's not working. Can I add you to my git project?
@leducgiachoang @wzwei1990 none of this code should ever be run on the browser. It is insecure and unsupporteed. It is only intended to be used from a Node.js server.
@transitive-bullshit Can you create a similar library for Vuejs?
This project supports Node.js. You can call it from any frontend framework including Vue.js via an API. You need to host the Node.js API either using a serverless function or on a server somewhere and then call into it from your Vue.js / React / Svelte / JS app.
There is no version of this library which supports Vue.js directly (or any frontend framework) because it is fundamentally meant to only be used from the backend.
@leducgiachoang @wzwei1990không mã nào trong số này được chạy trên trình duyệt. Nó không an toàn và không được hỗ trợ. Nó chỉ được dự định sử dụng từ máy chủ Node.js.
@transitive-bullshitBạn có thể tạo một thư viện tương tự cho Vuejs không?
Dự án này hỗ trợ Node.js. Bạn có thể gọi nó từ bất kỳ khung giao diện người dùng nào, kể cả Vue.js thông qua API. Bạn cần lưu trữ API Node.js bằng cách sử dụng chức năng serverless hoặc trên máy chủ ở đâu đó và sau đó gọi nó từ ứng dụng Vue.js / React / Svelte / JS của bạn.
Không có phiên bản nào của thư viện này hỗ trợ trực tiếp Vue.js (hoặc bất kỳ khung giao diện người dùng nào) vì về cơ bản, nó chỉ được sử dụng từ phần phụ trợ.
@wzwei1990 Do you have any specific examples or projects that use a library for Node.js?
Verify latest release
chatgpt
releaseVerify webapp is working
Environment details
This is my code, it doesn't seem to be working.
const api = new ChatGPTAPI({apiKey: localStorage.getItem("SECRET_KEY")});
const res = await api.sendMessage(text)
console.log(res)
It requires the Buffer library and I have installed it but still encounter errors.
npm install buffer
Is this an error message? Can anyone help me?
Describe the Bug
Cannot use libraries within Vuejs application, I need help