pilot.linkstec 0.0.106__tar.gz → 0.0.108__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.
Files changed (90) hide show
  1. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/PKG-INFO +1 -1
  2. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/pyproject.toml +1 -1
  3. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/control/impl/base_controller.py +4 -0
  4. pilot_linkstec-0.0.108/src/pilot/generater/ai_base.py +7 -0
  5. pilot_linkstec-0.0.108/src/pilot/generater/ai_interface.py +8 -0
  6. pilot_linkstec-0.0.108/src/pilot/generater/lmstudioai.py +121 -0
  7. pilot_linkstec-0.0.108/src/pilot/generater/vera.py +101 -0
  8. pilot_linkstec-0.0.108/src/pilot/job/base/generate/generateJsonBaseJob.py +38 -0
  9. pilot_linkstec-0.0.108/src/pilot/job/base/generate/generateTextBaseJob.py +36 -0
  10. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot.linkstec.egg-info/PKG-INFO +1 -1
  11. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot.linkstec.egg-info/SOURCES.txt +4 -0
  12. pilot_linkstec-0.0.106/src/pilot/job/base/generate/generateJsonBaseJob.py +0 -42
  13. pilot_linkstec-0.0.106/src/pilot/job/base/generate/generateTextBaseJob.py +0 -40
  14. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/LICENSE +0 -0
  15. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/README.md +0 -0
  16. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/setup.cfg +0 -0
  17. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/__init__.py +0 -0
  18. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/base/__init__.py +0 -0
  19. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/base/ai_call.py +0 -0
  20. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/base/ai_info.py +0 -0
  21. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/base/chage_file_tag_base.py +0 -0
  22. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/base/db_operation_base.py +0 -0
  23. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/base/delete_commnents_base.py +0 -0
  24. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/base/file_operation.py +0 -0
  25. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/base/get_file_encoding.py +0 -0
  26. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/base/make_parsing_java_file_order_base.py +0 -0
  27. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/base/split_file_base.py +0 -0
  28. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/client/__init__.py +0 -0
  29. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/client/ai_client.py +0 -0
  30. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/config/__init__.py +0 -0
  31. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/config/config_reader.py +0 -0
  32. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/control/__init__.py +0 -0
  33. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/control/control_interface.py +0 -0
  34. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/control/impl/__init__.py +0 -0
  35. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/conver/__init__.py +0 -0
  36. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/conver/commentRemover.py +0 -0
  37. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/conver/converfileEncodding.py +0 -0
  38. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/create_python/__init__.py +0 -0
  39. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/create_python/config/__init__.py +0 -0
  40. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/create_python/config/create_file.py +0 -0
  41. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/create_python/create_python.py +0 -0
  42. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/create_python/sample/__init__.py +0 -0
  43. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/create_python/sample/child_sample/__init__.py +0 -0
  44. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/create_python/sample/child_sample/job/__init__.py +0 -0
  45. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/create_python/sample/config/__init__.py +0 -0
  46. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/create_python/sample/config/properties.py +0 -0
  47. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/db/__init__.py +0 -0
  48. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/db/create_table.py +0 -0
  49. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/db/db_connect.py +0 -0
  50. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/db/db_main.py +0 -0
  51. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/db/db_util.py +0 -0
  52. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/db/ddl/__init__.py +0 -0
  53. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/db/dml/__init__.py +0 -0
  54. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/db/sql_executor.py +0 -0
  55. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/db/sql_loader.py +0 -0
  56. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/db/sql_service.py +0 -0
  57. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/file_tool/__init__.py +0 -0
  58. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/file_tool/create_prompt_file.py +0 -0
  59. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/file_tool/json_file_tool.py +0 -0
  60. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/generater/__init__.py +0 -0
  61. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/generater/vertexai.py +0 -0
  62. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/__init__.py +0 -0
  63. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/__init__.py +0 -0
  64. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/convert/__init__.py +0 -0
  65. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/convert/delimiterSwitcherJob.py +0 -0
  66. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/convert/encodingTransformerJob.py +0 -0
  67. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/convert/tabReplaceJob.py +0 -0
  68. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/generate/__init__.py +0 -0
  69. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/program/__init__.py +0 -0
  70. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/program/cobol/__init__.py +0 -0
  71. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/program/cobol/convert/__init__.py +0 -0
  72. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/program/cobol/convert/spitPreDigit.py +0 -0
  73. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/program/java/__init__.py +0 -0
  74. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/base/program/java/generateDetailDesignPrompt.py +0 -0
  75. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/impl/__init__.py +0 -0
  76. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/impl/base_job.py +0 -0
  77. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/job/job_interface.py +0 -0
  78. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/logging/__init__.py +0 -0
  79. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/logging/logger.py +0 -0
  80. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/prompt/__init__.py +0 -0
  81. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/splitters/__init__.py +0 -0
  82. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/splitters/cobolsplitter.py +0 -0
  83. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/unit/__init__.py +0 -0
  84. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/unit/impl/__init__.py +0 -0
  85. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/unit/impl/base_unit.py +0 -0
  86. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/unit/unit_interface.py +0 -0
  87. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/util/__init__.py +0 -0
  88. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot/util/files.py +0 -0
  89. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot.linkstec.egg-info/dependency_links.txt +0 -0
  90. {pilot_linkstec-0.0.106 → pilot_linkstec-0.0.108}/src/pilot.linkstec.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pilot.linkstec
