Skip to content

Commit

Permalink
Add GitHub Models API
Browse files Browse the repository at this point in the history
  • Loading branch information
Di AI authored and eddieai committed Feb 16, 2025
1 parent 383575c commit 47ae184
Show file tree
Hide file tree
Showing 30 changed files with 374 additions and 0 deletions.
Binary file added public/bots/llama-31-405b-github-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/bots/llama-31-70b-github-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/bots/llama-31-8b-github-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/bots/mistral-large-github-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/bots/mistral-nemo-github-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/bots/openai-4o-github-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/bots/openai-4o-mini-github-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions src/bots/github/GitHubAPIBot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import LangChainBot from "../LangChainBot";
import { ChatOpenAI } from "@langchain/openai";
import store from "@/store/index";

export default class GitHubAPIBot extends LangChainBot {
static _brandId = "gitHubApi"; // Brand id of the bot, should be unique. Used in i18n.
static _className = "GitHubAPIBot";

constructor() {
super();
}

async _checkAvailability() {
let available = false;

if (store.state.gitHubApi.apiKey) {
this.setupModel();
available = true;
}
return available;
}

_setupModel() {
const chatModel = new ChatOpenAI({
configuration: {
basePath: "https://models.inference.ai.azure.com",
},
openAIApiKey: store.state.gitHubApi.apiKey,
modelName: this.constructor._model ? this.constructor._model : "",
temperature: store.state.gitHubApi.temperature,
streaming: true,
});
return chatModel;
}

getPastRounds() {
return store.state.gitHubApi.pastRounds;
}
}
12 changes: 12 additions & 0 deletions src/bots/github/GitHubAPIGPT4oBot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import GitHubAPIBot from "./GitHubAPIBot";

export default class GitHubAPIGPT4oBot extends GitHubAPIBot {
static _className = "GitHubAPIGPT4oBot";
static _model = "gpt-4o";
static _logoFilename = "openai-4o-github-logo.png"; // Place it in public/bots/
static _isDarkLogo = true; // The main color of logo is dark

constructor() {
super();
}
}
12 changes: 12 additions & 0 deletions src/bots/github/GitHubAPIGPT4oMiniBot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import GitHubAPIBot from "./GitHubAPIBot";

export default class GitHubAPIGPT4oMiniBot extends GitHubAPIBot {
static _className = "GitHubAPIGPT4oMiniBot";
static _model = "gpt-4o-mini";
static _logoFilename = "openai-4o-mini-github-logo.png"; // Place it in public/bots/
static _isDarkLogo = true; // The main color of logo is dark

constructor() {
super();
}
}
11 changes: 11 additions & 0 deletions src/bots/github/GitHubAPILlama31405bBot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import GitHubAPIBot from "./GitHubAPIBot";

export default class GitHubAPILlama31405bBot extends GitHubAPIBot {
static _className = "GitHubAPILlama31405bBot";
static _model = "Meta-Llama-3.1-405B-Instruct";
static _logoFilename = "llama-31-405b-github-logo.png";

constructor() {
super();
}
}
11 changes: 11 additions & 0 deletions src/bots/github/GitHubAPILlama3170bBot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import GitHubAPIBot from "./GitHubAPIBot";

export default class GitHubAPILlama3170bBot extends GitHubAPIBot {
static _className = "GitHubAPILlama3170bBot";
static _model = "Meta-Llama-3.1-70B-Instruct";
static _logoFilename = "llama-31-70b-github-logo.png";

constructor() {
super();
}
}
11 changes: 11 additions & 0 deletions src/bots/github/GitHubAPILlama318bBot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import GitHubAPIBot from "./GitHubAPIBot";

export default class GitHubAPILlama318bBot extends GitHubAPIBot {
static _className = "GitHubAPILlama318bBot";
static _model = "Meta-Llama-3.1-8B-Instruct";
static _logoFilename = "llama-31-8b-github-logo.png";

constructor() {
super();
}
}
11 changes: 11 additions & 0 deletions src/bots/github/GitHubAPIMistralLargeBot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import GitHubAPIBot from "./GitHubAPIBot";

export default class GitHubAPIMistralLargeBot extends GitHubAPIBot {
static _className = "GitHubAPIMistralLargeBot";
static _model = "Mistral-large-2407";
static _logoFilename = "mistral-large-github-logo.png";

constructor() {
super();
}
}
11 changes: 11 additions & 0 deletions src/bots/github/GitHubAPIMistralNemoBot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import GitHubAPIBot from "./GitHubAPIBot";

