perf(ai-scanner): drop confidence scoring to simplify AI menu import
Removes the per-item confidence field end to end (prompt, extraction parsing, ai_import_items writes, API responses, low-confidence badge in the mobile review screen). ai_import_items.confidence column is left in place but unused (nullable, no destructive migration).
This commit is contained in:
@@ -33,10 +33,6 @@ export default function OnboardingAiReviewStep() {
|
||||
}, []);
|
||||
|
||||
const totalItems = categories.reduce((acc, c) => acc + c.items.length, 0);
|
||||
const lowConfidenceItems = categories.reduce(
|
||||
(acc, c) => acc + c.items.filter((i) => i.confidence < 0.85).length,
|
||||
0,
|
||||
);
|
||||
|
||||
function updateItem(categoryId: string, itemId: string, field: "name" | "price" | "description", value: string) {
|
||||
setCategories((prev) =>
|
||||
@@ -48,7 +44,7 @@ export default function OnboardingAiReviewStep() {
|
||||
if (itm.id !== itemId) return itm;
|
||||
if (field === "price") {
|
||||
const parsed = Number(value.replace(",", "."));
|
||||
return { ...itm, price: Number.isNaN(parsed) ? 0 : parsed, confidence: 1 };
|
||||
return { ...itm, price: Number.isNaN(parsed) ? 0 : parsed };
|
||||
}
|
||||
return { ...itm, [field]: value };
|
||||
}),
|
||||
@@ -75,7 +71,6 @@ export default function OnboardingAiReviewStep() {
|
||||
name: "Yeni Ürün",
|
||||
price: 100,
|
||||
description: "",
|
||||
confidence: 1,
|
||||
};
|
||||
|
||||
setCategories((prev) =>
|
||||
@@ -206,24 +201,6 @@ export default function OnboardingAiReviewStep() {
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{lowConfidenceItems > 0 ? (
|
||||
<View
|
||||
style={{
|
||||
marginTop: 12,
|
||||
paddingTop: 12,
|
||||
borderTopWidth: 1,
|
||||
borderTopColor: "#F5F5F4",
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: 8,
|
||||
}}
|
||||
>
|
||||
<Ionicons name="warning-outline" size={16} color="#D97706" />
|
||||
<Text style={{ color: "#D97706", fontSize: 12, fontWeight: "600", flex: 1 }}>
|
||||
{lowConfidenceItems} ürünün fiyatı veya ismi silik çıkmış olabilir, lütfen sarı etiketli ürünleri kontrol edin.
|
||||
</Text>
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
|
||||
{/* Categories & Items List */}
|
||||
@@ -269,39 +246,17 @@ export default function OnboardingAiReviewStep() {
|
||||
{/* Items in Category */}
|
||||
<View style={{ gap: 12 }}>
|
||||
{category.items.map((item) => {
|
||||
const isLowConfidence = item.confidence < 0.85;
|
||||
return (
|
||||
<View
|
||||
key={item.id}
|
||||
style={{
|
||||
backgroundColor: isLowConfidence ? "#FFFBEB" : "#FAFAFA",
|
||||
backgroundColor: "#FAFAFA",
|
||||
borderWidth: 1,
|
||||
borderColor: isLowConfidence ? "#FDE68A" : "#F4F4F5",
|
||||
borderColor: "#F4F4F5",
|
||||
borderRadius: 12,
|
||||
padding: 12,
|
||||
}}
|
||||
>
|
||||
{isLowConfidence ? (
|
||||
<View
|
||||
style={{
|
||||
alignSelf: "flex-start",
|
||||
backgroundColor: "#FEF3C7",
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 2,
|
||||
borderRadius: 6,
|
||||
marginBottom: 6,
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: 4,
|
||||
}}
|
||||
>
|
||||
<Ionicons name="warning-outline" size={12} color="#B45309" />
|
||||
<Text style={{ color: "#B45309", fontSize: 11, fontWeight: "700" }}>
|
||||
Fiyatı / İsmi Kontrol Edin (%{Math.round(item.confidence * 100)} Güven)
|
||||
</Text>
|
||||
</View>
|
||||
) : null}
|
||||
|
||||
<View style={{ flexDirection: "row", gap: 8, alignItems: "center", marginBottom: 6 }}>
|
||||
<TextInput
|
||||
value={item.name}
|
||||
|
||||
Reference in New Issue
Block a user