homanp / langchain-ui

🧬 The open source chat-ai toolkit
https://langchain-ui.vercel.app
MIT License
881 stars 160 forks source link

have any method to config proxy by default fetch? #46

Closed xiongwn closed 1 year ago

xiongwn commented 1 year ago

have any method to config proxy by default fetch?

in node_modules\langchain\dist\util\axios-fetch-adapter.js langchain link openapi default by fetch not axios.post stageOne = await fetch(request)

I try https-proxy-agent but not work. So if you have any method to change proxy in fetch adapter?

By the way,clash for windows global mode did not change nodejs network proxy.

homanp commented 1 year ago

What are you trying to achieve?

homanp commented 1 year ago

have any method to config proxy by default fetch?

in node_modules\langchain\dist\util\axios-fetch-adapter.js

langchain link openapi default by fetch not axios.post

stageOne = await fetch(request)

I try https-proxy-agent but not work.

So if you have any method to change proxy in fetch adapter?

By the way,clash for windows global mode did not change nodejs network proxy.

You should be able to configure a proxy using the LangChainJS proxy config.

OpenAIChat({
  ...openAIConfig,
}, {
  basePath,
  baseOptions: {
    httpsAgent: agent,
    adapter: null
  }
})