Compare commits

...

3 Commits

Author SHA1 Message Date
Dax Raad 250a86ec52 fix reading model from config 2025-07-25 10:53:37 -04:00
Yihui Khuu 0795a577e0 fix: header width to display header in one line when sharing disabled (#1310) 2025-07-25 09:32:06 -05:00
Dax Raad 8e5607f9c0 fix double system prompt 2025-07-25 10:28:42 -04:00
3 changed files with 13 additions and 10 deletions
-1
View File
@@ -626,7 +626,6 @@ export namespace Session {
return SystemPrompt.provider(input.modelID)
})(),
)
system.push(...(mode.prompt ? [mode.prompt] : SystemPrompt.provider(input.modelID)))
system.push(...(await SystemPrompt.environment()))
system.push(...(await SystemPrompt.custom()))
// max 2 system prompt messages for caching purposes
+4 -4
View File
@@ -22,13 +22,16 @@ export namespace Mode {
export type Info = z.infer<typeof Info>
const state = App.state("mode", async () => {
const cfg = await Config.get()
const model = cfg.model ? Provider.parseModel(cfg.model) : undefined
const result: Record<string, Info> = {
build: {
model,
name: "build",
tools: {},
},
plan: {
name: "plan",
model,
tools: {
write: false,
edit: false,
@@ -45,10 +48,7 @@ export namespace Mode {
tools: {},
}
item.name = key
const model = value.model ?? cfg.model
if (model) {
item.model = Provider.parseModel(model)
}
if (value.model) item.model = Provider.parseModel(value.model)
if (value.prompt) item.prompt = value.prompt
if (value.tools)
item.tools = {
@@ -670,15 +670,21 @@ func (m *messagesComponent) renderHeader() string {
isSubscriptionModel := m.app.Model != nil &&
m.app.Model.Cost.Input == 0 && m.app.Model.Cost.Output == 0
sessionInfoText := formatTokensAndCost(tokens, contextWindow, cost, isSubscriptionModel)
sessionInfo = styles.NewStyle().
Foreground(t.TextMuted()).
Background(t.Background()).
Render(formatTokensAndCost(tokens, contextWindow, cost, isSubscriptionModel))
Render(sessionInfoText)
shareEnabled := m.app.Config.Share != opencode.ConfigShareDisabled
headerTextWidth := headerWidth
if !shareEnabled {
// +1 is to ensure there is always at least one space between header and session info
headerTextWidth -= len(sessionInfoText) + 1
}
headerText := util.ToMarkdown(
"# "+m.app.Session.Title,
headerWidth,
headerTextWidth,
t.Background(),
)
@@ -705,11 +711,9 @@ func (m *messagesComponent) renderHeader() string {
items...,
)
var headerLines []string
headerLines := []string{headerRow}
if shareEnabled {
headerLines = []string{headerText, headerRow}
} else {
headerLines = []string{headerRow}
}
header := strings.Join(headerLines, "\n")