मॉडल
बेस URL और आवश्यक होने पर API कुंजी से OpenAI-संगत या Anthropic endpoint सेट करें। कनेक्शन जाँचें। स्थानीय मॉडल सर्वर चालू होना चाहिए; दूरस्थ उपकरण अलग से डेटा भेज सकते हैं।
covering_window.py से सबसे छोटे सबसे बाएँ परिणाम में सभी आवश्यक वर्ण गिनतियाँ जाँचें।
बेस URL और आवश्यक होने पर API कुंजी से OpenAI-संगत या Anthropic endpoint सेट करें। कनेक्शन जाँचें। स्थानीय मॉडल सर्वर चालू होना चाहिए; दूरस्थ उपकरण अलग से डेटा भेज सकते हैं।
फ़ोल्डर चुनें और संपादन से पहले सहायक से संबंधित फ़ाइलें पढ़ने को कहें। काम का उद्देश्य और सीमाएँ बताएँ।
बदलाव और कमांड का आउटपुट देखें। परिणाम स्वीकार करने से पहले प्रोजेक्ट की जाँच चलाएँ; बनाया गया कोड अपने आप परीक्षण किया हुआ नहीं होता।
from collections import Counter
def covering_window(text, required):
if type(text) is not str or type(required) is not str or max(len(text), len(required)) > 1024:
raise ValueError("window.input")
if not required:
return ""
need, missing, left, best = Counter(required), len(required), 0, None
for right, char in enumerate(text, 1):
if need[char] > 0:
missing -= 1
need[char] -= 1
while missing == 0:
if best is None or right-left < best[1]-best[0]:
best = (left, right)
old = text[left]
need[old] += 1
if need[old] > 0:
missing += 1
left += 1
return "" if best is None else text[best[0]:best[1]]