This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat << EOF > run_agent.py | |
import argparse | |
import asyncio | |
from browser_use import Agent | |
from langchain_openai import ChatOpenAI | |
def parse_args(): | |
parser = argparse.ArgumentParser(description="Run AI agent with a custom task.") | |
parser.add_argument("--task", type=str, required=True, help="Task for the AI agent.") | |
return parser.parse_args() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat << EOF > run_agent.py | |
import argparse | |
import asyncio | |
from browser_use import Agent | |
from langchain_openai import ChatOpenAI | |
def parse_args(): | |
parser = argparse.ArgumentParser(description="Run AI agent with a custom task.") | |
parser.add_argument("--task", type=str, required=True, help="Task for the AI agent.") | |
return parser.parse_args() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getRequestContext } from "@cloudflare/next-on-pages"; | |
export const runtime = "edge"; | |
interface ExtendedCloudflareEnv { | |
DB: D1Database; | |
AI?: { | |
run: (model: string, options: any) => Promise<any>; | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:hooks_riverpod/hooks_riverpod.dart'; | |
import 'package:todo_riverpod/view/simple_todo.dart'; | |
void main() { | |
runApp( | |
ProviderScope( | |
child: MaterialApp( | |
home: SimpleTodo(), | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_test/flutter_test.dart'; | |
import 'package:hooks_riverpod/hooks_riverpod.dart'; | |
import 'package:todo_riverpod/entity/todo.dart'; | |
import 'package:todo_riverpod/provider/todo_providers.dart'; | |
import 'package:todo_riverpod/repository/todo_repository.dart'; | |
class _TodoRepositoryImplDummy implements TodoRepository { | |
List<Todo> inMemoryTodoList = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
useEffect(() { | |
ref.read(todoViewController).initState(); | |
return ref.read(todoViewController).dispose; | |
}, []); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_hooks/flutter_hooks.dart'; | |
import 'package:hooks_riverpod/hooks_riverpod.dart'; | |
import 'package:todo_riverpod/entity/todo.dart'; | |
import 'package:todo_riverpod/provider/todo_providers.dart'; | |
class TodoTile extends HookConsumerWidget { | |
final Todo todo; | |
const TodoTile({required this.todo}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final todoViewController = | |
Provider.autoDispose((ref) => TodoViewController(ref.read)); | |
class TodoViewController { | |
final Reader _read; | |
TodoViewController(this._read); | |
Future<void> initState() async { | |
_read(_todoListState.notifier).state = | |
await _read(todoRepository).getTodoList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final sortedTodoListState = StateProvider<List<Todo>?>((ref) { | |
final List<Todo>? todoList = ref.watch(_todoListState); | |
if (ref.watch(_sortOrderState) == SortOrder.ASC) { | |
todoList?.sort((a, b) => a.timestamp.compareTo(b.timestamp)); | |
} else { | |
todoList?.sort((a, b) => b.timestamp.compareTo(a.timestamp)); | |
} | |
return todoList; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum SortOrder { | |
ASC, | |
DESC, | |
} | |
final _sortOrderState = StateProvider<SortOrder>((ref) => SortOrder.ASC); |
NewerOlder