mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-23 08:34:20 +01:00
refactor: cleanup
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import re
|
||||
from argparse import Namespace
|
||||
import subprocess
|
||||
import webbrowser
|
||||
from pathlib import Path
|
||||
|
||||
import hubble
|
||||
@@ -12,7 +12,11 @@ from jcloud.flow import CloudFlow
|
||||
|
||||
|
||||
def redirect_callback(href):
|
||||
print(f'You need login to Jina first to use GPTDeploy\nPlease open this link in your browser: {href}')
|
||||
print(
|
||||
f'You need login to Jina first to use GPTDeploy\n'
|
||||
f'Please open this link if it does not open automatically in your browser: {href}'
|
||||
)
|
||||
webbrowser.open(href, new=0, autoraise=True)
|
||||
|
||||
|
||||
def jina_auth_login():
|
||||
@@ -75,7 +79,6 @@ def deploy_on_jcloud(flow_yaml):
|
||||
return cloud_flow.__enter__().endpoints['gateway']
|
||||
|
||||
|
||||
|
||||
def deploy_flow(executor_name, dest_folder):
|
||||
flow = f'''
|
||||
jtype: Flow
|
||||
@@ -119,13 +122,13 @@ def replace_client_line(file_content: str, replacement: str) -> str:
|
||||
break
|
||||
return '\n'.join(lines)
|
||||
|
||||
|
||||
def update_client_line_in_file(file_path, host):
|
||||
with open(file_path, 'r') as file:
|
||||
content = file.read()
|
||||
|
||||
replaced_content = replace_client_line(content, f"client = Client(host='{host}')")
|
||||
|
||||
|
||||
with open(file_path, 'w') as file:
|
||||
file.write(replaced_content)
|
||||
|
||||
@@ -146,9 +149,8 @@ def process_error_message(error_message):
|
||||
|
||||
return '\n'.join(relevant_lines[-25:])
|
||||
|
||||
|
||||
def build_docker(path):
|
||||
|
||||
|
||||
# The command to build the Docker image
|
||||
cmd = f"docker build -t micromagic {path}"
|
||||
|
||||
@@ -164,4 +166,3 @@ def build_docker(path):
|
||||
else:
|
||||
print("Docker build completed successfully.")
|
||||
return ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user