matrixgpt / matrix-chatgpt-bot

Talk to ChatGPT via any Matrix client!
GNU Affero General Public License v3.0
235 stars 63 forks source link

Custom API URL is not working #177

Closed ldubost closed 1 year ago

ldubost commented 1 year ago

The feature mentioned in #172 and #157 and commited in #161 is actually not working. The setting from the CHATGPT_REVERSE_PROXY is ignored because it is added inside an options object like that:

  const clientOptions = {  // (Optional) Parameters as described in https://platform.openai.com/docs/api-reference/completions
    modelOptions: {
      model: CHATGPT_API_MODEL,  // The model is set to gpt-3.5-turbo by default
      temperature: CHATGPT_TEMPERATURE,
    },
    promptPrefix: wrapPrompt(CHATGPT_PROMPT_PREFIX),
    debug: false,
    options: {
      reverseProxyUrl: CHATGPT_REVERSE_PROXY
    },
  };

when it should be added directly in the clientOptions object like this:

  const clientOptions = {  // (Optional) Parameters as described in https://platform.openai.com/docs/api-reference/completions
    modelOptions: {
      model: CHATGPT_API_MODEL,  // The model is set to gpt-3.5-turbo by default
      temperature: CHATGPT_TEMPERATURE,
    },
    promptPrefix: wrapPrompt(CHATGPT_PROMPT_PREFIX),
    debug: false,
    reverseProxyUrl: CHATGPT_REVERSE_PROXY
  };

This has been verified on my installation where chatgpt is getting called even when a URL for localAI is specified. After fixing the code, the setting is taken into account.

I'm sending a pull request very quickly.

d13g4 commented 1 year ago

can confirm, tried everything for a couple of hours until i noticed the option is ignored.

seshubonam commented 1 year ago

+1

max298 commented 1 year ago

Thank you for providing the fix @ldubost! I've just pushed a new tag v.3.1.2, could you verify if that resolves this issue?

ldubost commented 1 year ago

I can confirm it works well with this version 3.1.2 ! I'm able to contact LocalAI !