mirror of
https://github.com/stablyai/orca.git
synced 2026-10-27 16:02:42 +00:00
fix(jcode): stop the OSC color skip from crashing every pane connect
Co-authored-by: czzczz <chanzrz_zbf@foxmail.com>
This commit is contained in:
committed by
Neil
co-authored by
czzczz
parent
33cab243ab
commit
7fb201f60f
@@ -11,13 +11,11 @@ export function cleanGeneratedCommitMessage(raw: string): string {
|
||||
// answer field when the output is such an envelope.
|
||||
if (text.startsWith('{')) {
|
||||
try {
|
||||
const parsed = JSON.parse(text) as unknown
|
||||
if (
|
||||
typeof parsed === 'object' &&
|
||||
parsed !== null &&
|
||||
typeof (parsed as Record<string, unknown>).text === 'string'
|
||||
) {
|
||||
text = (parsed as Record<string, string>).text.trim()
|
||||
const parsed: unknown = JSON.parse(text)
|
||||
const answer: unknown =
|
||||
typeof parsed === 'object' && parsed !== null ? Reflect.get(parsed, 'text') : undefined
|
||||
if (typeof answer === 'string') {
|
||||
text = answer.trim()
|
||||
}
|
||||
} catch {
|
||||
// not a JSON envelope; fall through to the plain-text cleanup
|
||||
|
||||
Reference in New Issue
Block a user