config.json
của plugin Continue.Mô hình | Chuẩn | Mô tả |
---|---|---|
claude-3-5-sonnet-20241022 | Claude | Phiên bản Claude 3.5 mới nhất |
claude-3-5-sonnet-20240620 | Claude | Phiên bản Claude 3.5 cập nhật |
gpt-4o | OpenAI | Mô hình GPT-4 tối ưu |
gpt-4o-mini | OpenAI | Mô hình GPT-4 thu nhỏ |
Continue
Continue: Open configuration file
"models"
như ví dụ dưới đây:{ "apiKey": "your-api-key", "apiBase": "https://api.cursorai.art/v1", "model": "cursor-3-5-sonnet-20241022", "title": "Claude-3-5-sonnet-20241022", "systemMessage": "You are an expert software developer. You give helpful and concise responses.", "provider": "openai"}
Lưu ý: Các cấu hình cho từng mô hình cần được phân tách bằng dấu phẩy, nhưng không đặt dấu phẩy sau mục cuối cùng.
@
để plugin đọc file hiện tại và sử dụng Claude 3.5 để gợi ý cải tiến mã hoặc tối ưu code"tabAutocompleteModel"
như sau để bật tính năng tự động hoàn thành với mô hình GPT nhỏ hơn:"tabAutocompleteModel": { "apiKey": "your-api-key", "apiBase": "https://api.cursorai.art/v1", "model": "gpt-4o-mini", "title": "gpt-4o-mini", "provider": "openai"}
import requestsfrom bs4 import BeautifulSoupimport csvfrom time import sleepimport random
def crawl_douban_top250(output_file, items_per_page=25): base_url = "https://movie.douban.com/top250" headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8', } total_pages = 10 movies_data = []
try: for page in range(total_pages): start_index = page * items_per_page url = f"{base_url}?start={start_index}" print(f"Scraping page {page + 1}...")
response = requests.get(url, headers=headers) response.raise_for_status() soup = BeautifulSoup(response.text, 'html.parser') movie_items = soup.find_all('div', class_='item')
if not movie_items: print(f"Warning: No movie data found on page {page + 1}") continue
for item in movie_items: try: rank = item.find('em').text title = item.find('span', class_='title').text info = item.find('div', class_='bd').find('p').text.strip() info_lines = [line.strip() for line in info.split('\n') if line.strip()] year = info_lines[1].split('/')[0].strip() director = info_lines[0].split('导演: ')[1].split('主演:')[0].strip() rating = item.find('span', class_='rating_num').text votes = item.find('div', class_='star').find_all('span')[-1].text votes = ''.join(filter(str.isdigit, votes)) movies_data.append([rank, title, year, director, rating, votes]) print(f"Scraped: {title}") except Exception as e: print(f"Error processing movie data: {e}") continue
delay = random.uniform(3, 7) print(f"Waiting for {delay:.2f} seconds before continuing...") sleep(delay)
with open(output_file, 'w', newline='', encoding='utf-8-sig') as f: writer = csv.writer(f) writer.writerow(['Rank', 'Movie Title', 'Year', 'Director', 'Rating', 'Number of Votes']) writer.writerows(movies_data)
print(f"Scraping completed! A total of {len(movies_data)} movies scraped.") print(f"Data saved to {output_file}")
except requests.RequestException as e: print(f"Network request error: {e}") except Exception as e: print(f"Program execution error: {e}")
if __name__ == "__main__": output_file = "douban_top250.csv" crawl_douban_top250(output_file)