Add transitional learning detect with in-dialog mask review.
Senses grow from confirmations instead of a word list, so a later local pipeline can decide homonyms on a short passage. Default stays semantic. Local detect waits longer, and the reverse-proxy timeout is documented so Dev does not 504 first. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
59921fc5b5
commit
fa1c11c33e
29 files changed
+1135
-45
No files matched your search
@@ -12,7 +12,14 @@ os.environ.setdefault("KANSHO_PROVIDER_KEY", "")
|
||||
os.environ.setdefault("KANSHO_DETECT_PROVIDER_KEY", "")
|
||||
Path(tempfile.gettempdir()).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
from providers import is_local_url
|
||||
from entity_detect import (
|
||||
DETECT_MAX_TOKENS,
|
||||
DETECT_MAX_TOKENS_LOCAL,
|
||||
DETECT_TIMEOUT,
|
||||
DETECT_TIMEOUT_LOCAL,
|
||||
detect_chat_limits,
|
||||
)
|
||||
from providers import ProviderConfig, is_local_url
|
||||
|
||||
|
||||
def expect(ok: bool, message: str) -> None:
|
||||
@@ -29,6 +36,33 @@ def main() -> None:
|
||||
expect(is_local_url("http://ollama:11434/v1/chat/completions"), "compose hostname ollama is local")
|
||||
expect(not is_local_url("https://openrouter.ai/api/v1/chat/completions"), "OpenRouter is not local")
|
||||
expect(not is_local_url("https://8.8.8.8/v1/chat/completions"), "public IP is not local")
|
||||
remote = ProviderConfig(
|
||||
role="detect",
|
||||
name="openrouter",
|
||||
mode="http",
|
||||
url="https://openrouter.ai/api/v1/chat/completions",
|
||||
model="openai/gpt-4.1-nano",
|
||||
key="x",
|
||||
local=False,
|
||||
zdr=True,
|
||||
no_train=True,
|
||||
)
|
||||
local = ProviderConfig(
|
||||
role="detect",
|
||||
name="ollama",
|
||||
mode="http",
|
||||
url="http://192.168.2.144:11434/v1/chat/completions",
|
||||
model="phi3:mini",
|
||||
key="",
|
||||
local=True,
|
||||
zdr=True,
|
||||
no_train=True,
|
||||
)
|
||||
expect(detect_chat_limits(remote) == (DETECT_TIMEOUT, DETECT_MAX_TOKENS), "remote detect keeps 90s/1024")
|
||||
expect(
|
||||
detect_chat_limits(local) == (DETECT_TIMEOUT_LOCAL, DETECT_MAX_TOKENS_LOCAL),
|
||||
"local detect waits 300s with a 256-token cap",
|
||||
)
|
||||
print("local url tests passed.")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user