3
- Version: 0.0.106
3
+ Version: 0.0.108
4
4
  Summary: pilot of the ship, a tool for managing and deploying Python projects.
5
5
  Author-email: wanglr <wanglr1980@gmail.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pilot.linkstec"
3
- version = "0.0.106"
3
+ version = "0.0.108"
4
4
  authors = [
5
5
  { name="wanglr", email="wanglr1980@gmail.com" },
6
6
  ]
@@ -7,6 +7,7 @@ from concurrent.futures import ThreadPoolExecutor
7
7
  from pilot.control.control_interface import ControlInterface
8
8
  from pilot.unit.impl.base_unit import BaseUnit
9
9
  from pilot.config.config_reader import ConfigReader
10
+ from pilot.generater.vera import VeraSingleton
10
11
 
11
12
 
12
13
  class BaseController(ControlInterface):
@@ -14,6 +15,9 @@ class BaseController(ControlInterface):
14
15
  config_dto = None
15
16
 
16
17
  def __init__(self):
18
+ #try:
19
+ # VeraSingleton.get_instance()
20
+ #except FileNotFoundError:
17
21
  pass
18
22
 
19
23
  def _init_unit(self):
@@ -0,0 +1,7 @@
1
+ from typing import Dict, Any
2
+
3
+ from pilot.generater.ai_interface import AIInterface
4
+
5
+ class AIBase(AIInterface):
6
+ def generate_content(self, prompt: str) -> Dict[str, Any]:
7
+ pass
@@ -0,0 +1,8 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Dict, Any
3
+
4
+
5
+ class AIInterface(ABC):
6
+ @abstractmethod
7
+ def generate_content(self, prompt: str) -> Dict[str, Any]:
8
+ pass
@@ -0,0 +1,121 @@
1
+ import threading
2
+ from typing import Dict, Any, Optional
3
+ from pilot.generater.ai_base import AIBase
4
+
5
+ import requests
6
+
7
+ class lmstudioAISingleton(AIBase):
8
+ _instance: Optional['lmstudioAISingleton'] = None
9
+ _lock = threading.Lock()
10
+
11
+ def __new__(cls):
12
+ if cls._instance is None:
13
+ with cls._lock:
14
+ if cls._instance is None:
15
+ cls._instance = super(lmstudioAISingleton, cls).__new__(cls)
16
+ cls._instance._initialized = False
17
+ return cls._instance
18
+
19
+ def __init__(self, model_name: str = "openai/gpt-oss-20b",base_url:str="http://127.0.0.1:3000/v1"):
20
+ if not self._initialized:
21
+ with self._lock:
22
+ if not self._initialized:
23
+ self.model_name = model_name
24
+ self.base_url = base_url
25
+ self._session = requests.Session()
26
+ self._initialized = True
27
+
28
+ def generate_content(self, prompt: str) -> Dict[str, Any]:
29
+ """複数スレッドから安全に呼び出し可能"""
30
+ try:
31
+ payload = {
32
+ "model": self.model_name,
33
+ "messages": [
34
+ {"role": "user", "content": prompt}
35
+ ]
36
+ }
37
+
38
+ resp = self._session.post(
39
+ f"{self.base_url}/chat/completions",
40
+ json=payload,
41
+ timeout=600
42
+ )
43
+ resp.raise_for_status()
44
+ data = resp.json()
45
+
46
+ content = data["choices"][0]["message"]["content"]
47
+
48
+ return {
49
+ "prompt": prompt,
50
+ "response": self._remove_code_fence(content),
51
+ "success": True,
52
+ "error": None
53
+ }
54
+
55
+ except Exception as e:
56
+ return {
57
+ "prompt": prompt,
58
+ "response": None,
59
+ "success": False,
60
+ "error": str(e)
61
+ }
62
+
63
+ def start_chat(self):
64
+ """
65
+ VertexAI の ChatSession と完全互換は不可能だが、
66
+ 既存コードを壊さないために「退化実装」を提供
67
+ """
68
+ return _LMStudioChatSession(self)
69
+
70
+ def count_tokens(self, text: str) -> int:
71
+ return 1
72
+ #try:
73
+ # return len(self.encoding.encode(text))
74
+ #except Exception as e:
75
+ # print(f"トークン計算失敗: {e}")
76
+ # return 0
77
+
78
+ def _remove_code_fence(self, text: str) -> str:
79
+ lines = text.splitlines()
80
+ if lines and lines[0].startswith("```"):
81
+ lines = lines[1:]
82
+ if lines and lines[-1].startswith("```"):
83
+ lines = lines[:-1]
84
+ return "\n".join(lines)
85
+
86
+ @classmethod
87
+ def get_instance(cls, model_name,base_url) -> 'lmstudioAISingleton':
88
+ return cls(model_name,base_url)
89
+
90
+ class _LMStudioChatSession:
91
+ """
92
+ VertexAI ChatSession の「最低限互換」
93
+ """
94
+ def __init__(self, client: lmstudioAISingleton):
95
+ self._client = client
96
+ self._messages = []
97
+
98
+ def send_message(self, message: str):
99
+ self._messages.append({"role": "user", "content": message})
100
+
101
+ payload = {
102
+ "model": self._client.model_name,
103
+ "messages": self._messages
104
+ }
105
+
106
+ resp = self._client._session.post(
107
+ f"{self._client.base_url}/chat/completions",
108
+ json=payload,
109
+ timeout=60
110
+ )
111
+ resp.raise_for_status()
112
+ data = resp.json()
113
+
114
+ reply = data["choices"][0]["message"]["content"]
115
+ self._messages.append({"role": "assistant", "content": reply})
116
+
117
+ class _Resp:
118
+ def __init__(self, text):
119
+ self.text = text
120
+
121
+ return _Resp(reply)
@@ -0,0 +1,101 @@
1
+ import configparser
2
+ import os
3
+ import threading
4
+ from dataclasses import dataclass
5
+ from typing import Dict, Any, Optional
6
+
7
+ from pilot.generater.lmstudioai import lmstudioAISingleton
8
+ from pilot.generater.ai_base import AIBase
9
+
10
+ @dataclass
11
+ class AIConfigDTO:
12
+ veraApi: str
13
+ veraModel: str
14
+ verUrl: str
15
+ timeOut: int
16
+
17
+ class VeraSingleton:
18
+ _instance: Optional['VeraSingleton'] = None
19
+ _lock = threading.Lock()
20
+
21
+ def __new__(cls):
22
+ if cls._instance is None:
23
+ with cls._lock:
24
+ if cls._instance is None:
25
+ cls._instance = super(VeraSingleton, cls).__new__(cls)
26
+ cls._instance._initialized = False
27
+ return cls._instance
28
+
29
+ def __init__(self):
30
+ if not self._initialized:
31
+ with self._lock:
32
+
33
+ cwd = os.getcwd()
34
+ filepath = os.path.join(cwd, 'config', 'vera.properties')
35
+ self.config = configparser.ConfigParser()
36
+ self.config.optionxform = str
37
+
38
+ with open(filepath, 'r', encoding='utf-8') as f:
39
+ content = f.read()
40
+ if not content.lstrip().startswith('['):
41
+ content = '[DEFAULT]\n' + content
42
+ self.config.read_string(content)
43
+ self.config_dto = self.create_ai_dto()
44
+ self.veraApi = self.config_dto.veraApi
45
+ self.model_name = self.config_dto.veraModel
46
+ self.base_url = self.config_dto.verUrl
47
+ self.timeout = self.config_dto.timeOut
48
+ self.ai_instance: AIBase = self.get_ai_instance()
49
+ self._initialized = True
50
+
51
+ def get_ai_instance(self) :
52
+ match self.veraApi:
53
+ case "lmstudio":
54
+ return lmstudioAISingleton.get_instance(model_name=self.model_name,base_url= self.base_url)
55
+ case "ollama":
56
+ return AIBase()
57
+ case "gemini":
58
+ return AIBase()
59
+ case "gemini":
60
+ return AIBase()
61
+ case "gemini":
62
+ return AIBase()
63
+ case "qwen":
64
+ return AIBase()
65
+ case "azure":
66
+ return AIBase()
67
+ return AIBase()
68
+
69
+ def generate_content(self, prompt: str) -> Dict[str, Any]:
70
+ return self.ai_instance.generate_content(prompt)
71
+
72
+ @classmethod
73
+ def get_instance(cls) -> 'VeraSingleton':
74
+ return cls()
75
+
76
+ def create_ai_dto(self) -> AIConfigDTO:
77
+ vera_api = self.get('DEFAULT', 'vera_api', fallback='.')
78
+ vera_model = self.get('DEFAULT', 'vera_model', fallback='.')
79
+ ver_url = self.get('DEFAULT', 'ver_url', fallback='.')
80
+ time_out = int(self.get('DEFAULT', 'time_out', fallback=1))
81
+
82
+ return AIConfigDTO(
83
+ veraApi = vera_api,
84
+ veraModel = vera_model,
85
+ verUrl = ver_url,
86
+ timeOut = time_out
87
+ )
88
+
89
+ def get(self, section, option, fallback=None, cast_type=str):
90
+ try:
91
+ if cast_type == bool:
92
+ return self.config.getboolean(section, option)
93
+ elif cast_type == int:
94
+ return self.config.getint(section, option)
95
+ elif cast_type == float:
96
+ return self.config.getfloat(section, option)
97
+ else:
98
+ return self.config.get(section, option)
99
+ except (configparser.NoSectionError, configparser.NoOptionError):
100
+ return fallback
101
+
@@ -0,0 +1,38 @@
1
+ import json
2
+ import os
3
+ import threading
4
+ import time
5
+
6
+ from pilot.job.impl.base_job import BaseJob
7
+
8
+ from pilot.generater.vera import VeraSingleton
9
+
10
+ class GenerateJsonBaseJob(BaseJob):
11
+
12
+ prompt_content: str
13
+ result_content: str
14
+ result_file_path: str
15
+
16
+ def run(self):
17
+ prompt = self.prompt_content
18
+ # トークン数チェック
19
+ vera_ai = VeraSingleton.get_instance()
20
+ #token_count = vertexai.count_tokens(prompt)
21
+ #if token_count == 0:
22
+ # super().run()
23
+ # return
24
+ #if token_count > 900000:
25
+ # print(f"警告: promptのトークン数が900000を超えています ({token_count} tokens)")
26
+ # super().run()
27
+ # return
28
+ # VertexAI で生成
29
+ start = time.time()
30
+ result = vera_ai.generate_content(prompt)
31
+ end = time.time()
32
+ print(f"Ai 処理時間 {self.file_path}: {end - start:.2f}秒")
33
+
34
+ result_content = result.get('response', '')
35
+ data = json.loads(result_content)
36
+ with open(self.result_file_path, 'w', encoding='utf-8') as f:
37
+ json.dump(data, f, ensure_ascii=False, indent=2)
38
+ super().run()
@@ -0,0 +1,36 @@
1
+ import json
2
+ import os
3
+ import threading
4
+ import time
5
+
6
+ from pilot.job.impl.base_job import BaseJob
7
+
8
+ from pilot.generater.vera import VeraSingleton
9
+
10
+ class GenerateTextBaseJob(BaseJob):
11
+
12
+ prompt_content: str
13
+ result_content: str
14
+ result_file_path: str
15
+
16
+ def run(self):
17
+ prompt = self.prompt_content
18
+ # トークン数チェック
19
+ vera_ai = VeraSingleton.get_instance()
20
+ #token_count = vertexai.count_tokens(prompt)
21
+ #if token_count == 0:
22
+ # super().run()
23
+ # return
24
+ #if token_count > 900000:
25
+ # print(f"警告: promptのトークン数が900000を超えています ({token_count} tokens)")
26
+ # super().run()
27
+ # return
28
+ # VertexAI で生成
29
+ start = time.time()
30
+ result = vera_ai.generate_content(prompt)
31
+ end = time.time()
32
+ print(f"AI 処理時間 {self.file_path}: {end - start:.2f}秒")
33
+ result_content = result.get('response', '')
34
+ with open(self.result_file_path, 'w', encoding='utf-8') as f:
35
+ f.write(result_content)
36
+ super().run()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pilot.linkstec
3
- Version: 0.0.106
3
+ Version: 0.0.108
4
4
  Summary: pilot of the ship, a tool for managing and deploying Python projects.
