मॉडल
बेस URL और आवश्यक होने पर API कुंजी से OpenAI-संगत या Anthropic endpoint सेट करें। कनेक्शन जाँचें। स्थानीय मॉडल सर्वर चालू होना चाहिए; दूरस्थ उपकरण अलग से डेटा भेज सकते हैं।
LineCitrine में शेष पंक्तियों की लागत से विभाजन तुलना करें, पहला समाने वाला विकल्प सर्वोत्तम न मानें.
बेस URL और आवश्यक होने पर API कुंजी से OpenAI-संगत या Anthropic endpoint सेट करें। कनेक्शन जाँचें। स्थानीय मॉडल सर्वर चालू होना चाहिए; दूरस्थ उपकरण अलग से डेटा भेज सकते हैं।
फ़ोल्डर चुनें और संपादन से पहले सहायक से संबंधित फ़ाइलें पढ़ने को कहें। काम का उद्देश्य और सीमाएँ बताएँ।
बदलाव और कमांड का आउटपुट देखें। परिणाम स्वीकार करने से पहले प्रोजेक्ट की जाँच चलाएँ; बनाया गया कोड अपने आप परीक्षण किया हुआ नहीं होता।
def wrap_words(words, width):
words = tuple(words)
if type(width) is not int or not 1 <= width <= 80 or len(words) > 100:
raise ValueError("wrap.limit")
if any(type(w) is not str or not w or len(w) > width or any(c.isspace() for c in w) for w in words):
raise ValueError("wrap.word")
n = len(words)
costs, ends = [0] * (n+1), [0] * n
for i in range(n-1, -1, -1):
used, best = 0, None
for j in range(i, n):
used += len(words[j]) + (j > i)
if used > width:
break
cost = 0 if j == n-1 else (width-used)**2 + costs[j+1]
if best is None or cost < best:
best, ends[i] = cost, j+1
costs[i] = best
lines, i = [], 0
while i < n:
lines.append(" ".join(words[i:ends[i]]))
i = ends[i]
return lines