Skip to content

Commit 5d73650

Browse files
committed
Merge branch 'dev'
2 parents f90a553 + 88b082e commit 5d73650

11 files changed

Lines changed: 98 additions & 10 deletions

File tree

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const gemini: Chatbot = {
2626
if (!model) return
2727
if (model && model in CHATBOTS['Gemini'].models) {
2828
const model_selector_trigger = document.querySelector(
29-
'bard-logo + button'
29+
'bard-mode-switcher button'
3030
) as HTMLButtonElement
3131
if (!model_selector_trigger) {
3232
report_initialization_error({
@@ -36,11 +36,17 @@ export const gemini: Chatbot = {
3636
})
3737
return
3838
}
39+
40+
const model_label = (CHATBOTS['Gemini'].models as any)[model].label
41+
if (model_selector_trigger.textContent.includes(model_label)) {
42+
return
43+
}
44+
3945
model_selector_trigger.click()
4046
await new Promise((r) => requestAnimationFrame(r))
4147
const menu_content =
4248
document.querySelector('.mat-mdc-menu-content') ||
43-
document.querySelector('mat-action-list')
49+
document.querySelector('mat-bottom-sheet-container')
4450
if (!menu_content) {
4551
report_initialization_error({
4652
function_name: 'set_model',
@@ -56,11 +62,7 @@ export const gemini: Chatbot = {
5662
const name_element = option.querySelector(
5763
'.title-and-description > span:last-child'
5864
)
59-
if (
60-
name_element &&
61-
name_element.textContent?.trim() ==
62-
(CHATBOTS['Gemini'].models as any)[model].label
63-
) {
65+
if (name_element && name_element.textContent?.trim() == model_label) {
6466
;(option as HTMLElement).click()
6567
await new Promise((r) => requestAnimationFrame(r))
6668
break

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,43 @@ import {
1111
export const perplexity: Chatbot = {
1212
wait_until_ready: async () => {
1313
await new Promise((resolve) => setTimeout(resolve, 500))
14+
;(document.querySelector('[contenteditable="true"]') as any)?.click()
15+
},
16+
set_options: async (options?: string[]) => {
17+
if (!options) return
18+
19+
if (options.includes('search')) {
20+
// Enabled by default
21+
return
22+
}
23+
24+
const switcher_button = document.querySelector(
25+
'button[data-testid="sources-switcher-button"]'
26+
) as HTMLButtonElement
27+
if (!switcher_button) {
28+
report_initialization_error({
29+
function_name: 'perplexity.set_options',
30+
log_message: 'Sources switcher button not found',
31+
alert_message: InitializationError.UNABLE_TO_SET_OPTIONS
32+
})
33+
return
34+
}
35+
36+
switcher_button.click()
37+
await new Promise((r) => requestAnimationFrame(r))
38+
39+
const web_toggle = document.querySelector(
40+
'div[data-testid="source-toggle-web"]'
41+
) as HTMLElement
42+
if (web_toggle) {
43+
web_toggle.click()
44+
} else {
45+
report_initialization_error({
46+
function_name: 'perplexity.set_options',
47+
log_message: 'Web toggle button not found',
48+
alert_message: InitializationError.UNABLE_TO_SET_OPTIONS
49+
})
50+
}
1451
},
1552
enter_message_and_send: async (params) => {
1653
const input_element = document.querySelector(

‎packages/browser/src/manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Code Web Chat Connector",
55
"short_name": "CWC",
66
"description": "Connect your editor with free chatbots. Parse websites for context.",
7-
"version": "1.59.0",
7+
"version": "1.60.0",
88
"homepage_url": "https://github.com/robertpiosik/CodeWebChat",
99
"icons": {
1010
"16": "icons/icon-16.png",

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,9 @@ export const CHATBOTS = {
310310
supports_reasoning_effort: false,
311311
supports_thinking_budget: false,
312312
default_system_instructions: '',
313-
supported_options: {},
313+
supported_options: {
314+
search: 'Search'
315+
},
314316
default_top_p: 0,
315317
models: {}
316318
},

‎packages/ui/src/components/editor/panel/modals/Modal/Modal.module.scss‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040

4141
.content {
4242
padding: var(--padding-12px);
43+
display: flex;
44+
flex-direction: column;
45+
gap: var(--padding-8px);
4346
}
4447

4548
.footer {

‎packages/ui/src/components/editor/panel/modals/StageFilesModal/StageFilesModal.module.scss‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
overflow: hidden;
1414
white-space: nowrap;
1515
text-overflow: ellipsis;
16+
17+
> strong {
18+
font-weight: 500;
19+
}
1620
}
1721

1822
&__path {

‎packages/vscode/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gemini-coder",
33
"displayName": "Code Web Chat",
44
"description": "Unlimited AI coding in free chatbots (CWC)",
5-
"version": "1.478.0",
5+
"version": "1.479.0",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",
88
"vscode:prepublish": "rimraf out && npm run compile",

‎packages/vscode/src/commands/apply-chat-response-command/utils/clipboard-parser/clipboard-parser.spec.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,21 @@ describe('clipboard-parser', () => {
427427
load_test_case_file(test_case, 'file-1.txt')
428428
)
429429
})
430+
431+
it('parses file path when it is included immediately after the opening code block backticks', () => {
432+
const test_case = 'markdown-backticks-file-path-in-one-line'
433+
const text = load_test_case_file(test_case, `${test_case}.txt`)
434+
const result = parse_multiple_files({
435+
response: text,
436+
is_single_root_folder_workspace: true
437+
})
438+
439+
expect(result).toHaveLength(1)
440+
expect(result[0].file_path).toBe('src/index.js')
441+
expect(result[0].content).toBe(
442+
load_test_case_file(test_case, 'file-1.txt')
443+
)
444+
})
430445
})
431446

432447
describe('parse_file_content_only', () => {

‎packages/vscode/src/commands/apply-chat-response-command/utils/clipboard-parser/clipboard-parser.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,21 @@ export const parse_multiple_files = (params: {
216216
) {
217217
last_seen_file_path_comment = potential_path
218218
}
219+
} else {
220+
let extracted_filename: string | null = null
221+
const lang_and_path = after_backticks.split(/\s+/)
222+
if (lang_and_path.length > 1) {
223+
const potential_path_part = lang_and_path.slice(1).join(' ')
224+
extracted_filename =
225+
extract_path_from_line_of_code(potential_path_part)
226+
}
227+
if (!extracted_filename) {
228+
extracted_filename =
229+
extract_path_from_line_of_code(after_backticks)
230+
}
231+
if (extracted_filename) {
232+
last_seen_file_path_comment = extracted_filename
233+
}
219234
}
220235
}
221236
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const message = "hello world";
2+
console.log(message);

0 commit comments

Comments
 (0)