(blocks []*waveobj.Block, widgetAccess bool)
| 200 | } |
| 201 | |
| 202 | func GenerateCurrentTabStatePrompt(blocks []*waveobj.Block, widgetAccess bool) string { |
| 203 | if !widgetAccess { |
| 204 | return `<current_tab_state>The user has chosen not to share widget context with you</current_tab_state>` |
| 205 | } |
| 206 | var widgetDescriptions []string |
| 207 | for _, block := range blocks { |
| 208 | desc := MakeBlockShortDesc(block) |
| 209 | if desc == "" { |
| 210 | continue |
| 211 | } |
| 212 | blockIdPrefix := block.OID[:8] |
| 213 | fullDesc := fmt.Sprintf("(%s) %s", blockIdPrefix, desc) |
| 214 | widgetDescriptions = append(widgetDescriptions, fullDesc) |
| 215 | } |
| 216 | |
| 217 | var prompt strings.Builder |
| 218 | prompt.WriteString("<current_tab_state>\n") |
| 219 | systemInfo := wavebase.GetSystemSummary() |
| 220 | if currentUser, err := user.Current(); err == nil && currentUser.Username != "" { |
| 221 | prompt.WriteString(fmt.Sprintf("Local Machine: %s, User: %s\n", systemInfo, currentUser.Username)) |
| 222 | } else { |
| 223 | prompt.WriteString(fmt.Sprintf("Local Machine: %s\n", systemInfo)) |
| 224 | } |
| 225 | if len(widgetDescriptions) == 0 { |
| 226 | prompt.WriteString("No widgets open\n") |
| 227 | } else { |
| 228 | prompt.WriteString("Open Widgets:\n") |
| 229 | for _, desc := range widgetDescriptions { |
| 230 | prompt.WriteString("* ") |
| 231 | prompt.WriteString(desc) |
| 232 | prompt.WriteString("\n") |
| 233 | } |
| 234 | } |
| 235 | prompt.WriteString("</current_tab_state>") |
| 236 | rtn := prompt.String() |
| 237 | return rtn |
| 238 | } |
| 239 | |
| 240 | func generateToolsForTsunamiBlock(block *waveobj.Block) []uctypes.ToolDefinition { |
| 241 | var tools []uctypes.ToolDefinition |
no test coverage detected