tweaks
parent
3d813f03e5
commit
521fba8ce3
|
|
@ -46,17 +46,19 @@ export namespace LLM {
|
|||
})
|
||||
const [language, cfg] = await Promise.all([Provider.getLanguage(input.model), Config.get()])
|
||||
|
||||
const [first, ...rest] = [
|
||||
// header prompt for providers with auth checks
|
||||
...SystemPrompt.header(input.model.providerID),
|
||||
// use agent prompt otherwise provider prompt
|
||||
...(input.agent.prompt ? [input.agent.prompt] : SystemPrompt.provider(input.model)),
|
||||
// any custom prompt passed into this call
|
||||
...input.system,
|
||||
// any custom prompt from last user message
|
||||
...(input.user.system ? [input.user.system] : []),
|
||||
]
|
||||
const system = [first, rest.join("\n")].filter((x) => x)
|
||||
const system = SystemPrompt.header(input.model.providerID)
|
||||
system.push(
|
||||
[
|
||||
// use agent prompt otherwise provider prompt
|
||||
...(input.agent.prompt ? [input.agent.prompt] : SystemPrompt.provider(input.model)),
|
||||
// any custom prompt passed into this call
|
||||
...input.system,
|
||||
// any custom prompt from last user message
|
||||
...(input.user.system ? [input.user.system] : []),
|
||||
]
|
||||
.filter((x) => x)
|
||||
.join("\n"),
|
||||
)
|
||||
|
||||
const params = await Plugin.trigger(
|
||||
"chat.params",
|
||||
|
|
|
|||
|
|
@ -49,33 +49,6 @@ const parser = lazy(async () => {
|
|||
return p
|
||||
})
|
||||
|
||||
const getShell = lazy(() => {
|
||||
const s = process.env.SHELL
|
||||
if (s) {
|
||||
const basename = path.basename(s)
|
||||
if (!new Set(["fish", "nu"]).has(basename)) {
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === "darwin") {
|
||||
return "/bin/zsh"
|
||||
}
|
||||
|
||||
if (process.platform === "win32") {
|
||||
// Let Bun / Node pick COMSPEC (usually cmd.exe)
|
||||
// or explicitly:
|
||||
return process.env.COMSPEC || true
|
||||
}
|
||||
|
||||
const bash = Bun.which("bash")
|
||||
if (bash) {
|
||||
return bash
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
// TODO: we may wanna rename this tool so it works better on other shells
|
||||
export const BashTool = Tool.define("bash", async () => {
|
||||
const shell = Shell.acceptable()
|
||||
|
|
|
|||
Loading…
Reference in New Issue