mirror of
https://github.com/sst/opencode.git
synced 2025-08-31 10:17:26 +00:00
feat: mode flag in cli run command
This commit is contained in:
parent
d3e5f3f3a8
commit
5dc1920a4c
2 changed files with 10 additions and 1 deletions
|
@ -8,6 +8,7 @@ import { Flag } from "../../flag/flag"
|
|||
import { Config } from "../../config/config"
|
||||
import { bootstrap } from "../bootstrap"
|
||||
import { MessageV2 } from "../../session/message-v2"
|
||||
import { Mode } from "../../session/mode"
|
||||
|
||||
const TOOL: Record<string, [string, string]> = {
|
||||
todowrite: ["Todo", UI.Style.TEXT_WARNING_BOLD],
|
||||
|
@ -52,6 +53,10 @@ export const RunCommand = cmd({
|
|||
alias: ["m"],
|
||||
describe: "model to use in the format of provider/model",
|
||||
})
|
||||
.option("mode", {
|
||||
type: "string",
|
||||
describe: "mode to use",
|
||||
})
|
||||
},
|
||||
handler: async (args) => {
|
||||
let message = args.message.join(" ")
|
||||
|
@ -139,10 +144,14 @@ export const RunCommand = cmd({
|
|||
UI.error(err)
|
||||
})
|
||||
|
||||
// TODO: dax, should this impact model selection as well?
|
||||
const mode = args.mode ? await Mode.get(args.mode) : await Mode.list().then((x) => x[0])
|
||||
|
||||
const result = await Session.chat({
|
||||
sessionID: session.id,
|
||||
providerID,
|
||||
modelID,
|
||||
mode: mode.name,
|
||||
parts: [
|
||||
{
|
||||
type: "text",
|
||||
|
|
|
@ -284,7 +284,7 @@ export namespace Session {
|
|||
sessionID: string
|
||||
providerID: string
|
||||
modelID: string
|
||||
mode: string
|
||||
mode?: string
|
||||
parts: MessageV2.UserPart[]
|
||||
}) {
|
||||
const l = log.clone().tag("session", input.sessionID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue