mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-04-30 12:30:01 +00:00
feat: improve dev commands, update all langchain dependencies to their latest major versions
This commit is contained in:
parent
77feff344f
commit
b1bd522c5c
8 changed files with 464 additions and 60 deletions
|
|
@ -2,7 +2,7 @@ from datetime import datetime
|
|||
from typing import Any, ClassVar, Dict, List, Optional, Type, TypeVar, Union, cast
|
||||
|
||||
from loguru import logger
|
||||
from pydantic import BaseModel, ValidationError, field_validator, model_validator
|
||||
from pydantic import BaseModel, ConfigDict, ValidationError, field_validator, model_validator
|
||||
|
||||
from open_notebook.database.repository import (
|
||||
ensure_record_id,
|
||||
|
|
@ -211,19 +211,20 @@ class ObjectModel(BaseModel):
|
|||
|
||||
|
||||
class RecordModel(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
arbitrary_types_allowed=True,
|
||||
extra="allow",
|
||||
from_attributes=True,
|
||||
defer_build=True,
|
||||
)
|
||||
|
||||
record_id: ClassVar[str]
|
||||
auto_save: ClassVar[bool] = (
|
||||
False # Default to False, can be overridden in subclasses
|
||||
)
|
||||
_instances: ClassVar[Dict[str, "RecordModel"]] = {} # Store instances by record_id
|
||||
|
||||
class Config:
|
||||
validate_assignment = True
|
||||
arbitrary_types_allowed = True
|
||||
extra = "allow"
|
||||
from_attributes = True
|
||||
defer_build = True
|
||||
|
||||
def __new__(cls, **kwargs):
|
||||
# If an instance already exists for this record_id, return it
|
||||
if cls.record_id in cls._instances:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue