-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
vLLM-served Qwen3 returned a valid server response, but smart_scraper_graph.run() get None.
log:
http://ai3.18chat.cn:7860/v1
Max input tokens for model openai/tiny not found,
please specify the model_tokens parameter in the llm section of the graph configuration.
Using default token size: 8192
INFO:web-loader:Starting scraping with playwright...
INFO:web-loader:Content scraped
INFO:httpx:HTTP Request: POST http://ai3.18chat.cn:7860/v1/chat/completions "HTTP/1.1 200 OK"
None
✨ Try enhanced version of ScrapegraphAI at https://scrapegraphai.com/oss ✨
config:
graph_config = {
"llm": {
"api_key": api_key,
"model": f"openai/{model_name}",
"temperature": 0.3,
"openai_api_base": base_url,
"max_tokens": 8192,
# "model_tokens": 16000, # use this param get error
},
"verbose": False,
"headless": False,
"loader_kwargs": {
"browser_name": "chromium",
"backend": "playwright",
# "load_state": 'networkidle',
# "requires_js_support": True,
"timeout": 60,
"retry_limit": 1,
}
}
vllm qwen3 response:
[OpenAI API]
{'id': '2479', 'object': 'chat.completion', 'created': 1758147406, 'model': 'gpt', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '{"content": "## 对于普通程序员来说 AI 是什么?AI 究竟用的是什么?\n\n这是一个很有趣的问题,很多人觉得有了 AI 之后是不需要学习,因为 AI 可以帮助他解决大部分问题 ,但是如果你已经使用过一段时间,或者说你正在使用 vibe coding ,那么你的实际体验会告诉你,你需要学习,甚至比之前了解更多。\n\n> 实际上有了 AI 之后,在某些方面我们确实不大需要去认真学习了,比如各种框架的 API ,因为 AI 总能找到合适的 API 来实现需求 。\n\n但是于此而言,作为使用者,我们需要去了解如何使用 AI ,甚至需要知道有什么技术框架,如何组织这种技术框架才能完成我们的需求。\n\n相信大家应该都看过不少 AI 的营销广告,稍微输入几句话,就可以得到精美的页面,甚至完成一键部署,就像是曾经的精美页游广告,但是当自己进入游戏后才发现,为什么我的 AI 并没有想象中聪明?\n\n### 阶段一:AI 的现状与误区\n\n首先第一点就是,现阶段的 AI 确实不够聪明 ,很多时候你看到的精美 AI 营销内容,不外乎两种情况:\n\n- 可远观而不可亵玩的展示品,营销里的都会经过无数次尝试后给出的结果,而这个输出看似精美,但是实际根本不能用,那只是一个 Demo,初见时美若 天仙,但是如果你走近打开灯光,就会发现根本不能用。\n\n- 专业的 vibe coding 大佬们通过各种详尽的规则,让 AI 的智商在当前项目得到了提升。\n\n是的,用好 vibe coding 并不是一件简单的事情,在 vibe coding 领域,给一个项目写 rule 是一件非常耗时的过程,这也是为什么在今年 2025 的 StackOverflow 调查里,有 72% 的开发者对于完全使用 vibe code 不要放心:\n\n因为如果要用好 AI ,你就需要学会配置各种 rule ,但是配置 rule 的时间,大概率你已经把需求写完了 ,这样是目前 vibe coding 的现状。\n\n> 你觉得 AI 不好用,因为你没花费时间去调试规则和提示词 ,都是大家都是同个模型,为什么你用的和他的不 一样,大多数原因就在于这里。\n\n这么说可能不明显,在 AI 画图领域比代码更明显,因为画图是直接输出成果,不像代码这种中间过程,如果要你在 ChatGPT 画出这种图,你会用怎么做?\n\n我们来看官方的提示词 :\n> 创建一个超现实的3D构图,其中独立的岩石块组合成【主题】。风格:破碎板岩 + 砂岩碎片,每个部分明显分离,留有微小间隙;经过雕琢的边缘,可见的石纹。外观:极简的米白色背景,柔和的自左上方向下的工作室灯光,细腻的阴影,暗板岩中点缀着微暖的赭色色调。构图:居中,整洁,正面视角。添加几片微小碎片以增加深度。无文字,无额外道具。格式:【比例】。使各部分清晰分离且易于辨识。\n\n可以看到,这里面都是细节,你需要告诉 AI :\n- 风格:破碎板岩 + 砂岩碎片\n- 每个部分明显分离,留有微小间隙\n- 可见的石纹\n- 灯光规则\n- 各种色调\n- 构图方式\n- 地面细节\n- ···\n\n也许看起来是短短一段话,但是如果你没有专业知识打底,事实上你很难调试出这样一个图生图的效果,这其实在编程领域也是一样。\n\n举一个另外很有趣的误区,那就是问模型它自己叫啥,然后发现好像和自己用的不一致,然后觉得自己被骗了,这其实也是幻觉所致,因为从训练的角度看,训练 Claude4 的时候,互联网语料还没有 Claude4 这个东西,不管是 Trae 还是 Cursor 都会出现这个问题,而官方之所以能正确,是在系统提示词方面增加了配置。\n\n### 为什么需要 Rules\n\n- AI 有时会偏离技术栈,或使用不一致的技术导致失败,例如想用 SQL,但 AI 突然换成 JSON 文件存储,导致问题\n- Rules 相当于 AI 的 \"system prompt\",可清晰告诉 Agent 使用技术栈和编码偏 好,确保一致性\n\n### 如何配置 Rules\n\n- 比如在 Cursor 的 project rules
,会生成一个 cursor
文件夹,内部包含 .mdc
(或类似)规则文件\n- 可同时加入用户级(通用)规则与项目级规则,推荐优先使用项目级设置,便于管理\n\n#### 常见规则类型和设置内容\n\n| 必备规则 | 原因 |\n|---|---|\n| 技术栈限制 | 明确指定语言与工具,例如:使用 Flutter 3.29.3 版本 API,使用 Provider 6.1.2 作为状态管理框架,使用 dio 5.8.0+1 作为网络请求,使用 cherry_toast 1.12.0 作为提示框架·····这里的核心目的就是限定范围,越是限制越详细,幻觉就会越来越低,错误也就越来越少。 |\n| 简洁优先 | 要求 AI 优先 选择简单方案,避免代码重复,检查是否已有实现,不要盲目新建功能 |\n| 环境区分 | 明确分隔 Dev、Test 和 Prod,确保修改只在 Dev 或 Test 环境执行,生产环境稳定 |\n| 范围控制 | 只修改被明确请求 的代码部分,不应产生副作用或引入新技术;如确需改动,务必先移除旧实现,避免重复逻辑,这在 AI 使用过程中是经常发生的,因为它时不时就会出现随机乱改的情况,所以类似要求必须有 |\n| 避免脚本残留 | 不要在代码库中留下单次运行的脚本;执行完应删除,或者直接在代码中 inline 而非文件留存,这在 Agent 执行过程中经常存在,不管是 Github Copilot Agent 还是 Cursor |\n| 文件大小限制 | 限制当个文件大小,比如文件超过 200–300 行需及早重构,防止庞大代码文件影响 AI 理解与测试,因为 AI 的上下文限制,AI 实际上是没办法完全理解一个超大型代码文件的,所以不生成超大型代码文件是基本要求 |\n| API Key 安全 | 不允许 Agent 覆盖本地 .env
文件或 API 密钥配置,避免泄露或重置问题 |\n| 测试覆盖 | 强制为所有重要功能编写测试,让每个功能都可以单独运行单元测试 |\n| 稳定性优先 | 稳定架构已有时,不允许 AI 引入大规模改结构除非明确指示;关注可能受影响模块 |\n\n#### 其他建议\n\n- 上下文管理:随着对话内容变多,AI 性能可能下降或者越觉增加,所以尽量在适当时候开启新 Chat,载入关键规则和代码片段 ,防止 context overflow 导致效率下降\n- 请求粒度:保持任务微小、明确(例如“添加一个功能”),便于 AI 针对执行,不易引入错误\n- 尽量不要使用 AI 直接对中大型项目进行重构,AI 最不擅长做的事是 对中大型项目进行重构和迁移,因为如果你不给出详细的规则,实现步骤,审查逻辑和 fallback 规则,那么它就会充满自己的想法,迁移过程很难控制。所以,不要给出像“帮我构建整个功能”这样冗长的提示 ,这样绝 对会让 AI 会开始产生幻觉,然后胡乱造作,这样基本是在浪费 Token 去赌 AI 会不会有幻觉,AI 很难处理超长上下文的东西,所以才有 Agent 的场景,Agent 一般会帮你拆分需求,但是如果都让 Agent 去拆分,那么可能每次拆分的结果可能都不大一样,也就是幻觉的概率问题。所以,在使用 AI 过程中,你必须学会将任何想要添加的功能分解成几个阶段,尤其是在构建复杂功能时,与其一次性给出一个冗长的提示,不如根据你的用例将其分解成 3-5 个甚至更多的请求。\n\n> AI 是帮助专业的人变得更专业。\n\n最后,一些框架也会提供它们的 AI 模板,例如 Flutter 就通过 [docs.flutter.dev/ai/ai-rules](https://link.juejin.cn?target=https%3A%2F%2Fdocs.flutter.dev%2Fai%2Fai-rules \"https://docs.flutter.dev/ai/ai-rules\") 提供了对应的模板:\n\n# AI rules for Flutter\n\nYou are an expert in Flutter and Dart development. Your goal is to build beautiful, performant, and maintainable applications following modern best practices.\n\n## Project Structure\n\n* Assumes a standard Flutter project structure with lib/main.dart
as the primary application entry point.\n\n## Package Management\n\n* If a new feature requires an external package, the AI will identify the most suitable and stable package from pub.dev.\n* To add a regular dependency, it will execute flutter pub add
.\n* To add a development dependency, it will execute flutter pub add dev:
.\n\n## Code Quality\n\n* Adhere to maintainable code structure and separation of concerns (e.g., UI logic separate from business logic).\n* Adhere to meaningful and consistent naming conventions.\n\n## Dart Best Practices\n\n* Follow the official Effective Dart guidelines.\n* Define related classes within the same library file. For large libraries, export smaller, private libraries from a single top-level library.\n* Group related libraries in the same folder.\n* Add documentation comments to all public APIs, including classes, constructors, methods, and top-level functions.\n* Write clear comments for complex or non-obvious code. Avoid over-commenting. Don't add trailing comments.\n* Ensure proper use of async
/await
for asynchronous operations with robust error handling.\n* Use pattern matching features where they simplify the code.\n\n## Flutter Best Practices\n\n* Widgets (especially StatelessWidget
) are immutable; when the UI needs to change, Flutter rebuilds the widget tree.\n* Prefer composing smaller widgets over extending existing ones.\n* Use small, private Widget
classes instead of private helper methods that return a Widget
.\n* Break down large build()
methods into smaller, reusable private Widget classes.\n* Use ListView.builder
to create lazy-loaded lists for performance.\n* Use const
constructors for widgets and in build()
methods whenever possible to optimize performance.\n* Avoid performing expensive operations, like network calls or complex computations, directly within build()
methods.\n\n## Application Architecture\n\n* Aim for separation of concerns similar to MVC/MVVM, with defined Model, View, and ViewModel/Controller roles.\n\n### State Management\n\n* Default to Flutter's built-in state management solutions. Do not use a third-party package unless explicitly requested.\n* Use Streams
and StreamBuilder
for handling a sequence of asynchronous events.\n* Use Futures
and FutureBuilder
for handling a single asynchronous operation that will complete in the future.\n* Use ValueNotifier
with ValueListenableBuilder
for simple, local state that involves a single value.\n\ndart\\n// Define a ValueNotifier to hold the state.\\nfinal ValueNotifier _counter = ValueNotifier(0);\\n// Use ValueListenableBuilder to listen and rebuild.\\nValueListenableBuilder(\\n valueListenable: _counter,\\n builder: (context, value, child) {\\n return Text(\'Count: $value\');\\n },\\n);\\n
\n\n* For state that is more complex or shared across multiple widgets, use ChangeNotifier
.\n* Use ListenableBuilder
to listen to changes from a ChangeNotifier
or other Listenable
.\n* When a more robust solution is needed, structure the app using the Model-View-ViewModel (MVVM) pattern.\n* Use manual dependency injection via constructors to make a class's dependencies explicit in its API.\n* Use provider
for dependency injection to make services, repositories, or complex state objects available to the UI layer without tight coupling (note: new-rules.md
generally defaults against third-party packages for state management unless explicitly requested).\n\n### Data Flow\n\n* Define data structures (classes) to represent the data used in the application.\n* Abstract data sources (e.g., API calls, database operations) using Repositories/Services to promote testability.\n\n### Routing\n\n* Use go_router
for declarative navigation, deep linking, and web support.\n\ndart\\n// 1. Add the dependency\\n// flutter pub add go_router\\n// 2. Configure the router\\nfinal GoRouter _router = GoRouter(\\n routes: [\\n GoRoute(\\n path: \\\'/\\\',\\n builder: (context, state) => const HomeScreen(),\\n routes: [\\n GoRoute(\\n path: \'details/:id\',\\n // Route with a path parameter\\n builder: (context, state) {\\n final String id = state.pathParameters[\'id\']!;\\n return DetailScreen(id: id);\\n },\\n ),\\n ],\\n ),\\n ],\\n);\\n// 3. Use it in your MaterialApp\\nMaterialApp.router(\\n routerConfig: _router,\\n);\\n
\n\n* Use the built-in Navigator
for short-lived screens that do not need to be deep-linkable, such as dialogs or temporary views.\n\ndart\\n// Push a new screen onto the stack\\nNavigator.push(\\n context,\\n MaterialPageRoute(builder: (context) => const DetailsScreen()),\\n);\\n// Pop the current screen to go back\\nNavigator.pop(context);\\n
\n\n### Data Handling & Serialization\n\n* Use json_serializable
and json_annotation
for parsing and encoding JSON data.\n* When encoding data, use fieldRename: FieldRename.snake
to convert Dart's camelCase fields to snake_case JSON keys.\n\ndart\\n// In your model file\\nimport \'package:json_annotation/json_annotation.dart\';\\npart \'user.g.dart\';\\n@JsonSerializable(fieldRename: FieldRename.snake)\\nclass User {\\n final String firstName;\\n final String lastName;\\n User({required this.firstName, required this.lastName});\\n factory User.fromJson(Map json) => _$UserFromJson(json);\\n Map toJson() => _$UserToJson(this);\\n}\\n
\n\n### Logging\n\n* Use the log
function from dart:developer
for structured logging that integrates with Dart DevTools.\n\ndart\\nimport \'dart:developer\' as developer;\\n// For simple messages\\ndeveloper.log(\'User logged in successfully.\');\\n// For structured error logging\\ntry {\\n // ... code that might fail \\n} catch (e, s) {\\n developer.log( \'Failed to fetch data\',\\n name: \'myapp.network\',\\n level: 1000, // SEVERE error: e, stackTrace: s, \\n );\\n}\\n
\n\n## Error Handling\n\n* Implement mechanisms to gracefully handle errors across the application (e.g., using try-catch blocks, Either types for functional error handling, or global error handlers).\n\n## Code Generation\n\n* Use build_runner
for all code generation tasks, such as for json_serializable
.\n* After modifying files that require code generation, run the build command:\n\nshell\\ndart run build_runner build --delete-conflicting-outputs
\n\n## Testing\n\n* Use package:test
for unit tests.\n* Use package:flutter_test
for widget tests.\n* Use package:integration_test
for integration tests.\n* Prefer using package:checks
for more expressive and readable assertions over the default matchers
.\n\n## Visual Design & Theming\n\n* Build beautiful and intuitive user interfaces that follow modern design guidelines.\n* Ensure the app is mobile responsive and adapts to different screen sizes, working perfectly on mobile and web.\n* If there are multiple pages for the user to interact with, provide an intuitive and easy navigation bar or controls.\n* Stress and emphasize font sizes to ease understanding, e.g., hero text, section headlines, list headlines, keywords in paragraphs.\n* Apply subtle noise texture to the main background to add a premium, tactile feel.\n* Multi-layered drop shadows create a strong sense of depth; cards have a soft, deep shadow to look \"lifted.\"\n* Incorporate icons to enhance the user’s understanding and the logical navigation of the app.\n* Buttons, checkboxes, sliders, lists, charts, graphs, and other interactive elements have a shadow with elegant use of color to create a \"glow\" effect.\n\n### Theming\n\n* Define a centralized ThemeData
object to ensure a consistent application-wide style.\n* Use Material 3 by setting useMaterial3: true
in your ThemeData
.\n* Implement support for both light and dark themes, ideal for a user-facing theme toggle (ThemeMode.light
, ThemeMode.dark
, ThemeMode.system
).\n* Generate harmonious color palettes from a single color using ColorScheme.fromSeed
.\n\ndart\\nfinal ThemeData lightTheme = ThemeData(\\n useMaterial3: true,\\n colorScheme: ColorScheme.fromSeed(\\n seedColor: Colors.deepPurple,\\n brightness: Brightness.light,\\n ),\\n // ... other theme properties\\n);\\n
\n\n* Include a wide range of color concentrations and hues in the palette to create a vibrant and energetic look and feel.\n* Use specific theme properties (e.g., appBarTheme
, elevatedButtonTheme
) to customize the appearance of individual Material components.\n* For custom fonts, use the google_fonts
package. Define a TextTheme
to apply fonts consistently.\n\ndart\\n// 1. Add the dependency\\n// flutter pub add google_fonts\\n// 2. Define a TextTheme with a custom font\\nfinal TextTheme appTextTheme = TextTheme(\\n displayLarge: GoogleFonts.oswald(fontSize: 57, fontWeight: FontWeight.bold),\\n titleLarge: GoogleFonts.roboto(fontSize: 22, fontWeight: FontWeight.w500),\\n bodyMedium: GoogleFonts.openSans(fontSize: 14),\\n);\\n
\n\n### Assets and Images\n\n* If images are needed, make them relevant and meaningful, with appropriate size, layout, and licensing (e.g., freely available). Provide placeholder images if real ones are not available.\n* Declare all asset paths in your pubspec.yaml
file.\n\nyaml\\nflutter:\\n uses-material-design: true\\n assets:\\n - assets/images/\\n
\n\n* Use Image.asset
to display local images from your asset bundle.\n\ndart\\nImage.asset(\'assets/images/placeholder.png\')\\n
\n\n* Displays an icon from an ImageProvider
, useful for custom icons not in Icons
class.\n* Use Image.network
to display images from a URL, and always include loadingBuilder
and errorBuilder
for a better user experience.\n\ndart\\nImage.network( \'https://picsum.photos/200/300\',\\n loadingBuilder: (context, child, progress) {\\n if (progress == null) return child;\\n return const Center(child: CircularProgressIndicator());\\n },\\n errorBuilder: (context, error, stackTrace) {\\n return const Icon(Icons.error);\\n },\\n)\\n
\n\n## Accessibility (A11Y)\n\n* Implement accessibility features to empower all users, assuming a wide variety of users with different physical abilities, mental abilities, age groups, education levels, and learning styles."}', 'reasoning_content': None, 'tool_calls': None}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 6735, 'total_tokens': 11104, 'completion_tokens': 4369}}