From 8b85ede45ce797b2250f6e022e324d57a448ec8b Mon Sep 17 00:00:00 2001 From: lihanbo Date: Thu, 27 Feb 2025 14:04:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utils/Excel2Prompt.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Utils/Excel2Prompt.cs b/Utils/Excel2Prompt.cs index 01d3608..2888aa5 100644 --- a/Utils/Excel2Prompt.cs +++ b/Utils/Excel2Prompt.cs @@ -50,14 +50,14 @@ public class Excel2Prompt var nonNullData = columnData.Where(value => value != null).ToList(); var missingValues = columnData.Count - nonNullData.Count; var uniqueValues = nonNullData.Distinct().Count(); - var sampleValues = nonNullData.Take(3).Select(value => value.ToString().Replace("\n"," ")).ToArray(); + var sampleValues = nonNullData.Take(5).Select(value => value.ToString().Replace("\n"," ")).ToArray(); // 自动识别数据类型 var dataType = GetColumnDataType(nonNullData); - var prompt = $"- Column '{column.Replace("\n", " ")}'\n" + - $" - Type: {dataType}\n" + - $" - Sample values: ['{string.Join("', '", sampleValues)}']"; + var prompt = $"- Column '{column.Replace("\n", " ")}'" + + $" - Type: {dataType}" + + $" - Sample values: ['{string.Join("','", sampleValues)}']"; //$" - Unique values: {uniqueValues}\n" + //$" - Missing values: {missingValues}\n"; @@ -70,11 +70,11 @@ public class Excel2Prompt private static string GetColumnDataType(List data) { - bool isInt = true; - bool isLong = true; - bool isDouble = true; - bool isDateTime = true; - bool isBool = true; + var isInt = true; + var isLong = true; + var isDouble = true; + var isDateTime = true; + var isBool = true; foreach (var item in data) {