-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add Atlas Cloud API bots #1082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add Atlas Cloud API bots #1082
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import LangChainBot from "@/bots/LangChainBot"; | ||
| import store from "@/store"; | ||
| import { ChatOpenAI } from "@langchain/openai"; | ||
|
|
||
| export default class AtlasCloudAPIBot extends LangChainBot { | ||
| static _brandId = "atlasCloudApi"; | ||
| static _className = "AtlasCloudAPIBot"; | ||
| static _logoFilename = "default-logo.svg"; | ||
|
|
||
| constructor() { | ||
| super(); | ||
| } | ||
|
|
||
| async _checkAvailability() { | ||
| let available = false; | ||
|
|
||
| if (store.state.atlasCloudApi.apiKey) { | ||
| this.setupModel(); | ||
| available = true; | ||
| } | ||
| return available; | ||
| } | ||
|
|
||
| _setupModel() { | ||
| const chatModel = new ChatOpenAI({ | ||
| configuration: { | ||
| baseURL: "https://api.atlascloud.ai/v1", | ||
| }, | ||
| openAIApiKey: store.state.atlasCloudApi.apiKey, | ||
| modelName: this.constructor._model ? this.constructor._model : "", | ||
| temperature: store.state.atlasCloudApi.temperature, | ||
| maxTokens: store.state.atlasCloudApi.maxTokens, | ||
| streaming: true, | ||
| }); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| return chatModel; | ||
| } | ||
|
|
||
| getPastRounds() { | ||
| return store.state.atlasCloudApi.pastRounds ?? 5; | ||
| } | ||
|
Comment on lines
+38
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using a simple ternary check getPastRounds() {
return store.state.atlasCloudApi.pastRounds ?? 5;
}
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import AtlasCloudAPIBot from "./AtlasCloudAPIBot"; | ||
|
|
||
| export default class AtlasCloudDeepSeekV4ProBot extends AtlasCloudAPIBot { | ||
| static _className = "AtlasCloudDeepSeekV4ProBot"; | ||
| static _model = "deepseek-ai/deepseek-v4-pro"; | ||
|
|
||
| constructor() { | ||
| super(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import AtlasCloudAPIBot from "./AtlasCloudAPIBot"; | ||
|
|
||
| export default class AtlasCloudQwen35FlashBot extends AtlasCloudAPIBot { | ||
| static _className = "AtlasCloudQwen35FlashBot"; | ||
| static _model = "qwen/qwen3.5-flash"; | ||
|
|
||
| constructor() { | ||
| super(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| <template> | ||
| <CommonBotSettings | ||
| :settings="settings" | ||
| :brand-id="brandId" | ||
| mutation-type="setAtlasCloudApi" | ||
| :watcher="watcher" | ||
| /> | ||
| </template> | ||
|
Comment on lines
+1
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The template has inconsistent indentation and a split closing tag |
||
|
|
||
| <script> | ||
| import _bots from "@/bots"; | ||
| import Bot from "@/bots/atlascloud/AtlasCloudAPIBot"; | ||
| import CommonBotSettings from "@/components/BotSettings/CommonBotSettings.vue"; | ||
| import { Type } from "./settings.const"; | ||
|
|
||
| const settings = [ | ||
| { | ||
| type: Type.Text, | ||
| name: "apiKey", | ||
| title: "common.apiKey", | ||
| description: "settings.secretPrompt", | ||
| placeholder: "ak-...", | ||
| }, | ||
| { | ||
| type: Type.Slider, | ||
| name: "temperature", | ||
| title: "openaiApi.temperature", | ||
| description: "openaiApi.temperaturePrompt", | ||
| min: 0, | ||
| max: 2, | ||
| step: 0.1, | ||
| ticks: { | ||
| 0: "openaiApi.temperature0", | ||
| 2: "openaiApi.temperature2", | ||
| }, | ||
| }, | ||
| { | ||
| type: Type.Slider, | ||
| name: "maxTokens", | ||
| title: "claudeApi.maxTokens", | ||
| description: "claudeApi.maxTokensPrompt", | ||
| min: 512, | ||
| max: 8192, | ||
| step: 512, | ||
| }, | ||
| { | ||
| type: Type.Slider, | ||
| name: "pastRounds", | ||
| title: "bot.pastRounds", | ||
| description: "bot.pastRoundsPrompt", | ||
| min: 0, | ||
| max: 10, | ||
| step: 1, | ||
| }, | ||
| ]; | ||
| export default { | ||
| components: { | ||
| CommonBotSettings, | ||
| }, | ||
| data() { | ||
| return { | ||
| settings: settings, | ||
| brandId: Bot._brandId, | ||
| }; | ||
| }, | ||
| methods: { | ||
| watcher() { | ||
| _bots.all | ||
| .filter((bot) => bot instanceof Bot) | ||
| .forEach((bot) => bot.setupModel()); | ||
| }, | ||
|
Comment on lines
+67
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
| }, | ||
| }; | ||
| </script> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
@langchain/openai(which uses theopenaiSDK v4), the custom API endpoint should be configured using thebaseURLparameter instead ofbasePath. UsingbasePathwill cause the SDK to ignore the custom endpoint and default to the official OpenAI API URL (https://api.openai.com/v1), which will fail for Atlas Cloud.