5
5
  Author-email: wanglr <wanglr1980@gmail.com>
6
6
  License-Expression: MIT
@@ -50,6 +50,10 @@ src/pilot/file_tool/__init__.py
50
50
  src/pilot/file_tool/create_prompt_file.py
51
51
  src/pilot/file_tool/json_file_tool.py
52
52
  src/pilot/generater/__init__.py
53
+ src/pilot/generater/ai_base.py
54
+ src/pilot/generater/ai_interface.py
55
+ src/pilot/generater/lmstudioai.py
56
+ src/pilot/generater/vera.py
53
57
  src/pilot/generater/vertexai.py
54
58
  src/pilot/job/__init__.py
55
59
  src/pilot/job/job_interface.py
@@ -1,42 +0,0 @@
1
- import json
2
- import os
3
- import threading
4
- import time
5
-
6
- from pilot.job.impl.base_job import BaseJob
7
-
8
- from pilot.generater.vertexai import VertexAISingleton
9
-
10
- class GenerateJsonBaseJob(BaseJob):
11
-
12
- prompt_content: str
13
- result_content: str
14
- result_file_path: str
15
-
16
- def run(self):
17
- #with self._begin_file_lock:
18
- # if not self.change_current_trg_to_begin():
19
- # return
20
- #prompt = self.get_file_content()
21
- prompt = self.prompt_content
22
- # トークン数チェック
23
- vertexai = VertexAISingleton.get_instance()
24
- token_count = vertexai.count_tokens(prompt)
25
- if token_count == 0:
26
- super().run()
27
- return
28
- if token_count > 900000:
29
- print(f"警告: promptのトークン数が900000を超えています ({token_count} tokens)")
30
- super().run()
31
- return
32
- # VertexAI で生成
33
- start = time.time()
34
- result = vertexai.generate_content(prompt)
35
- end = time.time()
36
- print(f"Ai 処理時間 {self.file_path}: {end - start:.2f}秒")
37
-
38
- result_content = result.get('response', '')
39
- data = json.loads(result_content)
40
- with open(self.result_file_path, 'w', encoding='utf-8') as f:
41
- json.dump(data, f, ensure_ascii=False, indent=2)
42
- super().run()
@@ -1,40 +0,0 @@
1
- import json
2
- import os
3
- import threading
4
- import time
5
-
6
- from pilot.job.impl.base_job import BaseJob
7
-
8
- from pilot.generater.vertexai import VertexAISingleton
9
-
10
- class GenerateTextBaseJob(BaseJob):
11
-
12
- prompt_content: str
13
- result_content: str
14
- result_file_path: str
15
-
16
- def run(self):
17
- #with self._begin_file_lock:
18
- # if not self.change_current_trg_to_begin():
19
- # return
20
- #prompt = self.get_file_content()
21
- prompt = self.prompt_content
22
- # トークン数チェック
23
- vertexai = VertexAISingleton.get_instance()
24
- token_count = vertexai.count_tokens(prompt)
25
- if token_count == 0:
26
- super().run()
27
- return
28
- if token_count > 900000:
29
- print(f"警告: promptのトークン数が900000を超えています ({token_count} tokens)")
30
- super().run()
31
- return
32
- # VertexAI で生成
33
- start = time.time()
34
- result = vertexai.generate_content(prompt)
35
- end = time.time()
36
- print(f"AI 処理時間 {self.file_path}: {end - start:.2f}秒")
37
- result_content = result.get('response', '')
38
- with open(self.result_file_path, 'w', encoding='utf-8') as f:
39
- f.write(result_content)
40
- super().run()