-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add web api for /spec-repair/ #9
base: main
Are you sure you want to change the base?
Conversation
@@ -2,7 +2,7 @@ | |||
from fastapi import HTTPException | |||
import logging | |||
|
|||
from infra_ai_service.model.model import TextOutput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
infra_ai_service 不要去掉,执行前先 pip install .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -2,7 +2,7 @@ | |||
from fastapi import HTTPException | |||
import logging | |||
|
|||
from infra_ai_service.model.model import TextOutput | |||
from model.model import TextOutput | |||
|
|||
logger = logging.getLogger(__name__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1,10 +1,10 @@ | |||
from fastapi import APIRouter | |||
|
|||
from infra_ai_service.api.ai_enhance.text_process import TextInput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不去掉包名,本地执行前先 pip install .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样可以方便后面写UT测试用例
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
try: | ||
messages = self._prepare_messages_pro_1(spec, log, doc_content) | ||
response = self.client.chat.completions.create( | ||
model="claude-3-5-sonnet-20240620", messages=messages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
模型名字不要在代码里写死,做到配置文件中可以配置
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
api_key = os.getenv("OPENAI_API_KEY", None) | ||
base_url = os.getenv("OPENAI_BASE_URL", None) | ||
self.client = OpenAI(api_key=api_key, base_url=base_url) | ||
self.model = "gpt-4-0613" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
模型不要在代码中写死
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
class SpecBot: | ||
def __init__(self): | ||
api_key = os.getenv("OPENAI_API_KEY", None) | ||
base_url = os.getenv("OPENAI_BASE_URL", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API_KEY 和 BASE_URL 做到可配置
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
81e330f
to
6a347c2
Compare
1.there's two commits, separate them to distinguish the code change for specrepair code
2.fix error for for service startup, No module named 'infra_ai_service', http connection refused
3.change specrepair code for fast API
4.change api router prefix to /api/v1