mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-13 02:32:09 +10:00
ai notes
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
# AI Select-With Companions
|
||||
|
||||
Declaring on a component which other component types must reach the AI together with it, so that the
|
||||
AI server stops hard-coding component knowledge.
|
||||
|
||||
## 1. Goal
|
||||
|
||||
When the AI's component selector picks a type that is never used alone, the types it needs have to
|
||||
be in the filtered catalog too, or the edit model cannot name them: given an Enclosure and told to
|
||||
drill holes, but without Drill Hole in its catalog, it invented `chassis.DrillHole` instead of
|
||||
`electromechanical.DrillHole`. A `SELECTION` `@AiNote` asks the selector to pick the companions, but
|
||||
a note is advice to a cheap, low-effort call and can be missed. The guarantee has to be
|
||||
deterministic, and it belongs with the component, not in the server.
|
||||
|
||||
## 2. Current state
|
||||
|
||||
- `@AiNote`s on `ChassisPanel` (Enclosure), `BlankBoard` and `DrillHole` tell the selector and the
|
||||
edit model when to use Drill Hole and the cutouts and how to place them (see
|
||||
[ai-component-notes.md](ai-component-notes.md) for notes in general).
|
||||
- The guarantee lives in `diylc-ai-server/v1/ai/classes/CircuitContextBuilder.php` as constants and
|
||||
two `if` blocks after the selection is merged:
|
||||
- `ENCLOSURE_CLASS` (`chassis.ChassisPanel`) adds `ENCLOSURE_HOLE_CLASSES`: `DrillHole`,
|
||||
`RectangularCutout`, `EllipticalCutout`, `PolygonalCutout`;
|
||||
- `BLANK_BOARD_CLASS` (`boards.BlankBoard`) adds `DRILL_HOLE_CLASS`.
|
||||
- `WIRE_CLASSES` sits beside them but is a different kind of rule: wires follow from the
|
||||
construction type, not from a component, so it stays in PHP.
|
||||
- The server reads `catalog_full.json` only after the selection, to filter it.
|
||||
|
||||
## 3. Design decisions
|
||||
|
||||
| # | Decision | Rationale |
|
||||
| --- | --- | --- |
|
||||
| D1 | A new single (not repeatable) annotation in `diylc-core/.../core/annotations`, `@AiSelectWith(Class<? extends IDIYComponent<?>>[] value)`, beside `@AiNote` | Class literals keep a rename or move compile-checked; core already knows components only through `IDIYComponent`, so the boundary holds. |
|
||||
| D2 | Collected from the class and every superclass, merged without duplicates, like `collectNotes` | A base class can declare companions for all its subclasses, the same way it carries notes. |
|
||||
| D3 | Published only in `catalog_full.json`, as `"selectWith": ["electromechanical.DrillHole", ...]` in `catalogClassName` form, and left out when empty | The server expands from the full catalog; the selector does not need it, and the index stays small. |
|
||||
| D4 | One level: the server adds the companions of the selected types, not the companions of those | Nothing needs more today, and a single pass cannot loop. Revisit only if a chain appears. |
|
||||
| D5 | The `@AiNote`s stay | `selectWith` only guarantees a type is present; the notes say why and how to use it. |
|
||||
| D6 | Blank Board lists Drill Hole even though mounting holes are optional | One ~1.1K catalog entry the model may ignore is cheaper than a missing class name. |
|
||||
| D7 | The server skips a companion that is not in its catalog | A catalog and server out of step must not break a request. |
|
||||
|
||||
## 4. Steps
|
||||
|
||||
1. **Annotation.** `AiSelectWith.java` in `org.diylc.core.annotations`, GPL header, `@Retention(RUNTIME)`,
|
||||
`@Target(TYPE)`, Javadoc with `@author` as on `AiNote`.
|
||||
2. **Components** (`diylc-library`):
|
||||
- `ChassisPanel`: `@AiSelectWith({DrillHole.class, RectangularCutout.class, EllipticalCutout.class, PolygonalCutout.class})`;
|
||||
- `BlankBoard`: `@AiSelectWith(DrillHole.class)`.
|
||||
3. **Generator.** In `ComponentCatalogGenerator.buildFullEntry`, after the notes, put `selectWith`
|
||||
from a `collectSelectWith(Class<?>)` that walks the hierarchy like `collectNotes` and maps each
|
||||
class through the same conversion as `catalogClassName`.
|
||||
4. **Tests** in `diylc-library/.../plugins/chatbot/service/ComponentCatalogGeneratorTest`:
|
||||
- the generated Enclosure entry lists the four hole types and Blank Board lists Drill Hole;
|
||||
- every `selectWith` entry of every component is itself a `className` in the catalog;
|
||||
- `collectSelectWith` merges a superclass's companions, as the existing `collectNotes` tests do.
|
||||
5. **Regenerate** `catalog_full.json` / `catalog_index.json` (run `ComponentCatalogGenerator` from
|
||||
`diylc-swing`, `.run/ComponentCatalogGenerator.run.xml`), check `version` matches the latest
|
||||
`update.xml` release, and copy both into `diylc-ai-server/v1/ai/`.
|
||||
6. **Server.** In `CircuitContextBuilder::buildForEditIntent`:
|
||||
- load `catalog_full.json` before the selection is merged instead of after;
|
||||
- after `$selectedComponents` is assembled (selection, existing classes, wires, Blank Board for
|
||||
PCB), add the `selectWith` of every selected type that is in the catalog, then `array_unique`;
|
||||
- delete `ENCLOSURE_CLASS`, `BLANK_BOARD_CLASS`, `DRILL_HOLE_CLASS`, `ENCLOSURE_HOLE_CLASSES` and
|
||||
the two `if` blocks; keep `WIRE_CLASSES`.
|
||||
- Order matters: the Blank Board added for PCB must be in the list before the expansion runs.
|
||||
7. **Docs.** `diylc-ai-server/docs/promptChatbot_flow.md` (filtered catalog paragraph) says the
|
||||
companions come from `selectWith`; [ai-component-notes.md](ai-component-notes.md) §1 mentions
|
||||
`@AiSelectWith` next to `Scope.SELECTION`.
|
||||
|
||||
Do step 6 only after the regenerated catalog is on the server: a catalog without `selectWith` and a
|
||||
server without the constants would lose the guarantee.
|
||||
|
||||
## 5. Verify
|
||||
|
||||
- `mvn -q -pl diylc-library -am test` and `mvn -q -pl diylc-swing -am compile`.
|
||||
- `php -l v1/ai/classes/CircuitContextBuilder.php`.
|
||||
- A request that selects only the Enclosure ("put an LM386 amp in an enclosure") reaches the edit
|
||||
model with Drill Hole and the three cutouts in its catalog; a PCB request carries Drill Hole.
|
||||
|
||||
## 6. Open
|
||||
|
||||
- Whether other types deserve companions. Candidates worth checking against real requests:
|
||||
a board-mounted pot or jack with its hookup wire is already covered by `WIRE_CLASSES`, so look
|
||||
for pairs the selector actually drops before adding any.
|
||||
@@ -0,0 +1,103 @@
|
||||
# DIYLC 6.10 is out: real parts, by part number
|
||||
|
||||
Hi everyone,
|
||||
|
||||
DIYLC 6.10 is ready to download, and it's one of the bigger updates in a while. The big theme this
|
||||
time is **datasheets**: instead of setting up a transistor, an IC or a tube socket by hand, you can
|
||||
now pick the actual part by its number and DIYLC fills in the rest for you. Thank you, as always,
|
||||
for supporting the project. A lot of this release came straight from your requests and bug reports.
|
||||
|
||||
Here's what's new.
|
||||
|
||||
## Pick parts by their number
|
||||
|
||||
Many components now come with a built-in list of real parts. Open the component's submenu, pick a
|
||||
part, and its pinout, pin names, size and other details are set in one go:
|
||||
|
||||
- **Transistors** (TO-92, TO-1, TO-126, TO-220 and TO-3): more than 250 transistors, JFETs, MOSFETs
|
||||
and voltage regulators used in guitar effects, hi-fi, radio and synth projects.
|
||||
- **ICs** ('DIP IC', 'SIP IC' and 'Multiwatt IC'): more than 100 chips, with their pin count,
|
||||
spacing and pin names.
|
||||
- **Tube Socket**: more than 180 preamp, power, rectifier, radio, space-charge and Soviet tubes.
|
||||
There's also a new **UX4 base**, with the 300B, 2A3, 6A3 and 45 triodes and the 5Z3 rectifier.
|
||||
- **Diodes** (plastic and glass): more than 300 rectifiers, Schottky, signal, germanium and zener
|
||||
diodes, drawn at their real package size and colours. The Japanese clippers from those classic
|
||||
overdrive pedals are in there too.
|
||||
- **Sub-Mini Tube**: popular Western and Soviet sub-miniature tubes such as the 6021, 6111, 5840,
|
||||
5672, 6N16B and 6N17B, with their leads, bulb size and lead names.
|
||||
- **Resistor** and **Heat Sink Resistor**: their factory variants are now datasheets as well.
|
||||
|
||||
And the best part: **the AI Assistant knows these parts too**, so you can ask it to place a 2N3904,
|
||||
a TL072 or a 12AX7 by name and it will set them up properly.
|
||||
|
||||
If there's a part you use all the time, you can now **pin it as the default**, just like a saved
|
||||
variant. Pin the 2N3904, and a single click on the transistor places a 2N3904. Each component has
|
||||
one default, so pinning a part replaces a pinned variant and the other way round.
|
||||
|
||||
## Enclosures, the whole box
|
||||
|
||||
'Chassis Panel' has grown up and is now called **Enclosure**. Set its 'Height' and choose which
|
||||
'Sides' to unfold, and it draws an exploded view of the whole box instead of a single panel. It
|
||||
also has its own datasheet, with more than 130 Hammond 1590, 1550, 1441 and 1444 enclosures and the
|
||||
popular 125B size.
|
||||
|
||||
Enclosures, cutouts, 'Drill Hole' and 'Dial Scale' now live together in the new **Hardware**
|
||||
category.
|
||||
|
||||
## Name your pins
|
||||
|
||||
- **'Pin Names'** on 'DIP IC', 'SIP IC' and 'Multiwatt IC' lets you name each pin (1OUT, 1IN-,
|
||||
VCC+ and so on). The names are drawn on the component and show up in node tooltips, netlists and
|
||||
AI analysis.
|
||||
- **'Pin Labels'** on 'SIP IC' and 'Multiwatt IC' shows pin names or pin numbers next to the pins.
|
||||
- 'Sub-Mini Tube' gets 'Pin Names', 'Pin Labels' and a new 'Thickness' property for drawing flat
|
||||
bulbs.
|
||||
- On 'Tube Socket', 'Electrode Labels' is now called 'Pin Names', the same as on ICs, and it also
|
||||
gets the new 'Pin Labels' property.
|
||||
- 'Transistor (TO-3)' now has a 'Pinout' property, plus a terminal in the mounting hole, so you can
|
||||
wire the case (collector) and see it in netlists and AI analysis.
|
||||
|
||||
## Smaller improvements
|
||||
|
||||
- New transistor pinouts B-E-C, C-E-B and S-D-G, and regulator pinouts ADJ-IN-OUT, IN-OUT-GND and
|
||||
IN-OUT-ADJ.
|
||||
- The '+N' variant count in the component tree is now a button: click it to pick a variant or
|
||||
datasheet part straight away, no right-click needed.
|
||||
- 'Transistor (TO-1)' shows the little tab on the rim of the can next to pin 1, just like the real
|
||||
part, so its orientation is easy to tell. The new 'Flange' property turns it off.
|
||||
- Pins of transistors, 'SIP IC', 'DIP Switch' and 'Bridge Rectifier' are drawn on top of the body,
|
||||
so they stay visible whatever the transparency, and pins now have the same colour on every
|
||||
component.
|
||||
- Building blocks placed as a single component now take their stacking order from the components
|
||||
inside them.
|
||||
|
||||
## Bug fixes
|
||||
|
||||
- 'DIP IC' with 'Display Pin #s' set to 'No' numbered its pins in the wrong order in netlists and AI
|
||||
analysis (pin 8 of an 8-pin IC came out as pin 5).
|
||||
- 'Multiwatt IC' numbered its pins row by row instead of alternating between the two rows like the
|
||||
real package.
|
||||
- 'Multiwatt IC' in the Multiwatt 11 package had its leads 1.27mm apart instead of 1.7mm. Heads-up:
|
||||
existing Multiwatt 11 parts will change shape when you open the project.
|
||||
- The 'SIP IC' body was drawn too short when 'Pin Spacing' wasn't a multiple of 0.1 inch.
|
||||
- SPICE netlists listed the pins of E-C-B transistors in the wrong order.
|
||||
- 'Tube Socket' variants with electrode labels joined pins that share a label in netlists and AI
|
||||
analysis, like both anodes of a 12AX7 or both heater ends. These variants are replaced by the new
|
||||
datasheet.
|
||||
- Chassis-mounted 'Tube Socket' with a Noval, 7-pin or Duodecar base didn't rotate its mounting
|
||||
notches with the pins when you changed 'Angle'.
|
||||
- 'Sub-Mini Tube' with circular leads counted the body centre as lead 1 in netlists and AI analysis,
|
||||
so every real lead came out one number too high.
|
||||
|
||||
## Get it
|
||||
|
||||
You can download DIYLC 6.10 from the
|
||||
[releases page](https://github.com/bancika/diy-layout-creator/releases), or just let the app's
|
||||
update check take you there.
|
||||
|
||||
As always, if something doesn't work the way you expect, or there's a part you'd love to see in a
|
||||
datasheet, let me know in the comments. Your feedback shapes every release.
|
||||
|
||||
Happy building!
|
||||
|
||||
Bane
|
||||
Reference in New Issue
Block a user