Skip to content

Commit 4afdc13

Browse files
committed
Add support for the Minimax chatbot across the extension and browser connector
1 parent 59fb644 commit 4afdc13

12 files changed

Lines changed: 205 additions & 94 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Install the [open-source](https://github.com/robertpiosik/CodeWebChat/blob/dev/p
8383
- Grok
8484
- HuggingChat
8585
- Kimi
86+
- Minimax
8687
- Mistral
8788
- Open WebUI
8889
- OpenRouter

‎packages/browser/src/content-scripts/send-prompt-content-script/chatbots/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export * from './gemini'
77
export * from './grok'
88
export * from './github-copilot'
99
export * from './hugging-chat'
10+
export * from './minimax'
1011
export * from './meta'
1112
export * from './mistral'
1213
export * from './open-webui'
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { Chatbot } from '../types/chatbot'
2+
import {
3+
add_apply_response_button,
4+
observe_for_responses
5+
} from '../utils/add-apply-response-button'
6+
import {
7+
InitializationError,
8+
report_initialization_error
9+
} from '../utils/report-initialization-error'
10+
11+
export const minimax: Chatbot = {
12+
wait_until_ready: async () => {
13+
await new Promise((resolve) => {
14+
const check_for_element = () => {
15+
if (document.querySelector('textarea')) {
16+
resolve(null)
17+
} else {
18+
setTimeout(check_for_element, 100)
19+
}
20+
}
21+
check_for_element()
22+
})
23+
},
24+
inject_apply_response_button: (
25+
client_id: number,
26+
raw_instructions?: string,
27+
edit_format?: string
28+
) => {
29+
const add_buttons = (footer: Element) => {
30+
add_apply_response_button({
31+
client_id,
32+
raw_instructions,
33+
edit_format,
34+
footer,
35+
get_chat_turn: (f) =>
36+
f.parentElement!.parentElement!.querySelector('.message'),
37+
perform_copy: (f) => {
38+
const copy_button = f.querySelector('div:first-child') as HTMLElement
39+
if (!copy_button) {
40+
report_initialization_error({
41+
function_name: 'minimax.perform_copy',
42+
log_message: 'Copy button not found',
43+
alert_message: InitializationError.UNABLE_TO_COPY_RESPONSE
44+
})
45+
return
46+
}
47+
copy_button.click()
48+
},
49+
insert_button: (f, b) =>
50+
f.insertBefore(b, f.children[f.children.length])
51+
})
52+
}
53+
54+
observe_for_responses({
55+
chatbot_name: 'Minimax',
56+
is_generating: () =>
57+
!!document.querySelector(
58+
'path[d="M0 3C0 1.34315 1.34315 0 3 0H9C10.6569 0 12 1.34315 12 3V9C12 10.6569 10.6569 12 9 12H3C1.34315 12 0 10.6569 0 9V3Z"]'
59+
) ||
60+
!document.querySelector(
61+
'.message.received + div > div > div:last-child'
62+
),
63+
footer_selector: '.message.received + div > div',
64+
add_buttons
65+
})
66+
}
67+
}

‎packages/browser/src/content-scripts/send-prompt-content-script/chatbots/z-ai.ts‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,7 @@ export const z_ai: Chatbot = {
5555
raw_instructions,
5656
edit_format,
5757
footer,
58-
get_chat_turn: (f) => {
59-
const chat_turn = f.parentElement?.querySelector('.chat-assistant')
60-
if (!chat_turn) {
61-
report_initialization_error({
62-
function_name: 'z_ai.get_chat_turn',
63-
log_message: 'Chat turn container not found for footer',
64-
alert_message: InitializationError.UNABLE_TO_COPY_RESPONSE
65-
})
66-
return null
67-
}
68-
return chat_turn as HTMLElement
69-
},
58+
get_chat_turn: (f) => f.parentElement!.querySelector('.chat-assistant'),
7059
get_code_from_block: (b) => b.querySelector('.cm-line')?.textContent,
7160
perform_copy: (f) => {
7261
const copy_button = f.querySelector('button.copy-response-button')

‎packages/browser/src/content-scripts/send-prompt-content-script/send-prompt-content-script.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
together,
2222
github_copilot,
2323
hugging_chat,
24+
minimax,
2425
perplexity,
2526
z_ai
2627
} from './chatbots'
@@ -70,6 +71,9 @@ const is_yuanbao = current_url.startsWith(yuanbao_url)
7071
const hugging_chat_url = 'https://huggingface.co/chat/'
7172
const is_hugging_chat = current_url.startsWith(hugging_chat_url)
7273

74+
const minimax_url = 'https://agent.minimax.io/'
75+
const is_minimax = current_url.startsWith(minimax_url)
76+
7377
const meta_url = 'https://www.meta.ai/'
7478
const is_meta = current_url.startsWith(meta_url)
7579

@@ -109,6 +113,8 @@ if (is_ai_studio) {
109113
chatbot = claude
110114
} else if (is_hugging_chat) {
111115
chatbot = hugging_chat
116+
} else if (is_minimax) {
117+
chatbot = minimax
112118
} else if (is_mistral) {
113119
chatbot = mistral
114120
} else if (is_open_webui) {
@@ -152,7 +158,8 @@ export const get_textarea_element = () => {
152158
[together_url]: 'textarea',
153159
[z_ai_url]: 'textarea',
154160
[github_copilot_url]: 'textarea',
155-
[hugging_chat_url]: 'textarea'
161+
[hugging_chat_url]: 'textarea',
162+
[minimax_url]: 'textarea'
156163
} as any
157164

158165
// Find the appropriate selector based on the URL without the hash

‎packages/browser/src/content-scripts/send-prompt-content-script/utils/add-apply-response-button.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function add_apply_response_button(params: {
3030
if (!chat_turn) {
3131
Logger.error({
3232
function_name: 'add_apply_response_button',
33-
message: 'Chat turn container not found for footer',
33+
message: 'Chat turn container not found',
3434
data: params.footer
3535
})
3636
return

‎packages/browser/src/manifest.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"https://grok.com/",
3737
"https://huggingface.co/chat/",
3838
"https://www.kimi.com/",
39+
"https://agent.minimax.io/",
3940
"https://chat.mistral.ai/chat",
4041
"http://openwebui/",
4142
"https://openrouter.ai/chat*",

‎packages/shared/src/constants/chatbots.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,20 @@ export const CHATBOTS = {
239239
default_top_p: 0,
240240
models: {}
241241
},
242+
Minimax: {
243+
url: 'https://agent.minimax.io/',
244+
supports_custom_temperature: false,
245+
supports_custom_top_p: false,
246+
supports_system_instructions: false,
247+
supports_user_provided_model: false,
248+
supports_user_provided_port: false,
249+
supports_reasoning_effort: false,
250+
supports_thinking_budget: false,
251+
default_system_instructions: '',
252+
supported_options: {},
253+
default_top_p: 0,
254+
models: {}
255+
},
242256
Mistral: {
243257
url: 'https://chat.mistral.ai/chat',
244258
supports_custom_temperature: false,
Lines changed: 5 additions & 0 deletions
Loading

‎packages/ui/src/components/editor/common/Icon/Icon.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import HashSign from '../../../../assets/icons/hash-sign.svg'
1818
import HuggingChat from '../../../../assets/icons/hugging-chat.svg'
1919
import Kimi from '../../../../assets/icons/kimi.svg'
2020
import Meta from '../../../../assets/icons/meta.svg'
21+
import Minimax from '../../../../assets/icons/minimax.svg'
2122
import Mistral from '../../../../assets/icons/mistral.svg'
2223
import OpenRouter from '../../../../assets/icons/openrouter.svg'
2324
import OpenWebUI from '../../../../assets/icons/open-webui.svg'
@@ -51,6 +52,7 @@ export namespace Icon {
5152
| 'HUGGING_CHAT'
5253
| 'KIMI'
5354
| 'META'
55+
| 'MINIMAX'
5456
| 'MISTRAL'
5557
| 'OPENROUTER'
5658
| 'OPEN_WEBUI'
@@ -131,6 +133,9 @@ export const Icon: React.FC<Icon.Props> = ({ variant }) => {
131133
case 'META':
132134
icon = <Meta />
133135
break
136+
case 'MINIMAX':
137+
icon = <Minimax />
138+
break
134139
case 'MISTRAL':
135140
icon = <Mistral />
136141
break

0 commit comments

Comments
 (0)