Remove AI lookup, replace with a large built-in car database

Dropped the Claude/OpenAI backend (api/) and the "Mit KI suchen" button -
no server dependency, no API keys, no cost per search. Instead, data/cars.json
grew from 27 to 173 vehicles covering the world's most common models across
Europe, North America, Japan/Korea, China, and India (VW, Toyota, Honda,
Ford, Hyundai/Kia, BYD, Wuling, Tata, etc.), so the free-text search finds
a real entry for the vast majority of realistic queries. The category-based
estimate picker remains as a fallback for anything still not covered.

Also fixed accent-insensitive search (e.g. "Citroen" now matches "Citroën").
This commit is contained in:
Maaxxs 2026-08-31 10:56:15 +02:00
parent 14b890c920
commit 20f61a48ed
9 changed files with 2047 additions and 1267 deletions

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
api/config.php
api/vendor/

View file

@ -1,12 +0,0 @@
{
"require": {
"anthropic-ai/sdk": "^0.44.0",
"symfony/http-client": "^7.4",
"nyholm/psr7": "^1.8"
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
}

968
api/composer.lock generated
View file

@ -1,968 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "65317a26fbcfb6d557de08fb8b473982",
"packages": [
{
"name": "anthropic-ai/sdk",
"version": "v0.44.0",
"source": {
"type": "git",
"url": "https://github.com/anthropics/anthropic-sdk-php.git",
"reference": "f63c00d80f180e1c3acd6cf8835df5b1baa625a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/anthropics/anthropic-sdk-php/zipball/f63c00d80f180e1c3acd6cf8835df5b1baa625a1",
"reference": "f63c00d80f180e1c3acd6cf8835df5b1baa625a1",
"shasum": ""
},
"require": {
"php": "^8.1",
"php-http/discovery": "^1",
"psr/http-client": "^1",
"psr/http-client-implementation": "^1",
"psr/http-factory-implementation": "^1",
"psr/http-message": "^1|^2",
"standard-webhooks/standard-webhooks": "^1"
},
"require-dev": {
"aws/aws-sdk-php": "^3.368",
"friendsofphp/php-cs-fixer": "^3",
"google/auth": "^1.49",
"guzzlehttp/guzzle": "^7",
"mcp/sdk": "^0.7.1",
"nyholm/psr7": "^1",
"pestphp/pest": "^3",
"php-http/mock-client": "^1",
"phpstan/extension-installer": "^1",
"phpstan/phpstan": "2.2.1",
"phpstan/phpstan-phpunit": "^2",
"phpunit/phpunit": "^11",
"symfony/http-client": "^7"
},
"suggest": {
"aws/aws-sdk-php": "Allows using the AWS Bedrock, AWS gateway, and Bedrock Mantle SDKs",
"google/auth": "Allows using the Google Vertex and Google Cloud gateway SDKs",
"mcp/sdk": "Required to use the BetaMcp helpers for integrating MCP servers with the Anthropic SDK"
},
"type": "library",
"autoload": {
"files": [
"src/Version.php"
],
"psr-4": {
"Anthropic\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Anthropic PHP SDK",
"support": {
"issues": "https://github.com/anthropics/anthropic-sdk-php/issues",
"source": "https://github.com/anthropics/anthropic-sdk-php/tree/v0.44.0"
},
"time": "2026-08-26T17:59:57+00:00"
},
{
"name": "nyholm/psr7",
"version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/Nyholm/psr7.git",
"reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Nyholm/psr7/zipball/a71f2b11690f4b24d099d6b16690a90ae14fc6f3",
"reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3",
"shasum": ""
},
"require": {
"php": ">=7.2",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.1 || ^2.0"
},
"provide": {
"php-http/message-factory-implementation": "1.0",
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"http-interop/http-factory-tests": "^0.9",
"php-http/message-factory": "^1.0",
"php-http/psr7-integration-tests": "^1.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
"symfony/error-handler": "^4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"autoload": {
"psr-4": {
"Nyholm\\Psr7\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
},
{
"name": "Martijn van der Ven",
"email": "martijn@vanderven.se"
}
],
"description": "A fast PHP7 implementation of PSR-7",
"homepage": "https://tnyholm.se",
"keywords": [
"psr-17",
"psr-7"
],
"support": {
"issues": "https://github.com/Nyholm/psr7/issues",
"source": "https://github.com/Nyholm/psr7/tree/1.8.2"
},
"funding": [
{
"url": "https://github.com/Zegnat",
"type": "github"
},
{
"url": "https://github.com/nyholm",
"type": "github"
}
],
"time": "2024-09-09T07:06:30+00:00"
},
{
"name": "php-http/discovery",
"version": "1.20.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/discovery.git",
"reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d",
"reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0|^2.0",
"php": "^7.1 || ^8.0"
},
"conflict": {
"nyholm/psr7": "<1.0",
"zendframework/zend-diactoros": "*"
},
"provide": {
"php-http/async-client-implementation": "*",
"php-http/client-implementation": "*",
"psr/http-client-implementation": "*",
"psr/http-factory-implementation": "*",
"psr/http-message-implementation": "*"
},
"require-dev": {
"composer/composer": "^1.0.2|^2.0",
"graham-campbell/phpspec-skip-example-extension": "^5.0",
"php-http/httplug": "^1.0 || ^2.0",
"php-http/message-factory": "^1.0",
"phpspec/phpspec": "^5.1 || ^6.1 || ^7.3",
"sebastian/comparator": "^3.0.5 || ^4.0.8",
"symfony/phpunit-bridge": "^6.4.4 || ^7.0.1"
},
"type": "composer-plugin",
"extra": {
"class": "Http\\Discovery\\Composer\\Plugin",
"plugin-optional": true
},
"autoload": {
"psr-4": {
"Http\\Discovery\\": "src/"
},
"exclude-from-classmap": [
"src/Composer/Plugin.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations",
"homepage": "http://php-http.org",
"keywords": [
"adapter",
"client",
"discovery",
"factory",
"http",
"message",
"psr17",
"psr7"
],
"support": {
"issues": "https://github.com/php-http/discovery/issues",
"source": "https://github.com/php-http/discovery/tree/1.20.0"
},
"time": "2024-10-02T11:20:13+00:00"
},
{
"name": "psr/container",
"version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
"shasum": ""
},
"require": {
"php": ">=7.4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common Container Interface (PHP FIG PSR-11)",
"homepage": "https://github.com/php-fig/container",
"keywords": [
"PSR-11",
"container",
"container-interface",
"container-interop",
"psr"
],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/2.0.2"
},
"time": "2021-11-05T16:47:00+00:00"
},
{
"name": "psr/http-client",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client"
},
"time": "2023-09-23T14:17:50+00:00"
},
{
"name": "psr/http-factory",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": ""
},
"require": {
"php": ">=7.1",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory"
},
"time": "2024-04-15T12:06:14+00:00"
},
{
"name": "psr/http-message",
"version": "2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/2.0"
},
"time": "2023-04-04T09:54:51+00:00"
},
{
"name": "psr/log",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/3.0.2"
},
"time": "2024-09-11T13:17:53+00:00"
},
{
"name": "standard-webhooks/standard-webhooks",
"version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/standard-webhooks/standard-webhooks.git",
"reference": "a1773d7ffc577d730e2bf4d4bd740a82a42aa904"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/standard-webhooks/standard-webhooks/zipball/a1773d7ffc577d730e2bf4d4bd740a82a42aa904",
"reference": "a1773d7ffc577d730e2bf4d4bd740a82a42aa904",
"shasum": ""
},
"require": {
"php": "^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0 || ^10.0"
},
"type": "library",
"autoload": {
"psr-4": {
"StandardWebhooks\\": "libraries/php/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Standard Webhooks - Open source tools and guidelines for sending webhooks easily, securely, and reliably",
"homepage": "https://www.standardwebhooks.com",
"keywords": [
"hmac",
"signature",
"standard-webhooks",
"verification",
"webhooks"
],
"support": {
"issues": "https://github.com/standard-webhooks/standard-webhooks/issues",
"source": "https://github.com/standard-webhooks/standard-webhooks/tree/v1.0.2"
},
"time": "2026-02-18T19:02:27+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/f3202fa1b5097b0af062dc978b32ecf63404e31d",
"reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.7-dev"
}
},
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-06-05T06:23:12+00:00"
},
{
"name": "symfony/http-client",
"version": "v7.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
"reference": "68d81f78d127984ff2e741f0e0d9cb1078f8f3ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/68d81f78d127984ff2e741f0e0d9cb1078f8f3ea",
"reference": "68d81f78d127984ff2e741f0e0d9cb1078f8f3ea",
"shasum": ""
},
"require": {
"php": ">=8.2",
"psr/log": "^1|^2|^3",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/http-client-contracts": "~3.4.4|^3.5.2",
"symfony/polyfill-php83": "^1.29",
"symfony/service-contracts": "^2.5|^3"
},
"conflict": {
"amphp/amp": "<2.5",
"amphp/socket": "<1.1",
"php-http/discovery": "<1.15",
"symfony/http-foundation": "<6.4"
},
"provide": {
"php-http/async-client-implementation": "*",
"php-http/client-implementation": "*",
"psr/http-client-implementation": "1.0",
"symfony/http-client-implementation": "3.0"
},
"require-dev": {
"amphp/http-client": "^4.2.1|^5.0",
"amphp/http-tunnel": "^1.0|^2.0",
"guzzlehttp/promises": "^1.4|^2.0",
"nyholm/psr7": "^1.0",
"php-http/httplug": "^1.0|^2.0",
"psr/http-client": "^1.0",
"symfony/amphp-http-client-meta": "^1.0|^2.0",
"symfony/cache": "^6.4|^7.0|^8.0",
"symfony/dependency-injection": "^6.4|^7.0|^8.0",
"symfony/http-kernel": "^6.4|^7.0|^8.0",
"symfony/messenger": "^6.4|^7.0|^8.0",
"symfony/process": "^6.4|^7.0|^8.0",
"symfony/rate-limiter": "^6.4|^7.0|^8.0",
"symfony/stopwatch": "^6.4|^7.0|^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\HttpClient\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously",
"homepage": "https://symfony.com",
"keywords": [
"http"
],
"support": {
"source": "https://github.com/symfony/http-client/tree/v7.4.18"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-08-30T13:49:59+00:00"
},
{
"name": "symfony/http-client-contracts",
"version": "v3.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client-contracts.git",
"reference": "35be0019e2c2c9fba80f9dc033290a5240f7b44f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/35be0019e2c2c9fba80f9dc033290a5240f7b44f",
"reference": "35be0019e2c2c9fba80f9dc033290a5240f7b44f",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.7-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\HttpClient\\": ""
},
"exclude-from-classmap": [
"/Test/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to HTTP clients",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/http-client-contracts/tree/v3.7.3"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-08-04T08:41:16+00:00"
},
{
"name": "symfony/polyfill-php83",
"version": "v1.41.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php83.git",
"reference": "5ea99087fb99c273a9b9236ed4c31e78b16103c6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/5ea99087fb99c273a9b9236ed4c31e78b16103c6",
"reference": "5ea99087fb99c273a9b9236ed4c31e78b16103c6",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php83\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php83/tree/v1.41.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-07-01T12:47:55+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v3.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/15e6a07ec2a2c75ceb1b21dd98105ee8456d2257",
"reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257",
"shasum": ""
},
"require": {
"php": ">=8.1",
"psr/container": "^1.1|^2.0",
"symfony/deprecation-contracts": "^2.5|^3"
},
"conflict": {
"ext-psr": "<1.1|>=2"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.7-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\Service\\": ""
},
"exclude-from-classmap": [
"/Test/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to writing services",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v3.7.3"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-07-27T15:39:01+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {},
"platform-dev": {},
"plugin-api-version": "2.6.0"
}

View file

@ -1,12 +0,0 @@
<?php
// Diese Datei zu config.php kopieren und die echten API-Keys eintragen.
// config.php ist per .gitignore ausgeschlossen und wird nie ins Repo übernommen.
// Welcher Anbieter für die KI-Fahrzeugschätzung genutzt wird: 'anthropic' oder 'openai'.
// Nur der Key des gewählten Anbieters muss ausgefüllt sein.
$AI_PROVIDER = 'anthropic';
$ANTHROPIC_API_KEY = 'sk-ant-...';
$OPENAI_API_KEY = 'sk-...';
$OPENAI_MODEL = 'gpt-4o-mini'; // optional, Standard falls leer

View file

@ -1,162 +0,0 @@
<?php
// Serverseitiger Endpunkt: nimmt eine frei getippte Automarke/Modell entgegen und lässt eine
// KI plausible Kofferraum-Kenndaten dafür schätzen. Welcher Anbieter genutzt wird (Claude oder
// OpenAI), legt config.php fest — der jeweilige API-Key bleibt ausschließlich auf dem Server
// und wird nie an den Browser ausgeliefert.
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store');
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
echo json_encode(['error' => 'Nur POST erlaubt.']);
exit;
}
$provider = getenv('AI_PROVIDER') ?: null;
$anthropicKey = getenv('ANTHROPIC_API_KEY') ?: null;
$openaiKey = getenv('OPENAI_API_KEY') ?: null;
$openaiModel = null;
$configFile = __DIR__ . '/config.php';
if (file_exists($configFile)) {
require $configFile;
$provider = $provider ?: ($AI_PROVIDER ?? null);
$anthropicKey = $anthropicKey ?: ($ANTHROPIC_API_KEY ?? null);
$openaiKey = $openaiKey ?: ($OPENAI_API_KEY ?? null);
$openaiModel = $OPENAI_MODEL ?? null;
}
$provider = $provider ?: 'anthropic';
$openaiModel = $openaiModel ?: 'gpt-4o-mini';
$body = json_decode(file_get_contents('php://input'), true);
$query = trim((string)($body['query'] ?? ''));
if ($query === '' || mb_strlen($query) > 80) {
http_response_code(400);
echo json_encode(['error' => 'Ungültige Anfrage.']);
exit;
}
$systemPrompt = <<<SYS
Du lieferst Kenndaten für ein 3D-Vorschau-Tool eines Auto-HiFi-Shops, das aus Marke/Modell
eine stark vereinfachte, parametrische Kofferraum-Näherung generiert.
Antworte AUSSCHLIESSLICH mit einem einzelnen JSON-Objekt, keine Erklärung, kein Markdown, keine Code-Fences.
Wenn du das Fahrzeug erkennst, exakt dieses Format:
{"found":true,"brand":"...","model":"...","bodyType":"Kombi|Kompaktklasse|Limousine|Kompakt-SUV|Mittelklasse-SUV|Van|Kleinwagen|Sportwagen|...","cargoLiters":000,"cargoLitersMax":000,"length_mm":000,"widthFloor_mm":000,"widthShoulder_mm":000,"height_mm":000,"sillHeight_mm":000,"underFloorDepth_mm":000}
Wenn du das Fahrzeug nicht plausibel zuordnen kannst:
{"found":false}
Regeln:
- length_mm/widthFloor_mm/widthShoulder_mm/height_mm sind die INNENMASSE des Laderaums (nicht die Außenmaße des Autos), realistisch in der Größenordnung 400-1300mm.
- widthShoulder_mm ist die Breite oben (Schulterhöhe) und immer >= widthFloor_mm (Breite unten zwischen den Radkästen).
- cargoLitersMax ist das Volumen bei umgeklappten Rücksitzen; falls nicht sinnvoll (z. B. 2-Sitzer), null.
- underFloorDepth_mm ist die Tiefe der Reserverad-/Staumulde unter dem Ladeboden; falls es die nicht gibt, null.
- Werte sind grobe, plausible Schätzungen basierend auf deinem Wissen über das Fahrzeug, keine exakten Herstellerangaben.
- Wenn die Anfrage kein erkennbares Auto ist (z. B. Unsinn oder ein anderes Objekt), antworte {"found":false}.
SYS;
try {
if ($provider === 'openai') {
if (!$openaiKey) {
throw new RuntimeException('Kein OpenAI API-Key konfiguriert. api/config.example.php nach api/config.php kopieren, AI_PROVIDER auf "openai" setzen und OPENAI_API_KEY eintragen.');
}
$text = lookupViaOpenAI($query, $systemPrompt, $openaiKey, $openaiModel);
} else {
if (!$anthropicKey) {
throw new RuntimeException('Kein Anthropic API-Key konfiguriert. api/config.example.php nach api/config.php kopieren und ANTHROPIC_API_KEY eintragen.');
}
$text = lookupViaClaude($query, $systemPrompt, $anthropicKey);
}
} catch (\Throwable $e) {
http_response_code(502);
echo json_encode(['error' => 'KI-Anfrage fehlgeschlagen: ' . $e->getMessage()]);
exit;
}
if (!preg_match('/\{.*\}/s', $text, $m)) {
http_response_code(502);
echo json_encode(['error' => 'Antwort konnte nicht gelesen werden.']);
exit;
}
$data = json_decode($m[0], true);
if (!is_array($data)) {
http_response_code(502);
echo json_encode(['error' => 'Antwort konnte nicht gelesen werden.']);
exit;
}
echo json_encode($data);
// ---------- Anbieter ----------
function lookupViaClaude(string $query, string $systemPrompt, string $apiKey): string
{
require __DIR__ . '/vendor/autoload.php';
$client = new \Anthropic\Client(apiKey: $apiKey);
$message = $client->messages->create(
model: 'claude-opus-5',
maxTokens: 1024,
outputConfig: ['effort' => 'low'],
system: $systemPrompt,
messages: [
['role' => 'user', 'content' => $query],
],
);
$text = '';
foreach ($message->content as $block) {
if ($block->type === 'text') {
$text .= $block->text;
}
}
return $text;
}
function lookupViaOpenAI(string $query, string $systemPrompt, string $apiKey, string $model): string
{
$payload = [
'model' => $model,
'response_format' => ['type' => 'json_object'],
'max_tokens' => 1024,
'messages' => [
['role' => 'system', 'content' => $systemPrompt],
['role' => 'user', 'content' => $query],
],
];
$ch = curl_init('https://api.openai.com/v1/chat/completions');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_TIMEOUT => 30,
]);
$raw = curl_exec($ch);
$curlError = curl_error($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($raw === false) {
throw new RuntimeException('OpenAI-Verbindung fehlgeschlagen: ' . $curlError);
}
$decoded = json_decode($raw, true);
if ($httpCode >= 400) {
$msg = $decoded['error']['message'] ?? ('HTTP ' . $httpCode);
throw new RuntimeException('OpenAI-Fehler: ' . $msg);
}
return $decoded['choices'][0]['message']['content'] ?? '';
}

