Skip to content

Commit 89bcde1

Browse files
committed
Add support for Kimi China and refine reasoning effort validation in UI configurations
- when displaying web configuration we show reasoning effort. Sometimes chatbots get updated and reasoning efforts stop being supported. Assess if its saved in user-settings reasoning effort is supported and exists in `packages/shared/src/constants/chatbots.ts`, if not, don't display it on the configurations list. The goal is to ignore no longer supported reasoning efforts in prompt panel and settings. - add support for kimi (chinese) https://www.kimi.com/ (the website is identical so hanling in the browser extension should be shared) ├── apps │ ├── browser │ │ └── src │ │ ├── content-scripts │ │ │ └── send-prompt-content-script │ │ │ ├── chatbots │ │ │ │ └── kimi.ts │ │ │ └── send-prompt-content-script.ts │ │ └── manifest.json │ └── editor │ └── src │ ├── utils │ │ └── show-configurations-quick-pick.ts │ └── views │ ├── prompt │ │ └── frontend │ │ └── Main │ │ └── MainView │ │ ├── MainView.tsx │ │ └── hooks │ │ └── use-last-choice-tooltip.ts │ ├── settings │ │ ├── backend │ │ │ └── message-handlers │ │ │ └── handle-select-default-api-configuration.ts │ │ └── frontend │ │ └── Home │ │ └── sections │ │ └── WebSection.tsx │ └── shared │ └── forms │ └── EditWebConfigurationForm │ └── EditWebConfigurationForm.tsx └── packages └── shared └── src └── constants └── chatbots.ts
1 parent bf384cb commit 89bcde1

7 files changed

Lines changed: 63 additions & 17 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ const is_grok = current_url.startsWith(grok_url)
7575
const doubao_url = 'https://www.doubao.com/chat/'
7676
const is_doubao = current_url.startsWith(doubao_url)
7777

78-
const kimi_url = 'https://www.kimi.ai/'
79-
const is_kimi = current_url.startsWith(kimi_url)
78+
const kimi_global_url = 'https://www.kimi.ai/'
79+
const kimi_china_url = 'https://www.kimi.com/'
80+
const is_kimi =
81+
current_url.startsWith(kimi_global_url) ||
82+
current_url.startsWith(kimi_china_url)
8083

8184
const meta_url = 'https://www.meta.ai/'
8285
const is_meta = current_url.startsWith(meta_url)

‎apps/browser/src/manifest.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Autofill for Code Web Chat",
55
"short_name": "CWC",
66
"description": "Got tired with copy and paste? Enable prompt autofill!",
7-
"version": "2026.1010.14",
7+
"version": "2026.1010.15",
88
"homepage_url": "https://github.com/robertpiosik/CodeWebChat",
99
"icons": {
1010
"16": "icons/icon-16.png",
@@ -36,6 +36,7 @@
3636
"https://huggingface.co/chat/",
3737
"https://arena.ai/*",
3838
"https://www.kimi.ai/",
39+
"https://www.kimi.com/",
3940
"https://www.meta.ai/",
4041
"https://chat.mistral.ai/*",
4142
"http://openwebui/",

‎apps/editor/src/utils/show-configurations-quick-pick.ts‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@ const map_web_configuration_to_item = (
4545
if (!is_unnamed && web_configuration.chatbot)
4646
details.push(web_configuration.chatbot)
4747
if (model) details.push(model)
48-
if (
49-
web_configuration.reasoningEffort &&
50-
(chatbot?.supports_reasoning_effort ||
51-
!!(
52-
web_configuration.model &&
53-
chatbot_models?.[web_configuration.model]?.supported_reasoning_efforts
54-
))
55-
) {
56-
details.push(web_configuration.reasoningEffort)
48+
if (web_configuration.reasoningEffort) {
49+
const supported_efforts =
50+
chatbot?.supported_reasoning_efforts ||
51+
(web_configuration.model &&
52+
chatbot_models?.[web_configuration.model]
53+
?.supported_reasoning_efforts) ||
54+
[]
55+
if (supported_efforts.includes(web_configuration.reasoningEffort)) {
56+
details.push(web_configuration.reasoningEffort)
57+
}
5758
}
5859
return {
5960
label: `${is_unnamed ? web_configuration.chatbot! : web_configuration.name!.replace(/\s*\(\d+\)$/, '')}`,

‎apps/editor/src/views/prompt/frontend/Main/MainView/MainView.tsx‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,15 @@ export const MainView: React.FC<Props> = (props) => {
269269
}
270270

271271
if (reasoning_effort) {
272-
details.push(reasoning_effort)
272+
const chatbot_config = chatbot ? CHATBOTS[chatbot] : undefined
273+
const supported_efforts =
274+
chatbot_config?.supported_reasoning_efforts ||
275+
(model &&
276+
chatbot_config?.models?.[model]?.supported_reasoning_efforts) ||
277+
[]
278+
if (supported_efforts.includes(reasoning_effort)) {
279+
details.push(reasoning_effort)
280+
}
273281
}
274282

275283
return details

‎apps/editor/src/views/prompt/frontend/Main/MainView/hooks/use-last-choice-tooltip.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,20 @@ export const use_last_choice_tooltip = (params: {
5656
}
5757
}
5858
if (reasoning_effort) {
59-
base = base ? `${base} · ${reasoning_effort}` : reasoning_effort
59+
const chatbot_config = chatbot
60+
? CHATBOTS[chatbot as keyof typeof CHATBOTS]
61+
: undefined
62+
const supported_efforts =
63+
chatbot_config?.supported_reasoning_efforts ||
64+
(model &&
65+
chatbot_config?.models?.[model]
66+
?.supported_reasoning_efforts) ||
67+
[]
68+
if (supported_efforts.includes(reasoning_effort)) {
69+
base = base
70+
? `${base} · ${reasoning_effort}`
71+
: reasoning_effort
72+
}
6073
}
6174
return base
6275
}

‎apps/editor/src/views/settings/frontend/Home/sections/WebSection.tsx‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,15 @@ export const WebSection = forwardRef<HTMLDivElement, Props>((props, ref) => {
131131
}
132132

133133
if (reasoning_effort) {
134-
details.push(reasoning_effort)
134+
const chatbot_config = chatbot ? CHATBOTS[chatbot] : undefined
135+
const supported_efforts =
136+
chatbot_config?.supported_reasoning_efforts ||
137+
(model &&
138+
chatbot_config?.models?.[model]?.supported_reasoning_efforts) ||
139+
[]
140+
if (supported_efforts.includes(reasoning_effort)) {
141+
details.push(reasoning_effort)
142+
}
135143
}
136144

137145
return details
@@ -214,7 +222,16 @@ export const WebSection = forwardRef<HTMLDivElement, Props>((props, ref) => {
214222
}
215223

216224
if (reasoning_effort) {
217-
details.push(reasoning_effort)
225+
const chatbot_config = chatbot ? CHATBOTS[chatbot] : undefined
226+
const supported_efforts =
227+
chatbot_config?.supported_reasoning_efforts ||
228+
(model &&
229+
chatbot_config?.models?.[model]
230+
?.supported_reasoning_efforts) ||
231+
[]
232+
if (supported_efforts.includes(reasoning_effort)) {
233+
details.push(reasoning_effort)
234+
}
218235
}
219236

220237
return details

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,12 @@ export const CHATBOTS = {
119119
supports_reasoning_effort: true,
120120
supported_reasoning_efforts: ['Low', 'Medium', 'High']
121121
} as Chatbot,
122-
Kimi: {
122+
'Kimi (Global)': {
123123
url: 'https://www.kimi.ai/'
124124
} as Chatbot,
125+
'Kimi (China)': {
126+
url: 'https://www.kimi.com/'
127+
} as Chatbot,
125128
'Meta AI': {
126129
url: 'https://www.meta.ai/'
127130
} as Chatbot,

0 commit comments

Comments
 (0)