Spaces:
Sleeping
Sleeping
Update editor.py
Browse files
editor.py
CHANGED
|
@@ -3,7 +3,7 @@ import tempfile
|
|
| 3 |
import subprocess
|
| 4 |
import os
|
| 5 |
from streamlit_ace import st_ace
|
| 6 |
-
from
|
| 7 |
|
| 8 |
def setup_editor(api_key, mobile=False):
|
| 9 |
"""コードエディタとその関連機能をセットアップする"""
|
|
@@ -35,6 +35,8 @@ def setup_editor(api_key, mobile=False):
|
|
| 35 |
instructions = st.session_state.edit_instructions or "コードを改善してください"
|
| 36 |
|
| 37 |
with st.spinner("AIによるコード編集中..."):
|
|
|
|
|
|
|
| 38 |
edited_code = request_ai_edit(
|
| 39 |
api_key,
|
| 40 |
current_code,
|
|
|
|
| 3 |
import subprocess
|
| 4 |
import os
|
| 5 |
from streamlit_ace import st_ace
|
| 6 |
+
from utils import save_generated_code_to_new_file # chatではなくutilsからインポート
|
| 7 |
|
| 8 |
def setup_editor(api_key, mobile=False):
|
| 9 |
"""コードエディタとその関連機能をセットアップする"""
|
|
|
|
| 35 |
instructions = st.session_state.edit_instructions or "コードを改善してください"
|
| 36 |
|
| 37 |
with st.spinner("AIによるコード編集中..."):
|
| 38 |
+
# request_ai_editを直接インポートせず、関数を通して呼び出す
|
| 39 |
+
from chat import request_ai_edit # 関数を使う直前でインポート(循環を避ける)
|
| 40 |
edited_code = request_ai_edit(
|
| 41 |
api_key,
|
| 42 |
current_code,
|