export default class GitHubAPIMistralNemoBot extends GitHubAPIBot {
static _className = "GitHubAPIMistralNemoBot";
static _model = "Mistral-nemo";
static _logoFilename = "mistral-nemo-github-logo.png";

constructor() {
super();
}
}
28 changes: 28 additions & 0 deletions src/bots/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ import ClaudeAPISonnetBot from "./anthropic/ClaudeAPISonnetBot";
import ClaudeAPIHaikuBot from "./anthropic/ClaudeAPIHaikuBot";
import GrokBetaAPIBot from "./xai/GrokBetaAPIBot";
import Grok2APIBot from "./xai/Grok2APIBot";
import GitHubAPIGPT4oBot from "./github/GitHubAPIGPT4oBot";
import GitHubAPIGPT4oMiniBot from "./github/GitHubAPIGPT4oMiniBot";
import GitHubAPILlama318bBot from "./github/GitHubAPILlama318bBot";
import GitHubAPILlama3170bBot from "./github/GitHubAPILlama3170bBot";
import GitHubAPILlama31405bBot from "./github/GitHubAPILlama31405bBot";
import GitHubAPIMistralLargeBot from "./github/GitHubAPIMistralLargeBot";
import GitHubAPIMistralNemoBot from "./github/GitHubAPIMistralNemoBot";

