emqx / MQTTX

A Powerful and All-in-One MQTT 5.0 client toolbox for Desktop, CLI and WebSocket.
https://mqttx.app
Apache License 2.0
3.64k stars 428 forks source link

feat(copilot): support custom copilot api #1660

Closed ni00 closed 1 week ago

ni00 commented 1 month ago

PR Checklist

If you have any questions, you can refer to the Contributing Guide

What is the current behavior?

Currently, the copilot API interface only supports OpenAI's host and model.

Issue Number

1542

What is the new behavior?

The API interface of Copilot supports setting all request addresses and models that are compatible with the OpenAI API protocol.

Does this PR introduce a breaking change?

Specific Instructions

Supporting third-party large model interfaces has two main benefits:

  1. Supporting API calls for large models such as ChatGLM and DeepSeek can provide cheaper and faster services, and can be deployed in regions where OpenAI cannot be directly used (such as China).
  2. Companies using MQTTX can privatize their own large model services, compatible with OpenAI's API protocol through methods like One-API which is beneficial for internal data security and review.

Other information

ni00 commented 1 month ago

I used the DeepSeek API for testing, and Copilot worked very well. Host: https://api.deepseek.com/v1 Model: deepseek-chat

img1 img2

ysfscream commented 1 month ago

@ni00 Hi, sorry for the delayed response, and thanks for your contribution.

I will move this feature to the next version and extend the LLM API endpoint further. This PR might take a while to handle. Thanks again.