Untitled conversation
- User
import csv import logging from pathlib import Path import flet as ft from configs.path_config import TAGS_CSV_DIR logger_local = logging.getLogger(__name__) def load_suggestions_from_csv(filepath: Path): suggestions = [] try: with open(filepath, newline='', encoding='cp932') as csvfile: reader = csv.reader(csvfile) for i, row in enumerate(reader): logger_local.debug(f"Row {i}: {row}") if len(row) < 1 or not row[0].strip(): logger_local.warning(f"Skipping empty or invalid row {i}") continue value = row[0].strip() # キーとして value のみを使用 key = value suggestion = ft.AutoCompleteSuggestion(key=key, value=value) suggestions.append(suggestion) except Exception as e: logger_local.error(f"Failed to load suggestions: {e}") return suggestions def main(page: ft.Page): logger_local.info("Initializing page and loading suggestions...") suggestions = load_suggestions_from_csv(TAGS_CSV_DIR) logger_local.info(f"Total suggestions loaded: {len(suggestions)}") ac = ft.AutoComplete( suggestions=suggestions, on_select=lambda e: logger_local.info(f"Selected: index={e.control.selected_index}, value={e.selection}"), ) page.add( ac, ft.Text("タグ名またはエイリアスを入力してください。"), ) ft.app(target=main)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.