codereader 0.7.2__tar.gz → 0.7.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codereader
3
- Version: 0.7.2
3
+ Version: 0.7.4
4
4
  Summary: Local code readability grader using LLMs
5
5
  License: GPLv3
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codereader"
3
- version = "0.7.2"
3
+ version = "0.7.4"
4
4
  description = "Local code readability grader using LLMs"
5
5
  authors = [
6
6
  {name = "Jason Liu",email = "Liujason2003@gmail.com"}
@@ -55,7 +55,7 @@ class OllamaRunner:
55
55
  """
56
56
  global _SERVER_CHECK
57
57
 
58
- if _SERVER_CHECK is not None:
58
+ if _SERVER_CHECK is not None and _SERVER_CHECK.ok:
59
59
  return _SERVER_CHECK
60
60
 
61
61
  cmd = [self.ollama_bin, "list"]
@@ -66,7 +66,7 @@ class OllamaRunner:
66
66
  return res
67
67
 
68
68
  if _looks_like_ollama_server_down(res.stderr, res.stdout, res.error):
69
- _SERVER_CHECK = RunnerResult(
69
+ return RunnerResult(
70
70
  ok=False,
71
71
  stdout=res.stdout,
72
72
  stderr=res.stderr,
@@ -78,7 +78,6 @@ class OllamaRunner:
78
78
  "Then retry your command."
79
79
  ),
80
80
  )
81
- return _SERVER_CHECK
82
81
 
83
82
  _SERVER_CHECK = res
84
83
  return res
@@ -118,10 +117,11 @@ class OllamaRunner:
118
117
  ) -> GradeResult:
119
118
  prompt = format_prompt(self.grade_prompt_template, tags, rules, language, code)
120
119
 
121
- if self.no_think:
122
- prompt = "/no_think\n" + prompt
123
-
124
- cmd = [self.ollama_bin, "run", self.model]
120
+ cmd = (
121
+ [self.ollama_bin, "run"]
122
+ + (["--think=false"] if self.no_think else ["--hidethinking"])
123
+ + [self.model]
124
+ )
125
125
 
126
126
  res = await run_subprocess(cmd, stdin_text=prompt, timeout_s=timeout_s)
127
127
  print(f"[DEBUG {self.name}] raw output: {repr(res.stdout[:800])}", flush=True)
File without changes
File without changes