Static prompt (no tools) keeps rules that use $variables, @Set, Query and @Count

Aperta
#1,503 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, react, typescript

Direzione di ricerca

Start at openuiLibrary.prompt(openuiPromptOptions) and trace how the component-group notes and openuiAdditionalRules are included when tools is absent; the issue does not name source or test files. Compare the generated static prompt with the documented defaults for toolCalls, bindings, and built-in functions. Done when a static prompt no longer includes rules requiring disabled features, with coverage for the reported examples.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

Without tools, openuiLibrary.prompt(openuiPromptOptions) leaves out the Built-in Functions, Query, Mutation and Interactive Filters sections, as the System Prompts docs describe (toolCalls and bindings default to off). But openuiLibrary's component-group notes and openuiAdditionalRules are still added in full. So the static prompt keeps about 20 rules that use the features it no longer explains, for example:

- Shared filter across Tabs: same $days binding in Query args works across all TabItems
- KPI card: Card([TextContent("Label", "small"), TextContent("" + @Count(@Filter(data.rows, "field", "==", "value")), "large-heavy")])
- Use @Reset($var1, $var2) after form submit to restore defaults — not @Set($var, "")
- Multi-query refresh: Action([@Run(mutation), @Run(query1), @Run(query2), @Reset(...)])

The model gets @Count/@Filter/@Each, @Set/@Reset/@Run, Query and data.rows only through these examples, with no definitions, and with no Query whose result data.rows could refer to.

To Reproduce

import { openuiLibrary, openuiPromptOptions } from "@openuidev/react-ui/genui-lib";

const prompt = openuiLibrary.prompt(openuiPromptOptions); // no tools: a static prompt

for (const s of ["## Built-in Functions", "## Query", "## Mutation", "## Interactive Filters"]) {
  console.log(s, prompt.includes(s)); // all false
}
const rules = prompt
  .split("\n")
  .filter((line) => line.startsWith("- ") && /\$[a-z]|@[A-Z][a-z]+\(|Query/.test(line));
console.log(rules.length); // 21

Expected behavior

A static prompt only contains rules for features it enables. For example, notes and rules that need toolCalls, bindings or builtinFunctions could be left out when those flags are off. Otherwise, the docs could say that the default notes assume a prompt with tools and bindings.

Versions

  • @openuidev/react-ui 0.18.1, @openuidev/lang-core 1.0.2
  • Node 24, no browser involved

Additional context

The library rework in #1385 keeps rules of the same kind, e.g. KPI card: Card([Metric("" + @Count(@Filter(data.rows, ... and Success toast: ... use @Set($showSuccess, true).

Lingua principale
TypeScript
Stelle
10k
Fork
698
Merge medio
1g 6h
PR unite (30g)
148

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di thesysdev/openui

Tutte le issue di thesysdev/openui

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.