const all = [
Qihoo360AIBrainBot.getInstance(),
Expand Down Expand Up @@ -118,6 +125,13 @@ const all = [
YouChatBot.getInstance(),
GrokBetaAPIBot.getInstance(),
Grok2APIBot.getInstance(),
GitHubAPIGPT4oBot.getInstance(),
GitHubAPIGPT4oMiniBot.getInstance(),
GitHubAPILlama318bBot.getInstance(),
GitHubAPILlama3170bBot.getInstance(),
GitHubAPILlama31405bBot.getInstance(),
GitHubAPIMistralLargeBot.getInstance(),
GitHubAPIMistralNemoBot.getInstance(),
];

const disabled = ["HuggingChatBot"];
Expand Down Expand Up @@ -162,6 +176,13 @@ export const botTags = {
bots.getBotByClassName("PhindBot"),
bots.getBotByClassName("PiBot"),
bots.getBotByClassName("KimiBot"),
bots.getBotByClassName("GitHubAPIGPT4oBot"),
bots.getBotByClassName("GitHubAPIGPT4oMiniBot"),
bots.getBotByClassName("GitHubAPILlama318bBot"),
bots.getBotByClassName("GitHubAPILlama3170bBot"),
bots.getBotByClassName("GitHubAPILlama31405bBot"),
bots.getBotByClassName("GitHubAPIMistralLargeBot"),
bots.getBotByClassName("GitHubAPIMistralNemoBot"),
],
paid: [
bots.getBotByClassName("ChatGPT4Bot"),
Expand Down Expand Up @@ -206,6 +227,13 @@ export const botTags = {
bots.getBotByClassName("Mixtral8x7bGroqAPIBot"),
bots.getBotByClassName("GrokBetaAPIBot"),
bots.getBotByClassName("Grok2APIBot"),
bots.getBotByClassName("GitHubAPIGPT4oBot"),
bots.getBotByClassName("GitHubAPIGPT4oMiniBot"),
bots.getBotByClassName("GitHubAPILlama318bBot"),
bots.getBotByClassName("GitHubAPILlama3170bBot"),
bots.getBotByClassName("GitHubAPILlama31405bBot"),
bots.getBotByClassName("GitHubAPIMistralLargeBot"),
bots.getBotByClassName("GitHubAPIMistralNemoBot"),
],
madeInChina: [
bots.getBotByClassName("Qihoo360AIBrainBot"),
Expand Down
63 changes: 63 additions & 0 deletions src/components/BotSettings/GitHubAPIBotSettings.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<template>
<CommonBotSettings
:settings="settings"
:brand-id="brandId"
mutation-type="setGitHubApi"
:watcher="watcher"
></CommonBotSettings>
</template>

<script>
import Bot from "@/bots/github/GitHubAPIBot";
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: "sk-...",
},
{
type: Type.Slider,
name: "temperature",
title: "openaiApi.temperature",
description: "openaiApi.temperaturePrompt",
default: 1.0,
min: 0,
max: 2,
step: 0.05,
ticks: {
0: "openaiApi.temperature0",
2: "openaiApi.temperature2",
},
},
{
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() {
Bot.getInstance().setupModel();
},
},
};
</script>
2 changes: 2 additions & 0 deletions src/components/SettingsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ import ClaudeAIBotSettings from "./BotSettings/ClaudeAIBotSettings.vue";
import ChatGLMBotSettings from "./BotSettings/ChatGLMBotSettings.vue";
import CohereAPIBotSettings from "./BotSettings/CohereAPIBotSettings.vue";
import KimiBotSettings from "./BotSettings/KimiBotSettings.vue";
import GitHubAPIBotSettings from "./BotSettings/GitHubAPIBotSettings.vue";
import { resolveTheme, applyTheme, Mode } from "../theme";
import ClaudeAPIBotSettings from "./BotSettings/ClaudeAPIBotSettings.vue";
Expand Down Expand Up @@ -152,6 +153,7 @@ const botSettings = [
{ brand: "claudeAi", component: ClaudeAIBotSettings },
{ brand: "claudeApi", component: ClaudeAPIBotSettings },
{ brand: "cohereApi", component: CohereAPIBotSettings },
{ brand: "gitHubApi", component: GitHubAPIBotSettings },
{ brand: "geminiApi", component: GeminiAPIBotSettings },
{ brand: "gradio", component: GradioAppBotSettings },
{ brand: "groqApi", component: GroqAPIBotSettings },
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,21 @@
"temperature0": "Stärker deterministisch",
"temperature2": "Mehr zufällig"
},
"deepSeekApi": {
"name": "DeepSeek API",
"deepseek-chat": "deepseek-chat",
"deepseek-coder": "deepseek-coder"
},
"gitHubApi": {
"name": "GitHub Models API",
"gpt-4o": "GPT-4o",
"gpt-4o-mini": "GPT-4o-Mini",
"Meta-Llama-31-8B-Instruct": "Llama-3.1-8B",
"Meta-Llama-31-70B-Instruct": "Llama-3.1-70B",
"Meta-Llama-31-405B-Instruct": "Llama-3.1-405B",
"Mistral-large-2407": "Mistral-Large",
"Mistral-nemo": "Mistral-Nemo"
},
"poe": {
"name": "Poe",
"beaver": "GPT-4",
Expand Down
10 changes: 10 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,16 @@
"temperature0": "More deterministic",
"temperature2": "More random"
},
"gitHubApi": {
"name": "GitHub Models API",
"gpt-4o": "GPT-4o",
"gpt-4o-mini": "GPT-4o-Mini",
"Meta-Llama-31-8B-Instruct": "Llama-3.1-8B",
"Meta-Llama-31-70B-Instruct": "Llama-3.1-70B",
"Meta-Llama-31-405B-Instruct": "Llama-3.1-405B",
"Mistral-large-2407": "Mistral-Large",
"Mistral-nemo": "Mistral-Nemo"
},
"poe": {
"name": "Poe",
"beaver": "GPT-4",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,21 @@
"temperature0": "Más determinístico",
"temperature2": "Más al azar"
},
"deepSeekApi": {
"name": "DeepSeek API",
"deepseek-chat": "deepseek-chat",
"deepseek-coder": "deepseek-coder"
},
"gitHubApi": {
"name": "GitHub Models API",
"gpt-4o": "GPT-4o",
"gpt-4o-mini": "GPT-4o-Mini",
"Meta-Llama-31-8B-Instruct": "Llama-3.1-8B",
"Meta-Llama-31-70B-Instruct": "Llama-3.1-70B",
"Meta-Llama-31-405B-Instruct": "Llama-3.1-405B",
"Mistral-large-2407": "Mistral-Large",
"Mistral-nemo": "Mistral-Nemo"
},
"poe": {
"name": "Poe",
"beaver": "GPT-4",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,21 @@
"temperature0": "Plus déterministe",
"temperature2": "Plus aléatoire"
},
"deepSeekApi": {
"name": "DeepSeek API",
"deepseek-chat": "deepseek-chat",
"deepseek-coder": "deepseek-coder"
},
"gitHubApi": {
"name": "GitHub Models API",
"gpt-4o": "GPT-4o",
"gpt-4o-mini": "GPT-4o-Mini",
"Meta-Llama-31-8B-Instruct": "Llama-3.1-8B",
"Meta-Llama-31-70B-Instruct": "Llama-3.1-70B",
"Meta-Llama-31-405B-Instruct": "Llama-3.1-405B",
"Mistral-large-2407": "Mistral-Large",
"Mistral-nemo": "Mistral-Nemo"
},
"poe": {
"name": "Poe",
"beaver": "GPT-4",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,21 @@
"temperature0": "Più deterministico",
"temperature2": "Più casuale"
},
"deepSeekApi": {
"name": "DeepSeek API",
"deepseek-chat": "deepseek-chat",
"deepseek-coder": "deepseek-coder"
},
"gitHubApi": {
"name": "GitHub Models API",
"gpt-4o": "GPT-4o",
"gpt-4o-mini": "GPT-4o-Mini",
"Meta-Llama-31-8B-Instruct": "Llama-3.1-8B",
"Meta-Llama-31-70B-Instruct": "Llama-3.1-70B",
"Meta-Llama-31-405B-Instruct": "Llama-3.1-405B",
"Mistral-large-2407": "Mistral-Large",
"Mistral-nemo": "Mistral-Nemo"
},
"poe": {
"name": "Poe",
"beaver": "GPT-4",
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,21 @@
"temperature0": "より決定論的な",
"temperature2": "もっとランダム"
},
"deepSeekApi": {
"name": "DeepSeek API",
"deepseek-chat": "deepseek-chat",
"deepseek-coder": "deepseek-coder"
},
"gitHubApi": {
"name": "GitHub Models API",
"gpt-4o": "GPT-4o",
"gpt-4o-mini": "GPT-4o-Mini",
"Meta-Llama-31-8B-Instruct": "Llama-3.1-8B",
"Meta-Llama-31-70B-Instruct": "Llama-3.1-70B",
"Meta-Llama-31-405B-Instruct": "Llama-3.1-405B",
"Mistral-large-2407": "Mistral-Large",
"Mistral-nemo": "Mistral-Nemo"
},
"poe": {
"name": "Poe",
"beaver": "GPT-4",
Expand Down
Loading

0 comments on commit 47ae184

Please sign in to comment.