71
app.js
View file

@ -24,8 +24,6 @@ const floorStateLabel = document.getElementById("floorStateLabel");
const floorToggleRow = document.getElementById("floorToggleRow"); const floorToggleRow = document.getElementById("floorToggleRow");
const estimateBox = document.getElementById("estimateBox"); const estimateBox = document.getElementById("estimateBox");
const estimateChips = document.getElementById("estimateChips"); const estimateChips = document.getElementById("estimateChips");
const estimateAIBtn = document.getElementById("estimateAIBtn");
const estimateAIStatus = document.getElementById("estimateAIStatus");
const subPresetsBox = document.getElementById("subPresets"); const subPresetsBox = document.getElementById("subPresets");
const subW = document.getElementById("subW"); const subW = document.getElementById("subW");
@ -265,11 +263,6 @@ function renderEstimateOption(query) {
estimateChips.appendChild(chip); estimateChips.appendChild(chip);
}); });
estimateAIBtn.disabled = false;
estimateAIBtn.textContent = `Mit KI nach „${query}“ suchen`;
estimateAIStatus.hidden = true;
estimateAIBtn.onclick = () => runAiLookup(query);
estimateBox.hidden = false; estimateBox.hidden = false;
} }
@ -291,62 +284,6 @@ function buildEstimatedCar(query, cat) {
}; };
} }
// Hält Werte in einem plausiblen Bereich, falls die KI-Antwort mal Ausreißer liefert
function clampNum(value, fallback, min, max) {
const n = Number(value);
if (!Number.isFinite(n) || n <= 0) return fallback;
return Math.min(max, Math.max(min, n));
}
async function runAiLookup(query) {
estimateAIBtn.disabled = true;
estimateAIStatus.hidden = false;
estimateAIStatus.textContent = `Frage Claude nach „${query}“ …`;
try {
const res = await fetch("api/lookup.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query }),
});
const data = await res.json();
if (!res.ok || data.error) {
throw new Error(data.error || `HTTP ${res.status}`);
}
if (data.found === false) {
estimateAIStatus.textContent = `Claude konnte „${query}“ nicht sicher als Fahrzeug erkennen. Bitte Kategorie wählen oder Eingabe präzisieren.`;
estimateAIBtn.disabled = false;
return;
}
const car = {
id: "ai-" + Date.now(),
brand: String(data.brand || query).slice(0, 60),
model: String(data.model || "").slice(0, 60),
bodyType: String(data.bodyType || "Unbekannt") + " (KI-Schätzung)",
cargoLiters: Math.round(clampNum(data.cargoLiters, 450, 80, 2200)),
cargoLitersMax: data.cargoLitersMax ? Math.round(clampNum(data.cargoLitersMax, null, 80, 2600)) : null,
length_mm: clampNum(data.length_mm, 900, 400, 1400),
widthFloor_mm: clampNum(data.widthFloor_mm, 1000, 600, 1500),
widthShoulder_mm: clampNum(data.widthShoulder_mm, 1300, 700, 1700),
height_mm: clampNum(data.height_mm, 550, 300, 950),
sillHeight_mm: clampNum(data.sillHeight_mm, 700, 500, 900),
underFloorDepth_mm: data.underFloorDepth_mm ? clampNum(data.underFloorDepth_mm, null, 40, 260) : null,
isEstimate: true,
isAIEstimate: true,
};
// Breite unten darf die Breite oben nicht überschreiten (Wanne läuft nach oben konisch zu)
car.widthFloor_mm = Math.min(car.widthFloor_mm, car.widthShoulder_mm);
selectCar(car);
estimateBox.hidden = true;
} catch (err) {
estimateAIStatus.textContent = `KI-Anfrage fehlgeschlagen (${err.message}). Bitte erneut versuchen oder Kategorie wählen.`;
estimateAIBtn.disabled = false;
}
}
function handleVin(vin) { function handleVin(vin) {
const wmi = vin.slice(0, 3); const wmi = vin.slice(0, 3);
const brand = wmiTable[wmi]; const brand = wmiTable[wmi];
@ -372,6 +309,7 @@ const BRAND_ALIASES = {
function normalizeQuery(query) { function normalizeQuery(query) {
return query return query
.normalize("NFD").replace(/[̀-ͯ]/g, "") // Akzente entfernen, z. B. Citroen statt Citroën
.toLowerCase() .toLowerCase()
.split(/\s+/) .split(/\s+/)
.map((word) => BRAND_ALIASES[word] || word) .map((word) => BRAND_ALIASES[word] || word)
@ -893,12 +831,7 @@ function renderInfoPanel(car) {
? `<div class="spec-row"><span class="label">Stauraum unter dem Zwischenboden</span><span class="value">ca. ${car.underFloorDepth_mm} mm tief</span></div>` ? `<div class="spec-row"><span class="label">Stauraum unter dem Zwischenboden</span><span class="value">ca. ${car.underFloorDepth_mm} mm tief</span></div>`
: ""; : "";
const estimateNote = car.isAIEstimate const estimateNote = car.isEstimate
? `<p class="legend-note estimate-note">
Für „${car.brand}“ liegen keine hinterlegten Werte vor. Diese Maße hat Claude anhand seines
Wissens über dieses Modell geschätzt — keine offiziellen Herstellerangaben.
</p>`
: car.isEstimate
? `<p class="legend-note estimate-note"> ? `<p class="legend-note estimate-note">
Für „${car.brand}“ liegen keine spezifischen Werte vor. Die Maße sind eine grobe Schätzung Für „${car.brand}“ liegen keine spezifischen Werte vor. Die Maße sind eine grobe Schätzung
anhand der Fahrzeugklasse „${car.bodyType.replace(" (Schätzung)", "")}“, keine Angaben zum konkreten Modell. anhand der Fahrzeugklasse „${car.bodyType.replace(" (Schätzung)", "")}“, keine Angaben zum konkreten Modell.

File diff suppressed because it is too large Load diff

View file

@ -23,12 +23,7 @@
<div id="suggestions" class="suggestions" hidden></div> <div id="suggestions" class="suggestions" hidden></div>
<div id="hintBox" class="hint-box" hidden></div> <div id="hintBox" class="hint-box" hidden></div>
<div id="estimateBox" class="hint-box estimate-box" hidden> <div id="estimateBox" class="hint-box estimate-box" hidden>
<p>Kein Modell mit hinterlegten Werten gefunden.</p> <p>Kein Modell mit hinterlegten Werten gefunden. Nächstliegende Fahrzeugklasse für eine Schätzung wählen:</p>
<div class="estimate-ai-row">
<button id="estimateAIBtn" type="button" class="ai-btn"></button>
</div>
<p id="estimateAIStatus" class="estimate-ai-status" hidden></p>
<p class="estimate-or">…oder direkt eine Fahrzeugklasse für eine grobe Schätzung wählen:</p>
<div id="estimateChips" class="chips estimate-chips"></div> <div id="estimateChips" class="chips estimate-chips"></div>
</div> </div>
<div id="chips" class="chips"></div> <div id="chips" class="chips"></div>

View file

@ -146,42 +146,6 @@ main {
margin-top: 8px; margin-top: 8px;
} }
.estimate-ai-row {
margin: 10px 0;
}
.ai-btn {
width: 100%;
padding: 10px 14px;
border-radius: 8px;
border: 1px solid rgba(255,138,61,0.4);
background: rgba(255,138,61,0.12);
color: var(--text);
font-size: 0.88rem;
font-weight: 600;
cursor: pointer;
}
.ai-btn:hover:not(:disabled) {
background: rgba(255,138,61,0.2);
}
.ai-btn:disabled {
cursor: default;
opacity: 0.7;
}
.estimate-ai-status {
margin: -4px 0 10px;
font-size: 0.82rem;
}
.estimate-or {
margin: 0 0 4px;
font-size: 0.78rem;
opacity: 0.85;
}
.chip { .chip {
padding: 6px 12px; padding: 6px 12px;
background: var(--bg-panel); background: var(--bg-panel);