init
commit
f87bf4c489
@ -0,0 +1,96 @@
|
||||
# Fastlane Gitea
|
||||
|
||||
Prompt- und Schema-Definitionen fuer **Fastlane** — die KI-Schnittstelle zwischen Fachanwendern und einem externen System. Claude analysiert natuerlichsprachliche Anfragen und liefert strukturierte JSON-Antworten, die vom Flutter-Frontend gerendert werden.
|
||||
|
||||
## Verzeichnisstruktur
|
||||
|
||||
```
|
||||
prompts/ # System-Prompts (steuern Claudes Verhalten)
|
||||
schemas/ # JSON-Schemas (definieren die Antwortstruktur)
|
||||
```
|
||||
|
||||
## Prompts (`prompts/`)
|
||||
|
||||
Jeder Prompt ist eine JSON-Datei mit folgendem Aufbau:
|
||||
|
||||
```json
|
||||
{
|
||||
"key": "unique_identifier",
|
||||
"description": "Kurzbeschreibung des Prompts",
|
||||
"response_schema_ref": "fastlane_response.schema.json",
|
||||
"tags": ["tag1", "tag2"],
|
||||
"system_prompt": "Der vollstaendige System-Prompt als String"
|
||||
}
|
||||
```
|
||||
|
||||
| Feld | Beschreibung |
|
||||
|-----------------------|-------------------------------------------------------|
|
||||
| `key` | Eindeutiger Bezeichner |
|
||||
| `description` | Was der Prompt tut |
|
||||
| `response_schema_ref` | Verweis auf das JSON-Schema fuer die Antwort |
|
||||
| `tags` | Kategorisierung (z.B. `general`, `fleet`, `energy`) |
|
||||
| `system_prompt` | Instruktionen an Claude |
|
||||
|
||||
## Schemas (`schemas/`)
|
||||
|
||||
JSON-Schema-Dateien (Draft-07), die die Antwortstruktur validieren.
|
||||
|
||||
### Antwort-Modi
|
||||
|
||||
Claude antwortet immer mit **einem** von zwei Modi:
|
||||
|
||||
#### `response_type: "form"`
|
||||
Wird verwendet, wenn Claude **zusaetzliche Informationen** braucht. Generiert ein Formular, das im Flutter-Frontend via `flutter_form_builder` gerendert wird.
|
||||
|
||||
```json
|
||||
{
|
||||
"response_type": "form",
|
||||
"message": "Bitte waehle den Zeitraum aus.",
|
||||
"form": {
|
||||
"title": "Zeitraum waehlen",
|
||||
"fields": [
|
||||
{
|
||||
"name": "zeitraum",
|
||||
"widget": "date_range_picker",
|
||||
"label": "Zeitraum",
|
||||
"validators": [{ "type": "required" }]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### `response_type: "result"`
|
||||
Wird verwendet, wenn Claude **alle Informationen** hat. Kann HTML, Intents und Code-Bloecke enthalten.
|
||||
|
||||
```json
|
||||
{
|
||||
"response_type": "result",
|
||||
"message": "Hier ist die Uebersicht.",
|
||||
"html_content": "<table>...</table>",
|
||||
"intents": [{ "action": "notify", "params": { "message": "Fertig" } }],
|
||||
"code_blocks": [{ "execution_type": "graphql", "code": "{ vehicles { id } }" }]
|
||||
}
|
||||
```
|
||||
|
||||
### Verfuegbare Form-Widgets
|
||||
|
||||
`text_field` | `dropdown` | `date_time_picker` | `date_range_picker` | `checkbox` | `checkbox_group` | `radio_group` | `switch_field` | `slider` | `range_slider` | `choice_chip` | `filter_chip` | `segmented_control` | `typeahead`
|
||||
|
||||
### Verfuegbare Intent-Actions
|
||||
|
||||
| Action | Zweck |
|
||||
|------------|---------------------------------------|
|
||||
| `navigate` | Zu einer Route navigieren |
|
||||
| `display` | Daten in einer Komponente anzeigen |
|
||||
| `confirm` | Bestaetigung vor destruktiver Aktion |
|
||||
| `refresh` | Aktuelle Ansicht aktualisieren |
|
||||
| `notify` | Toast-Benachrichtigung |
|
||||
|
||||
### Code-Block-Typen
|
||||
|
||||
| Typ | Verwendung |
|
||||
|-----------|---------------------------------------------------|
|
||||
| `python` | `httpx` + `AUTH_HEADERS`, Ergebnis in `result` |
|
||||
| `graphql` | Query/Mutation mit `variables` |
|
||||
| `odata` | `path`, `method`, `params`, `body` |
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,285 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "fastlane_response.schema.json",
|
||||
"title": "Fastlane Claude Response",
|
||||
"description": "Zwei Modi: 'form' = Claude braucht Eingaben (flutter_form_builder Formular). 'result' = Claude liefert Ergebnis (HTML + Intents + Code).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
"response_type": {
|
||||
"type": "string",
|
||||
"enum": ["form", "result"]
|
||||
},
|
||||
|
||||
"message": {
|
||||
"type": "string",
|
||||
"description": "Bei 'form': warum Eingaben noetig. Bei 'result': Zusammenfassung."
|
||||
},
|
||||
|
||||
"form": {
|
||||
"$ref": "#/$defs/FormDefinition"
|
||||
},
|
||||
|
||||
"intents": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/$defs/Intent" }
|
||||
},
|
||||
|
||||
"html_content": {
|
||||
"type": ["string", "null"],
|
||||
"maxLength": 100000
|
||||
},
|
||||
|
||||
"code_blocks": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/$defs/CodeBlock" }
|
||||
},
|
||||
|
||||
"metadata": {
|
||||
"$ref": "#/$defs/ResponseMetadata"
|
||||
}
|
||||
},
|
||||
|
||||
"required": ["response_type", "message"],
|
||||
"if": { "properties": { "response_type": { "const": "form" } } },
|
||||
"then": { "required": ["response_type", "message", "form"] },
|
||||
"additionalProperties": false,
|
||||
|
||||
"$defs": {
|
||||
|
||||
"FormDefinition": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": { "type": "string" },
|
||||
"description": { "type": ["string", "null"] },
|
||||
"fields": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": { "$ref": "#/$defs/FormField" }
|
||||
},
|
||||
"submit_label": { "type": "string", "default": "Absenden" },
|
||||
"cancel_label": { "type": ["string", "null"] },
|
||||
"autovalidate_mode": {
|
||||
"type": "string",
|
||||
"enum": ["disabled", "always", "on_user_interaction"],
|
||||
"default": "on_user_interaction"
|
||||
},
|
||||
"layout": {
|
||||
"type": "string",
|
||||
"enum": ["vertical", "stepper", "sections"],
|
||||
"default": "vertical"
|
||||
},
|
||||
"sections": {
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": { "type": "string" },
|
||||
"description": { "type": ["string", "null"] },
|
||||
"icon": { "type": ["string", "null"] },
|
||||
"field_names": { "type": "array", "items": { "type": "string" } }
|
||||
},
|
||||
"required": ["title", "field_names"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["title", "fields"]
|
||||
},
|
||||
|
||||
"FormField": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z][a-z0-9_]*$"
|
||||
},
|
||||
"widget": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"text_field",
|
||||
"dropdown",
|
||||
"date_time_picker",
|
||||
"date_range_picker",
|
||||
"checkbox",
|
||||
"checkbox_group",
|
||||
"radio_group",
|
||||
"switch_field",
|
||||
"slider",
|
||||
"range_slider",
|
||||
"choice_chip",
|
||||
"filter_chip",
|
||||
"segmented_control",
|
||||
"typeahead"
|
||||
]
|
||||
},
|
||||
"label": { "type": "string" },
|
||||
"hint_text": { "type": ["string", "null"] },
|
||||
"helper_text": { "type": ["string", "null"] },
|
||||
"prefix_icon": { "type": ["string", "null"] },
|
||||
"initial_value": {},
|
||||
"enabled": { "type": "boolean", "default": true },
|
||||
"read_only": { "type": "boolean", "default": false },
|
||||
"validators": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/$defs/Validator" }
|
||||
},
|
||||
"options": {
|
||||
"type": ["array", "null"],
|
||||
"items": { "$ref": "#/$defs/FieldOption" }
|
||||
},
|
||||
"text_field_config": { "$ref": "#/$defs/TextFieldConfig" },
|
||||
"date_config": { "$ref": "#/$defs/DateConfig" },
|
||||
"slider_config": { "$ref": "#/$defs/SliderConfig" },
|
||||
"conditional": { "$ref": "#/$defs/ConditionalRule" }
|
||||
},
|
||||
"required": ["name", "widget", "label"]
|
||||
},
|
||||
|
||||
"Validator": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"required",
|
||||
"min", "max",
|
||||
"min_length", "max_length",
|
||||
"min_words_count", "max_words_count",
|
||||
"email", "url", "ip",
|
||||
"match",
|
||||
"numeric", "integer",
|
||||
"credit_card",
|
||||
"date_string",
|
||||
"equal", "not_equal",
|
||||
"between",
|
||||
"contains", "not_contains",
|
||||
"ends_with", "starts_with",
|
||||
"has_uppercase_chars", "has_lowercase_chars",
|
||||
"has_numeric_chars", "has_special_chars",
|
||||
"file_extension", "file_size",
|
||||
"conditional"
|
||||
]
|
||||
},
|
||||
"value": { "description": "Parameter (z.B. 70 fuer max, 3 fuer min_length, Regex fuer match)." },
|
||||
"value2": { "description": "Zweiter Parameter (z.B. Obergrenze fuer between)." },
|
||||
"error_text": { "type": ["string", "null"] }
|
||||
},
|
||||
"required": ["type"]
|
||||
},
|
||||
|
||||
"FieldOption": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"value": { "type": "string" },
|
||||
"label": { "type": "string" },
|
||||
"icon": { "type": ["string", "null"] },
|
||||
"enabled": { "type": "boolean", "default": true },
|
||||
"group": { "type": ["string", "null"] }
|
||||
},
|
||||
"required": ["value", "label"]
|
||||
},
|
||||
|
||||
"TextFieldConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"keyboard_type": {
|
||||
"type": "string",
|
||||
"enum": ["text", "multiline", "number", "phone", "email_address", "url", "datetime", "visible_password"],
|
||||
"default": "text"
|
||||
},
|
||||
"max_lines": { "type": "integer", "minimum": 1, "default": 1 },
|
||||
"min_lines": { "type": ["integer", "null"], "minimum": 1 },
|
||||
"obscure_text": { "type": "boolean", "default": false },
|
||||
"autocorrect": { "type": "boolean", "default": true },
|
||||
"text_capitalization": {
|
||||
"type": "string",
|
||||
"enum": ["none", "words", "sentences", "characters"],
|
||||
"default": "none"
|
||||
},
|
||||
"input_formatters": {
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": { "type": "string", "enum": ["digits_only", "allow", "deny", "mask"] },
|
||||
"pattern": { "type": ["string", "null"] }
|
||||
},
|
||||
"required": ["type"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"DateConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"input_type": { "type": "string", "enum": ["date", "time", "both"], "default": "date" },
|
||||
"first_date": { "type": ["string", "null"], "format": "date" },
|
||||
"last_date": { "type": ["string", "null"], "format": "date" },
|
||||
"format": { "type": ["string", "null"], "default": "dd.MM.yyyy" },
|
||||
"locale": { "type": ["string", "null"] }
|
||||
}
|
||||
},
|
||||
|
||||
"SliderConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"min": { "type": "number" },
|
||||
"max": { "type": "number" },
|
||||
"divisions": { "type": ["integer", "null"] },
|
||||
"display_values": { "type": "string", "enum": ["current", "min_max", "all", "none"], "default": "current" },
|
||||
"number_format": { "type": ["string", "null"] }
|
||||
},
|
||||
"required": ["min", "max"]
|
||||
},
|
||||
|
||||
"ConditionalRule": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"field_name": { "type": "string" },
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"enum": ["equals", "not_equals", "contains", "not_contains", "greater_than", "less_than", "is_empty", "is_not_empty", "in_list"]
|
||||
},
|
||||
"value": {},
|
||||
"action": { "type": "string", "enum": ["show", "hide", "enable", "disable"], "default": "show" }
|
||||
},
|
||||
"required": ["field_name", "operator"]
|
||||
},
|
||||
|
||||
"Intent": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": { "type": "string", "enum": ["navigate", "display", "confirm", "refresh", "notify"] },
|
||||
"target": { "type": ["string", "null"] },
|
||||
"params": { "type": "object", "additionalProperties": true },
|
||||
"label": { "type": ["string", "null"] }
|
||||
},
|
||||
"required": ["action"]
|
||||
},
|
||||
|
||||
"CodeBlock": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"execution_type": { "type": "string", "enum": ["python", "graphql", "odata"] },
|
||||
"code": { "type": "string", "minLength": 1, "maxLength": 50000 },
|
||||
"description": { "type": ["string", "null"] },
|
||||
"variables": { "type": ["object", "null"], "additionalProperties": true },
|
||||
"idempotent": { "type": "boolean", "default": true }
|
||||
},
|
||||
"required": ["execution_type", "code"]
|
||||
},
|
||||
|
||||
"ResponseMetadata": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"domain": { "type": "string", "enum": ["fleet", "energy", "logistics", "hr", "finance", "general"] },
|
||||
"confidence": { "type": "number", "minimum": 0.0, "maximum": 1.0 },
|
||||
"requires_confirmation": { "type": "boolean", "default": false },
|
||||
"estimated_records": { "type": "integer", "minimum": 0 },
|
||||
"tags": { "type": "array", "items": { "type": "string" } }
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue