mini: fix default model (#35515)
This commit is contained in:
parent
147da5d278
commit
fb75ea2cf6
17 changed files with 396 additions and 116 deletions
|
|
@ -7,22 +7,10 @@ import { spawn } from "node:child_process"
|
|||
import type { Stream } from "node:stream"
|
||||
import { resolveZedDbPath, resolveZedSelection } from "./editor-zed"
|
||||
|
||||
export { normalizePromptContent } from "./prompt/content"
|
||||
|
||||
type EditorStdio = "inherit" | "pipe" | "ignore" | number | Stream
|
||||
|
||||
export function normalizePromptContent(content: string) {
|
||||
if (content.endsWith("\r\n")) {
|
||||
const body = content.slice(0, -2)
|
||||
return !body.includes("\n") && !body.includes("\r") ? body : content
|
||||
}
|
||||
|
||||
if (content.endsWith("\n")) {
|
||||
const body = content.slice(0, -1)
|
||||
return !body.includes("\n") && !body.includes("\r") ? body : content
|
||||
}
|
||||
|
||||
return content
|
||||
}
|
||||
|
||||
export async function openEditor(input: { value: string; renderer: CliRenderer; cwd?: string; stdin?: EditorStdio }) {
|
||||
const editor = process.env.VISUAL || process.env.EDITOR
|
||||
if (!editor) return
|
||||
|
|
|
|||
13
packages/tui/src/prompt/content.ts
Normal file
13
packages/tui/src/prompt/content.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
export function normalizePromptContent(content: string) {
|
||||
if (content.endsWith("\r\n")) {
|
||||
const body = content.slice(0, -2)
|
||||
return !body.includes("\n") && !body.includes("\r") ? body : content
|
||||
}
|
||||
|
||||
if (content.endsWith("\n")) {
|
||||
const body = content.slice(0, -1)
|
||||
return !body.includes("\n") && !body.includes("\r") ? body : content
|
||||
}
|
||||
|
||||
return content
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue