Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +20 -0
- .gitignore +19 -0
- .gradio/certificate.pem +31 -0
- Project.py +362 -0
- ProjectClient.py +36 -0
- README.md +3 -9
- app.py +753 -0
- myenv/bin/Activate.ps1 +247 -0
- myenv/bin/activate +69 -0
- myenv/bin/activate.csh +26 -0
- myenv/bin/activate.fish +69 -0
- myenv/bin/debugpy +8 -0
- myenv/bin/distro +8 -0
- myenv/bin/dotenv +8 -0
- myenv/bin/f2py +8 -0
- myenv/bin/fastapi +8 -0
- myenv/bin/git-filter-repo +8 -0
- myenv/bin/gradio +8 -0
- myenv/bin/httpx +8 -0
- myenv/bin/huggingface-cli +8 -0
- myenv/bin/ipython +8 -0
- myenv/bin/ipython3 +8 -0
- myenv/bin/jupyter +8 -0
- myenv/bin/jupyter-kernel +8 -0
- myenv/bin/jupyter-kernelspec +8 -0
- myenv/bin/jupyter-migrate +8 -0
- myenv/bin/jupyter-run +8 -0
- myenv/bin/jupyter-troubleshoot +8 -0
- myenv/bin/markdown-it +8 -0
- myenv/bin/normalizer +8 -0
- myenv/bin/numpy-config +8 -0
- myenv/bin/openai +8 -0
- myenv/bin/opentelemetry-bootstrap +8 -0
- myenv/bin/opentelemetry-instrument +8 -0
- myenv/bin/pip +8 -0
- myenv/bin/pip3 +8 -0
- myenv/bin/pip3.11 +8 -0
- myenv/bin/pygmentize +8 -0
- myenv/bin/python +0 -0
- myenv/bin/python3 +0 -0
- myenv/bin/python3.11 +0 -0
- myenv/bin/ruff +3 -0
- myenv/bin/tests +8 -0
- myenv/bin/tqdm +8 -0
- myenv/bin/transformers-cli +8 -0
- myenv/bin/typer +8 -0
- myenv/bin/upload_theme +8 -0
- myenv/bin/uvicorn +8 -0
- myenv/lib/python3.11/site-packages/Columnar-1.3.1.dist-info/INSTALLER +1 -0
- myenv/lib/python3.11/site-packages/Columnar-1.3.1.dist-info/LICENSE.txt +7 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,23 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
myenv/bin/ruff filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
myenv/lib/python3.11/site-packages/PIL/.dylibs/libfreetype.6.dylib filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
myenv/lib/python3.11/site-packages/PIL/.dylibs/libharfbuzz.0.dylib filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
myenv/lib/python3.11/site-packages/box/box.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
myenv/lib/python3.11/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
myenv/lib/python3.11/site-packages/examples/openai_example/resources/lounge_flamingo.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
myenv/lib/python3.11/site-packages/examples/openai_example/resources/mask.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
myenv/lib/python3.11/site-packages/gradio/frpc_darwin_arm64_v0.3 filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
myenv/lib/python3.11/site-packages/gradio/templates/frontend/assets/Canvas3D-BCiO3KDA.js.map filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
myenv/lib/python3.11/site-packages/grpc/_cython/cygrpc.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
myenv/lib/python3.11/site-packages/numpy/_core/_multiarray_umath.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
myenv/lib/python3.11/site-packages/pandas/_libs/algos.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
myenv/lib/python3.11/site-packages/pandas/_libs/groupby.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
myenv/lib/python3.11/site-packages/pandas/_libs/hashtable.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
myenv/lib/python3.11/site-packages/pandas/_libs/interval.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
myenv/lib/python3.11/site-packages/pandas/_libs/join.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
myenv/lib/python3.11/site-packages/pydantic_core/_pydantic_core.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
myenv/lib/python3.11/site-packages/tiktoken/_tiktoken.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
myenv/lib/python3.11/site-packages/tokenizers/tokenizers.abi3.so filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
myenv/lib/python3.11/site-packages/zmq/.dylibs/libzmq.5.dylib filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python-generated files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[oc]
|
| 4 |
+
build/
|
| 5 |
+
dist/
|
| 6 |
+
wheels/
|
| 7 |
+
*.egg-info
|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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from enum import Enum
|
| 2 |
+
from ProjectClient import Client,zus_coffee,ssm, game
|
| 3 |
+
from prompts import *
|
| 4 |
+
from langtrace_python_sdk import langtrace
|
| 5 |
+
from langtrace_python_sdk.utils.with_root_span import with_langtrace_root_span
|
| 6 |
+
import openai
|
| 7 |
+
from contextlib import contextmanager
|
| 8 |
+
import json
|
| 9 |
+
|
| 10 |
+
@contextmanager
|
| 11 |
+
def openai_session():
|
| 12 |
+
"""Context manager to properly handle OpenAI API sessions"""
|
| 13 |
+
try:
|
| 14 |
+
# Initialize client
|
| 15 |
+
client = openai.OpenAI()
|
| 16 |
+
yield client
|
| 17 |
+
finally:
|
| 18 |
+
# Clean up client resources
|
| 19 |
+
if hasattr(client, 'close'):
|
| 20 |
+
client.close()
|
| 21 |
+
|
| 22 |
+
@with_langtrace_root_span()
|
| 23 |
+
def call_o1_mini(prompt):
|
| 24 |
+
print(f"calling o1-mini with prompt: {prompt}")
|
| 25 |
+
with openai_session() as client:
|
| 26 |
+
try:
|
| 27 |
+
client = openai.OpenAI()
|
| 28 |
+
|
| 29 |
+
# Call API
|
| 30 |
+
response = client.chat.completions.create(
|
| 31 |
+
model="o1-mini", # Replace with the appropriate model
|
| 32 |
+
messages=[
|
| 33 |
+
{"role": "user", "content": prompt}
|
| 34 |
+
]
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
# Extract response text
|
| 38 |
+
result = response.choices[0].message.content
|
| 39 |
+
return result
|
| 40 |
+
|
| 41 |
+
except Exception as e:
|
| 42 |
+
return f"Error generating output: {str(e)}"
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
@with_langtrace_root_span()
|
| 46 |
+
def call_4o_mini(prompt):
|
| 47 |
+
print(f"calling 4o-mini with prompt: {prompt}")
|
| 48 |
+
with openai_session() as client:
|
| 49 |
+
try:
|
| 50 |
+
client = openai.OpenAI()
|
| 51 |
+
|
| 52 |
+
# Call API
|
| 53 |
+
response = client.chat.completions.create(
|
| 54 |
+
model="gpt-4o-mini", # Replace with the appropriate model
|
| 55 |
+
# model="chatgpt-4o-latest", # Replace with the appropriate model
|
| 56 |
+
messages=[
|
| 57 |
+
{"role": "user", "content": prompt}
|
| 58 |
+
]
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
# Extract response text
|
| 62 |
+
result = response.choices[0].message.content
|
| 63 |
+
return result
|
| 64 |
+
|
| 65 |
+
except Exception as e:
|
| 66 |
+
return f"Error generating output: {str(e)}"
|
| 67 |
+
|
| 68 |
+
class ProjectType(Enum):
|
| 69 |
+
Page = "Page"
|
| 70 |
+
Sage = "Sage"
|
| 71 |
+
Engage = "Engage"
|
| 72 |
+
|
| 73 |
+
class Project:
|
| 74 |
+
def __init__(self, project_type: ProjectType, session_id = None):
|
| 75 |
+
self.project_type = project_type
|
| 76 |
+
self.session_id = session_id
|
| 77 |
+
|
| 78 |
+
# requirement_rubric, fetch from db
|
| 79 |
+
# then retrive from here again, omit recalls to fetch the same thing over and over
|
| 80 |
+
self.rubric = []
|
| 81 |
+
self.rubric_section_names = []
|
| 82 |
+
self.project_detail = []
|
| 83 |
+
self.structured_qa = ""
|
| 84 |
+
self.component_list = []
|
| 85 |
+
self.component_csv = ""
|
| 86 |
+
self.flared_csv = ""
|
| 87 |
+
|
| 88 |
+
def set_rubric(self,rubric):
|
| 89 |
+
self.rubric = rubric
|
| 90 |
+
|
| 91 |
+
def set_component_csv(self,component_csv):
|
| 92 |
+
self.component_csv = component_csv
|
| 93 |
+
|
| 94 |
+
def get_component_csv(self):
|
| 95 |
+
return self.component_csv
|
| 96 |
+
|
| 97 |
+
def set_component_list(self,component_list):
|
| 98 |
+
self.component_list = component_list
|
| 99 |
+
|
| 100 |
+
def set_rubric_section_names(self,rubric_section_names):
|
| 101 |
+
self.rubric_section_names = rubric_section_names
|
| 102 |
+
|
| 103 |
+
def set_project_detail(self,project_detail):
|
| 104 |
+
self.project_detail = project_detail
|
| 105 |
+
|
| 106 |
+
def add_project_detail(self,project_detail):
|
| 107 |
+
self.project_detail.append(project_detail)
|
| 108 |
+
|
| 109 |
+
def get_project_detail(self):
|
| 110 |
+
return(self.project_detail)
|
| 111 |
+
|
| 112 |
+
# the rubric to generate project questions
|
| 113 |
+
def project_question_generation_rubric(self, ):
|
| 114 |
+
headers = [ 'Criteria', 'Initial Questions', 'Quantifiable Value']
|
| 115 |
+
# table = '| ' + ' | '.join(headers) + ' |'
|
| 116 |
+
table = ' | '.join(headers)
|
| 117 |
+
# table += '\n' + '| ' + ' | '.join(['---'] * len(headers)) + ' |'
|
| 118 |
+
|
| 119 |
+
# print(len(self.rubric))
|
| 120 |
+
for entry in self.rubric:
|
| 121 |
+
# print(entry)
|
| 122 |
+
# table += f"\n{entry['criteria']} | {entry['explanation']} | {entry['priority']} | {entry['quantifiable_value'] or ''}"
|
| 123 |
+
table += f"\n{entry['criteria']} | {entry['initial_question']} | {entry['quantifiable_value'] or ''}"
|
| 124 |
+
# table += f"\n| {entry['section_name']} | {entry['criteria']} | {entry['explanation']} | {entry['priority']} | {entry['quantifiable_value'] or ''} |"
|
| 125 |
+
return table
|
| 126 |
+
|
| 127 |
+
# the rubric to grade answers project questions
|
| 128 |
+
def project_question_grading_rubric(self):
|
| 129 |
+
headers = ['Criteria', 'Explanation', 'Priority', 'Quantifiable Value']
|
| 130 |
+
# headers = ['Criteria', 'Explanation', 'Priority', 'Quantifiable Value']
|
| 131 |
+
# table = '| ' + ' | '.join(headers) + ' |'
|
| 132 |
+
table = ' | '.join(headers)
|
| 133 |
+
# table += '\n' + '| ' + ' | '.join(['---'] * len(headers)) + ' |'
|
| 134 |
+
|
| 135 |
+
# print(len(self.rubric))
|
| 136 |
+
for entry in self.rubric:
|
| 137 |
+
# print(entry)
|
| 138 |
+
# table += f"\n{entry['criteria']} | {entry['explanation']} | {entry['priority']} | {entry['quantifiable_value'] or ''}"
|
| 139 |
+
table += f"\n{entry['criteria']} | {entry['explanation']} | {entry['priority']} | {entry['quantifiable_value'] or ''}"
|
| 140 |
+
# table += f"\n| {entry['section_name']} | {entry['criteria']} | {entry['explanation']} | {entry['priority']} | {entry['quantifiable_value'] or ''} |"
|
| 141 |
+
return table
|
| 142 |
+
|
| 143 |
+
# different pemutation of columns, to reduce token count
|
| 144 |
+
def rubric_to_text(self):
|
| 145 |
+
headers = ['Section Name', 'Criteria', 'Explanation', 'Priority', 'Quantifiable Value']
|
| 146 |
+
# headers = ['Criteria', 'Explanation', 'Priority', 'Quantifiable Value']
|
| 147 |
+
# table = '| ' + ' | '.join(headers) + ' |'
|
| 148 |
+
table = ' | '.join(headers)
|
| 149 |
+
# table += '\n' + '| ' + ' | '.join(['---'] * len(headers)) + ' |'
|
| 150 |
+
|
| 151 |
+
# print(len(self.rubric))
|
| 152 |
+
for entry in self.rubric:
|
| 153 |
+
# print(entry)
|
| 154 |
+
# table += f"\n{entry['criteria']} | {entry['explanation']} | {entry['priority']} | {entry['quantifiable_value'] or ''}"
|
| 155 |
+
table += f"\n{entry['section_name']} | {entry['criteria']} | {entry['explanation']} | {entry['priority']} | {entry['quantifiable_value'] or ''}"
|
| 156 |
+
# table += f"\n| {entry['section_name']} | {entry['criteria']} | {entry['explanation']} | {entry['priority']} | {entry['quantifiable_value'] or ''} |"
|
| 157 |
+
return table
|
| 158 |
+
|
| 159 |
+
def rubric_to_verify(self):
|
| 160 |
+
# headers = ['Section Name', 'Criteria', 'Explanation', "Priority"]
|
| 161 |
+
headers = ['Criteria', 'Explanation', "Priority"]
|
| 162 |
+
# table = '| ' + ' | '.join(headers) + ' |'
|
| 163 |
+
table = ' | '.join(headers)
|
| 164 |
+
# table += '\n' + '| ' + ' | '.join(['---'] * len(headers)) + ' |'
|
| 165 |
+
|
| 166 |
+
# print(len(self.rubric))
|
| 167 |
+
for entry in self.rubric:
|
| 168 |
+
merged_columns = entry['explanation'] + " " + (entry['quantifiable_value'] or '')
|
| 169 |
+
# print(entry)
|
| 170 |
+
table += f"\n {entry['criteria']} | {merged_columns} | {entry['priority']}"
|
| 171 |
+
# table += f"\n| {entry['section_name']} | {entry['criteria']} | {entry['explanation']} | {entry['priority']} | {entry['quantifiable_value'] or ''} |"
|
| 172 |
+
return table
|
| 173 |
+
|
| 174 |
+
def component_to_text(self):
|
| 175 |
+
# If input is empty, return empty string
|
| 176 |
+
if not self.component_list:
|
| 177 |
+
return ""
|
| 178 |
+
|
| 179 |
+
# Get headers from the first row
|
| 180 |
+
# headers = list(self.component_list[0].keys())
|
| 181 |
+
headers = ["base_project_name", "module", "submodule","unit_type", "quantity"]
|
| 182 |
+
# Create header row
|
| 183 |
+
table = " | ".join(headers) + "\n"
|
| 184 |
+
table += "-" * len(table) + "\n"
|
| 185 |
+
|
| 186 |
+
# Add data rows
|
| 187 |
+
for row in self.component_list:
|
| 188 |
+
# Convert None values to empty strings and all values to strings
|
| 189 |
+
values = [str(row[header]) if row[header] is not None else "" for header in headers]
|
| 190 |
+
table += " | ".join(values) + "\n"
|
| 191 |
+
|
| 192 |
+
return table
|
| 193 |
+
|
| 194 |
+
def get_component_mandays(self):
|
| 195 |
+
# If input is empty, return empty list
|
| 196 |
+
if not self.component_list:
|
| 197 |
+
return []
|
| 198 |
+
|
| 199 |
+
# Define headers we want to extract
|
| 200 |
+
headers = ["module", "submodule", "mandays_per_unit"]
|
| 201 |
+
|
| 202 |
+
# Create list of dictionaries with only the headers we want
|
| 203 |
+
result = []
|
| 204 |
+
for row in self.component_list:
|
| 205 |
+
filtered_row = {
|
| 206 |
+
header: row[header] if row[header] is not None else ""
|
| 207 |
+
for header in headers
|
| 208 |
+
}
|
| 209 |
+
result.append(filtered_row)
|
| 210 |
+
|
| 211 |
+
return result
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
def generate_client_follow_up(self ,system_prompt = client_follow_up):
|
| 215 |
+
# current_form = self.filter_non_empty_answer()
|
| 216 |
+
prompt = f"""
|
| 217 |
+
{system_prompt}
|
| 218 |
+
|
| 219 |
+
# Input:
|
| 220 |
+
## Client Details / Project Requirement Q&A
|
| 221 |
+
{self.project_detail}
|
| 222 |
+
"""
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
# print(f"\n\generate_client_follow_up with prompt: {prompt}\n\n")
|
| 226 |
+
result = call_o1_mini(prompt)
|
| 227 |
+
# print(f"type, result : {type(result)}, {result}")
|
| 228 |
+
|
| 229 |
+
return result
|
| 230 |
+
|
| 231 |
+
def generate_questions(self, system_prompt=question_generator):
|
| 232 |
+
prompt = f"""
|
| 233 |
+
{system_prompt}
|
| 234 |
+
|
| 235 |
+
# Input:
|
| 236 |
+
## Client Details / Project Requirement Q&A
|
| 237 |
+
{self.project_detail}
|
| 238 |
+
|
| 239 |
+
## Requirement Rubric
|
| 240 |
+
{self.project_question_generation_rubric()}
|
| 241 |
+
"""
|
| 242 |
+
|
| 243 |
+
# print(f"\n\generate_questions with prompt: {prompt}\n\n")
|
| 244 |
+
result = call_o1_mini(prompt)
|
| 245 |
+
# print(f"type, result : {type(result)}, {result}")
|
| 246 |
+
return result
|
| 247 |
+
|
| 248 |
+
def generate_follow_up(self ,system_prompt = followup_question_generator):
|
| 249 |
+
# current_form = self.filter_non_empty_answer()
|
| 250 |
+
prompt = f"""
|
| 251 |
+
{system_prompt}
|
| 252 |
+
|
| 253 |
+
# Input:
|
| 254 |
+
## Client Details / Project Requirement Q&A
|
| 255 |
+
{self.project_detail}
|
| 256 |
+
|
| 257 |
+
## Requirement Rubric
|
| 258 |
+
{self.project_question_grading_rubric()}
|
| 259 |
+
"""
|
| 260 |
+
|
| 261 |
+
# print(f"\n\generate_questions with prompt: {prompt}\n\n")
|
| 262 |
+
result = call_o1_mini(prompt)
|
| 263 |
+
return result
|
| 264 |
+
|
| 265 |
+
def rewrite_qa(self,system_prompt = structure_qa):
|
| 266 |
+
prompt = f"""
|
| 267 |
+
{system_prompt}
|
| 268 |
+
|
| 269 |
+
# Input:
|
| 270 |
+
## Client Details / Project Requirement Q&A
|
| 271 |
+
{self.get_project_detail()}"""
|
| 272 |
+
|
| 273 |
+
result = call_o1_mini(prompt)
|
| 274 |
+
self.structured_qa = result
|
| 275 |
+
# print(f"POPULATED TABLE : {result}")
|
| 276 |
+
return result
|
| 277 |
+
|
| 278 |
+
def flare_tasks(self, system_prompt = flare_task):
|
| 279 |
+
# current_form = self.filter_non_empty_answer()
|
| 280 |
+
# {self.get_project_detail()}
|
| 281 |
+
|
| 282 |
+
prompt = f"""
|
| 283 |
+
{system_prompt}
|
| 284 |
+
|
| 285 |
+
# Input:
|
| 286 |
+
{self.structured_qa}
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
## Component List
|
| 290 |
+
{self.component_to_text()}
|
| 291 |
+
"""
|
| 292 |
+
|
| 293 |
+
# print(f"\n\ additional_tasks with prompt: {prompt}\n\n")
|
| 294 |
+
result = call_o1_mini(prompt)
|
| 295 |
+
|
| 296 |
+
self.flared_csv = result
|
| 297 |
+
# self.set_component_csv(result)
|
| 298 |
+
# print(f"POPULATED ADDITIONAL TASK TABLE : {result}")
|
| 299 |
+
return result
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
def populate_template_with_units(self, system_prompt = populate_csv):
|
| 303 |
+
# current_form = self.filter_non_empty_answer()
|
| 304 |
+
prompt = f"""
|
| 305 |
+
{system_prompt}
|
| 306 |
+
|
| 307 |
+
# Input:
|
| 308 |
+
## Client Details / Project Requirement Q&A
|
| 309 |
+
{self.get_project_detail()}
|
| 310 |
+
|
| 311 |
+
## Component List
|
| 312 |
+
{self.component_to_text()}
|
| 313 |
+
"""
|
| 314 |
+
|
| 315 |
+
# print(f"\n\populate_template_with_units with prompt: {prompt}\n\n")
|
| 316 |
+
result = call_o1_mini(prompt)
|
| 317 |
+
self.set_component_csv(result)
|
| 318 |
+
# print(f"POPULATED TABLE : {result}")
|
| 319 |
+
return result
|
| 320 |
+
|
| 321 |
+
def populate_template_with_orgranised_qa(self, system_prompt = populate_csv_v2):
|
| 322 |
+
# organised_qa = self.rewrite_qa()
|
| 323 |
+
# current_form = self.filter_non_empty_answer()
|
| 324 |
+
prompt = f"""
|
| 325 |
+
{system_prompt}
|
| 326 |
+
|
| 327 |
+
# Input:
|
| 328 |
+
{self.structured_qa}
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
## Component / Tasks List
|
| 333 |
+
{self.flared_csv}
|
| 334 |
+
"""
|
| 335 |
+
# print(f"\n\populate_template_with_units with prompt: {prompt}\n\n")
|
| 336 |
+
result = call_o1_mini(prompt)
|
| 337 |
+
self.set_component_csv(result)
|
| 338 |
+
# print(f"POPULATED TABLE : {result}")
|
| 339 |
+
return result
|
| 340 |
+
|
| 341 |
+
def additional_tasks(self, system_prompt = missing_task):
|
| 342 |
+
# current_form = self.filter_non_empty_answer()
|
| 343 |
+
prompt = f"""
|
| 344 |
+
{system_prompt}
|
| 345 |
+
|
| 346 |
+
# Input:
|
| 347 |
+
## Client Details / Project Requirement Q&A
|
| 348 |
+
{self.get_project_detail()}
|
| 349 |
+
|
| 350 |
+
## Componet List
|
| 351 |
+
{self.component_csv}
|
| 352 |
+
"""
|
| 353 |
+
|
| 354 |
+
# print(f"\n\ additional_tasks with prompt: {prompt}\n\n")
|
| 355 |
+
result = call_o1_mini(prompt)
|
| 356 |
+
# self.set_component_csv(result)
|
| 357 |
+
# print(f"POPULATED ADDITIONAL TASK TABLE : {result}")
|
| 358 |
+
return result
|
| 359 |
+
|
| 360 |
+
|
| 361 |
+
|
| 362 |
+
|
ProjectClient.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class Client:
|
| 2 |
+
def __init__(self, name, details, industry, project_requirement):
|
| 3 |
+
self.name = name
|
| 4 |
+
self.details = details
|
| 5 |
+
self.industry = industry
|
| 6 |
+
self.project_requirement = project_requirement
|
| 7 |
+
|
| 8 |
+
def __str__(self):
|
| 9 |
+
return f"Client: {self.name}"
|
| 10 |
+
|
| 11 |
+
def __repr__(self):
|
| 12 |
+
return f"Client(name='{self.name}', industry='{self.industry}')"
|
| 13 |
+
|
| 14 |
+
# Example instantiation
|
| 15 |
+
zus_coffee = Client(
|
| 16 |
+
name="Zus Coffee",
|
| 17 |
+
details="A coffee chain based in Malaysia, with 500 outlets, handling both offline and online orders. Sells food, beverages and merchandises",
|
| 18 |
+
industry="Food and Beverage in Malaysia looking to expand internationally",
|
| 19 |
+
project_requirement="Develop a chatbot that provides customer service support, including handling common inquiries, order tracking, menu updates, and resolving customer complaints efficiently."
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
ssm= Client(
|
| 23 |
+
name="SSM",
|
| 24 |
+
details="The Companies Commission of Malaysia (SSM), or Suruhanjaya Syarikat Malaysia, is a statutory body established under the Companies Commission of Malaysia Act 2001 to regulate companies and businesses in Malaysia. Its primary functions include registering businesses, enforcing compliance with the Companies Act 2016, maintaining business and company records, and promoting good corporate governance. SSM also provides public access to company information, supports entrepreneurship through streamlined processes like EzBiz, and fosters ethical business practices. It plays a vital role in ensuring transparency, accountability, and lawful operation of businesses in Malaysia.",
|
| 25 |
+
industry="business and corporate governance sector",
|
| 26 |
+
project_requirement="""The project aims to develop an AI-powered conversational chatbot for the Companies Commission of Malaysia (SSM) to provide accurate and user-friendly support to business owners and prospective entrepreneurs. The chatbot will assist with common queries, such as using the MBRS system, by leveraging a Retrieval-Augmented Generation (RAG) framework to access a comprehensive knowledgebase built from SSM’s existing documentation. This ensures accurate, reliable responses while minimizing hallucinations. Additionally, the system will include an automated data ingestion pipeline to update the knowledgebase whenever documentation changes, ensuring the chatbot remains up-to-date.
|
| 27 |
+
The solution is designed to reduce dependency on human agents by handling repetitive queries, allowing them to focus on more complex issues. It will also be scalable to support nationwide traffic, ensuring accessibility for users of varying technical expertise. This project will enhance customer satisfaction, improve operational efficiency, and future-proof SSM's customer engagement systems with a modern, scalable, and automated platform"""
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
game= Client(
|
| 31 |
+
name="PB Gaming",
|
| 32 |
+
details="The client is a licensed online gaming platform that provides a diverse range of gaming experiences to users worldwide. Their focus is on delivering seamless, engaging, and secure gaming experiences, supported by innovative technologies and exceptional customer service. By integrating advanced solutions, the platform aims to enhance user satisfaction, build loyalty, and maintain operational efficiency while ensuring compliance with industry regulations.",
|
| 33 |
+
industry="online gaming and entertainment sector",
|
| 34 |
+
project_requirement= """The project aims to develop an AI-powered conversational chatbot to act as a humanized customer service agent, enhancing the customer experience while maintaining a lean support team. The chatbot will handle common customer inquiries, such as account issues, game instructions, and troubleshooting, ensuring accurate and consistent responses. If the chatbot is unable to resolve a customer’s issue, it will integrate seamlessly with LiveChat.com for a smooth user agent handover, ensuring uninterrupted support.
|
| 35 |
+
The solution focuses on reducing the need for human agents by automating repetitive tasks, delivering a personalized and consistent experience to users. It will be designed to provide efficient support at scale, meeting the high-demand environment of online gaming. This phase of development will prioritize backend integration with LiveChat.com, enabling real-time escalation for complex issues while ensuring the chatbot serves as a reliable, round-the-clock first point of contact. The project aims to improve operational efficiency, reduce costs, and provide a unified, high-quality support experience for users"""
|
| 36 |
+
)
|
README.md
CHANGED
|
@@ -1,12 +1,6 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji: 🚀
|
| 4 |
-
colorFrom: red
|
| 5 |
-
colorTo: yellow
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 5.9.1
|
| 8 |
app_file: app.py
|
| 9 |
-
|
|
|
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: quotation_chatbot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
app_file: app.py
|
| 4 |
+
sdk: gradio
|
| 5 |
+
sdk_version: 5.7.1
|
| 6 |
---
|
|
|
|
|
|
app.py
ADDED
|
@@ -0,0 +1,753 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from openai import OpenAI
|
| 3 |
+
import json
|
| 4 |
+
import os
|
| 5 |
+
from dotenv import load_dotenv
|
| 6 |
+
from Project import *
|
| 7 |
+
from supabase import create_client, Client
|
| 8 |
+
import psycopg2
|
| 9 |
+
from psycopg2.extras import RealDictCursor
|
| 10 |
+
import tempfile
|
| 11 |
+
import pandas as pd
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
import os
|
| 14 |
+
from io import StringIO
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
load_dotenv()
|
| 19 |
+
api_key = os.getenv("LANGTRACE_API_KEY")
|
| 20 |
+
if api_key is None:
|
| 21 |
+
raise ValueError("Environment variable 'LANGTRACE_API_KEY' is not set. Please set it in your .env file.")
|
| 22 |
+
langtrace.init(api_key=api_key)
|
| 23 |
+
|
| 24 |
+
SUPABASE_URL = os.getenv('SUPABASE_URL')
|
| 25 |
+
SUPABASE_KEY = os.getenv('SUPABASE_KEY')
|
| 26 |
+
DB_NAME = os.getenv('DB_NAME')
|
| 27 |
+
|
| 28 |
+
print(SUPABASE_URL, SUPABASE_KEY, DB_NAME)
|
| 29 |
+
supabase: Client = create_client(SUPABASE_URL, SUPABASE_KEY)
|
| 30 |
+
|
| 31 |
+
def get_db_connection():
|
| 32 |
+
"""Establishes and returns a new database connection."""
|
| 33 |
+
db_params = {
|
| 34 |
+
'dbname': os.getenv('DB_NAME'),
|
| 35 |
+
'user': os.getenv('DB_USER'),
|
| 36 |
+
'password': os.getenv('DB_PASSWORD'),
|
| 37 |
+
'host': os.getenv('DB_HOST'),
|
| 38 |
+
'port': os.getenv('DB_PORT')
|
| 39 |
+
}
|
| 40 |
+
conn = psycopg2.connect(**db_params)
|
| 41 |
+
return conn
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def get_latest_components():
|
| 45 |
+
"""Fetches the latest project rubric for the project 'Engage'."""
|
| 46 |
+
try:
|
| 47 |
+
conn = get_db_connection()
|
| 48 |
+
cur = conn.cursor(cursor_factory=RealDictCursor)
|
| 49 |
+
|
| 50 |
+
cur.execute("""
|
| 51 |
+
SELECT base_project_name,module,submodule,unit_type,quantity,mandays_per_unit
|
| 52 |
+
FROM base_project_component pc
|
| 53 |
+
WHERE (pc.base_project_name, pc.component_version) IN (
|
| 54 |
+
SELECT base_project_name, MAX(component_version)
|
| 55 |
+
FROM base_project_component
|
| 56 |
+
GROUP BY base_project_name
|
| 57 |
+
)
|
| 58 |
+
ORDER BY pc.base_project_name;
|
| 59 |
+
""")
|
| 60 |
+
|
| 61 |
+
component = cur.fetchall()
|
| 62 |
+
cur.close()
|
| 63 |
+
conn.close()
|
| 64 |
+
|
| 65 |
+
return component
|
| 66 |
+
|
| 67 |
+
except Exception as e:
|
| 68 |
+
return {
|
| 69 |
+
'status': 'error',
|
| 70 |
+
'message': str(e)
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def get_section_name_and_rubric_list():
|
| 75 |
+
"""Fetches the latest project rubric for the project 'Engage'."""
|
| 76 |
+
try:
|
| 77 |
+
conn = get_db_connection()
|
| 78 |
+
cur = conn.cursor(cursor_factory=RealDictCursor)
|
| 79 |
+
|
| 80 |
+
cur.execute("""
|
| 81 |
+
SELECT section_name, criteria, initial_question,explanation, priority, quantifiable_value
|
| 82 |
+
FROM base_project_rubric
|
| 83 |
+
WHERE LOWER(base_project_name) = LOWER('Engage')
|
| 84 |
+
AND rubric_version = (
|
| 85 |
+
SELECT MAX(rubric_version)
|
| 86 |
+
FROM base_project_rubric
|
| 87 |
+
WHERE LOWER(base_project_name) = LOWER('Engage')
|
| 88 |
+
)
|
| 89 |
+
ORDER BY
|
| 90 |
+
CASE priority
|
| 91 |
+
WHEN 'high' THEN 1
|
| 92 |
+
WHEN 'med' THEN 2
|
| 93 |
+
WHEN 'low' THEN 3
|
| 94 |
+
ELSE 4
|
| 95 |
+
END;
|
| 96 |
+
""")
|
| 97 |
+
|
| 98 |
+
rubric = cur.fetchall()
|
| 99 |
+
cur.close()
|
| 100 |
+
conn.close()
|
| 101 |
+
|
| 102 |
+
# Convert feedback to a list of dictionaries for JSON serialization
|
| 103 |
+
rubric_list = [dict(row) for row in rubric]
|
| 104 |
+
section_name_list = {row['section_name']: dict(row) for row in rubric}.keys()
|
| 105 |
+
# print(f"in get_section_name_and_rubric_list: {rubric_list}, {section_name_list}")
|
| 106 |
+
print(f"in get_section_name_and_rubric_list: {section_name_list}")
|
| 107 |
+
return section_name_list, rubric_list
|
| 108 |
+
|
| 109 |
+
except Exception as e:
|
| 110 |
+
return {
|
| 111 |
+
'status': 'error',
|
| 112 |
+
'message': str(e)
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
# Initialize project
|
| 116 |
+
# zus_quotation = Project(ProjectType.Engage, zus_coffee, form_v8)
|
| 117 |
+
zus_quotation = Project(ProjectType.Engage)
|
| 118 |
+
|
| 119 |
+
def recalculate_costs(df):
|
| 120 |
+
"""Recalculate costs based on modified dataframe values"""
|
| 121 |
+
try:
|
| 122 |
+
# Convert quantity and mandays_per_unit to numeric, replacing non-numeric values with 0
|
| 123 |
+
df['quantity'] = pd.to_numeric(df['quantity'], errors='coerce').fillna(0)
|
| 124 |
+
df['mandays_per_unit'] = pd.to_numeric(df['mandays_per_unit'], errors='coerce').fillna(0)
|
| 125 |
+
|
| 126 |
+
# Calculate mandays and costs
|
| 127 |
+
df, total_mandays, total_cost = calculate_mandays_and_costs(df)
|
| 128 |
+
csv_string = df.to_csv(index=False)
|
| 129 |
+
# Insert the quotation into the database
|
| 130 |
+
insert_quotation(csv_string, total_cost, total_mandays)
|
| 131 |
+
# df['calculated_mandays'] = df['quantity'] * df['mandays_per_unit']
|
| 132 |
+
# total_mandays = df['calculated_mandays'].sum()
|
| 133 |
+
# total_cost = 1500 * total_mandays
|
| 134 |
+
|
| 135 |
+
# Format output string
|
| 136 |
+
cost_summary = f"""
|
| 137 |
+
Total Mandays: {total_mandays:.2f}
|
| 138 |
+
Total Cost: ${total_cost:,.2f}
|
| 139 |
+
"""
|
| 140 |
+
return df, cost_summary
|
| 141 |
+
except Exception as e:
|
| 142 |
+
return df, f"Error recalculating costs: {str(e)}"
|
| 143 |
+
|
| 144 |
+
def recalculate_costs_v2(df):
|
| 145 |
+
"""Recalculate costs based on modified dataframe values"""
|
| 146 |
+
try:
|
| 147 |
+
# Convert quantity and mandays_per_unit to numeric, replacing non-numeric values with 0
|
| 148 |
+
df['quantity'] = pd.to_numeric(df['quantity'], errors='coerce').fillna(1)
|
| 149 |
+
df['mandays_per_unit'] = pd.to_numeric(df['mandays_per_unit'], errors='coerce').fillna(0)
|
| 150 |
+
|
| 151 |
+
# Calculate mandays and costs
|
| 152 |
+
df, total_mandays, total_cost = calculate_mandays_and_costs(df)
|
| 153 |
+
|
| 154 |
+
csv_string = df.to_csv(index=False)
|
| 155 |
+
# Insert the quotation into the database
|
| 156 |
+
insert_quotation(csv_string, total_cost, total_mandays)
|
| 157 |
+
# df['calculated_mandays'] = df['quantity'] * df['mandays_per_unit']
|
| 158 |
+
# total_mandays = df['calculated_mandays'].sum()
|
| 159 |
+
# total_cost = 1500 * total_mandays
|
| 160 |
+
|
| 161 |
+
# Format output string
|
| 162 |
+
cost_summary = f"""
|
| 163 |
+
Total Mandays: {total_mandays:.2f}
|
| 164 |
+
Total Cost: ${total_cost:,.2f}
|
| 165 |
+
"""
|
| 166 |
+
return df, f"Successfully Updated Quotation. SessionID:{zus_quotation.session_id}", cost_summary
|
| 167 |
+
except Exception as e:
|
| 168 |
+
return df, f"Error recalculating costs: {str(e)}"
|
| 169 |
+
|
| 170 |
+
def recalculate_costs_v3(quantity_df,task_df):
|
| 171 |
+
"""Recalculate costs based on modified dataframe values"""
|
| 172 |
+
try:
|
| 173 |
+
# Convert quantity and mandays_per_unit to numeric, replacing non-numeric values with 0
|
| 174 |
+
quantity_df['quantity'] = pd.to_numeric(quantity_df['quantity'], errors='coerce').fillna(1)
|
| 175 |
+
quantity_df['mandays_per_unit'] = pd.to_numeric(quantity_df['mandays_per_unit'], errors='coerce').fillna(0)
|
| 176 |
+
|
| 177 |
+
# Calculate mandays and costs
|
| 178 |
+
quantity_df, total_mandays, total_cost = calculate_mandays_and_costs(quantity_df)
|
| 179 |
+
|
| 180 |
+
csv_string = quantity_df.to_csv(index=False)
|
| 181 |
+
task_string = task_df.to_csv(index=False)
|
| 182 |
+
# Insert the quotation into the database
|
| 183 |
+
insert_quotation(csv_string, total_cost, total_mandays, details= task_string)
|
| 184 |
+
# df['calculated_mandays'] = df['quantity'] * df['mandays_per_unit']
|
| 185 |
+
# total_mandays = df['calculated_mandays'].sum()
|
| 186 |
+
# total_cost = 1500 * total_mandays
|
| 187 |
+
# Format output string
|
| 188 |
+
cost_summary = f"""
|
| 189 |
+
Total Mandays: {total_mandays:.2f}
|
| 190 |
+
Total Cost: ${total_cost:,.2f}
|
| 191 |
+
"""
|
| 192 |
+
return quantity_df, f"Successfully Updated Quotation. SessionID:{zus_quotation.session_id}", cost_summary
|
| 193 |
+
except Exception as e:
|
| 194 |
+
return quantity_df, f"Error recalculating costs: {str(e)}"
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def sanitize_text(text):
|
| 198 |
+
"""Remove or replace special characters from text"""
|
| 199 |
+
# Replace single quotes with double quotes to avoid string formatting issues
|
| 200 |
+
text = text.replace("'", '')
|
| 201 |
+
# Remove or replace other problematic characters as needed
|
| 202 |
+
# Add more replacements here if needed
|
| 203 |
+
return text
|
| 204 |
+
|
| 205 |
+
def process_response(answer, history):
|
| 206 |
+
"""Process user responses and generate appropriate follow-up questions."""
|
| 207 |
+
try:
|
| 208 |
+
# Convert history to list if it's not already
|
| 209 |
+
if not isinstance(history, list):
|
| 210 |
+
history = []
|
| 211 |
+
|
| 212 |
+
# Sanitize the answer before processing
|
| 213 |
+
sanitized_answer = sanitize_text(str(answer))
|
| 214 |
+
|
| 215 |
+
# Add the user's answer to project details
|
| 216 |
+
zus_quotation.add_project_detail(sanitized_answer)
|
| 217 |
+
|
| 218 |
+
# Update session in database if we have a session_id
|
| 219 |
+
if zus_quotation.session_id:
|
| 220 |
+
try:
|
| 221 |
+
conn = get_db_connection()
|
| 222 |
+
cur = conn.cursor()
|
| 223 |
+
|
| 224 |
+
# Update project_requirement in sessions table
|
| 225 |
+
cur.execute("""
|
| 226 |
+
UPDATE sessions
|
| 227 |
+
SET project_requirement = %s
|
| 228 |
+
WHERE session_id = %s
|
| 229 |
+
""", (json.dumps(zus_quotation.project_detail), zus_quotation.session_id))
|
| 230 |
+
|
| 231 |
+
conn.commit()
|
| 232 |
+
cur.close()
|
| 233 |
+
conn.close()
|
| 234 |
+
except Exception as e:
|
| 235 |
+
print(f"Error updating session: {str(e)}")
|
| 236 |
+
|
| 237 |
+
# Generate next question based on conversation stage
|
| 238 |
+
if len(history) == 1: # After first client information question
|
| 239 |
+
next_question = zus_quotation.generate_client_follow_up()
|
| 240 |
+
elif len(history) == 2: # After client follow-up
|
| 241 |
+
next_question = zus_quotation.generate_questions()
|
| 242 |
+
else: # Subsequent project requirements questions
|
| 243 |
+
next_question = zus_quotation.generate_follow_up()
|
| 244 |
+
|
| 245 |
+
# Ensure we're adding a proper tuple to history
|
| 246 |
+
if isinstance(answer, str) and isinstance(next_question, str):
|
| 247 |
+
history.append((answer, next_question))
|
| 248 |
+
|
| 249 |
+
return history, next_question
|
| 250 |
+
except Exception as e:
|
| 251 |
+
print(f"Error in process_response: {str(e)}")
|
| 252 |
+
return history, "Error in generating follow up questions"
|
| 253 |
+
|
| 254 |
+
def map_mandays(df):
|
| 255 |
+
mandays_dict = zus_quotation.get_component_mandays()
|
| 256 |
+
# Create a mapping dictionary from mandays_dict
|
| 257 |
+
mandays_mapping = {
|
| 258 |
+
item['submodule']: item['mandays_per_unit']
|
| 259 |
+
for item in mandays_dict
|
| 260 |
+
if item['submodule']
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
# Initialize mandays_per_unit and remarks columns
|
| 264 |
+
df['mandays_per_unit'] = 0.0
|
| 265 |
+
df['remarks'] = ''
|
| 266 |
+
|
| 267 |
+
# Map mandays_per_unit and add remarks
|
| 268 |
+
for idx, row in df.iterrows():
|
| 269 |
+
submodule = row['submodule']
|
| 270 |
+
if submodule in mandays_mapping:
|
| 271 |
+
df.at[idx, 'mandays_per_unit'] = float(mandays_mapping[submodule] or 0)
|
| 272 |
+
else:
|
| 273 |
+
df.at[idx, 'remarks'] = 'Mandays estimation needed - submodule not found in reference data'
|
| 274 |
+
df.at[idx, 'mandays_per_unit'] = 0.5 # Default value
|
| 275 |
+
|
| 276 |
+
return df
|
| 277 |
+
|
| 278 |
+
def calculate_mandays_and_costs(df):
|
| 279 |
+
try:
|
| 280 |
+
# df['mandays_per_unit'] = pd.to_numeric(df['mandays_per_unit'].replace('', '0'), errors='coerce').fillna(0)
|
| 281 |
+
# Calculate mandays and costs
|
| 282 |
+
df['calculated_mandays'] = df['quantity'] * df['mandays_per_unit']
|
| 283 |
+
total_mandays = df['calculated_mandays'].sum()
|
| 284 |
+
total_cost = 1500 * total_mandays
|
| 285 |
+
return df, total_mandays, total_cost
|
| 286 |
+
except Exception as e:
|
| 287 |
+
print(f"Error calculating mandays and costs: {str(e)}")
|
| 288 |
+
return None, None, None
|
| 289 |
+
|
| 290 |
+
|
| 291 |
+
def generate_csv_v1():
|
| 292 |
+
"""Generate CSV file with calculated mandays and costs"""
|
| 293 |
+
try:
|
| 294 |
+
# Get CSV string from quotation
|
| 295 |
+
csv_string = zus_quotation.populate_template_with_units()
|
| 296 |
+
|
| 297 |
+
# Create DataFrame from CSV string
|
| 298 |
+
df = pd.read_csv(StringIO(csv_string))
|
| 299 |
+
|
| 300 |
+
# Convert quantity and mandays_per_unit to numeric, replacing empty strings and errors with 0
|
| 301 |
+
df['quantity'] = pd.to_numeric(df['quantity'].replace('', '0'), errors='coerce').fillna(0)
|
| 302 |
+
df = map_mandays(df)
|
| 303 |
+
df, total_mandays, total_cost = calculate_mandays_and_costs(df)
|
| 304 |
+
csv_string = df.to_csv(index=False)
|
| 305 |
+
# Insert the quotation into the database
|
| 306 |
+
insert_quotation(csv_string, total_cost, total_mandays)
|
| 307 |
+
|
| 308 |
+
# Format output string
|
| 309 |
+
cost_summary = f"""
|
| 310 |
+
Total Mandays: {total_mandays:.2f}
|
| 311 |
+
Total Cost: ${total_cost:,.2f}
|
| 312 |
+
"""
|
| 313 |
+
return df, cost_summary
|
| 314 |
+
|
| 315 |
+
except Exception as e:
|
| 316 |
+
return None, f"Error generating CSV: {str(e)}"
|
| 317 |
+
|
| 318 |
+
def generate_csv_v2(progress=gr.Progress()):
|
| 319 |
+
# Step 1: Rewrite QA
|
| 320 |
+
progress(0.33, desc="Step 1: Rewriting QA...")
|
| 321 |
+
structured_qa_result = zus_quotation.rewrite_qa()
|
| 322 |
+
|
| 323 |
+
# Step 2: Flare Tasks
|
| 324 |
+
progress(0.66, desc="Step 2: Calling flare tasks...")
|
| 325 |
+
flare_tasks_result = zus_quotation.flare_tasks()
|
| 326 |
+
|
| 327 |
+
df = pd.read_csv(StringIO(flare_tasks_result))
|
| 328 |
+
df['quantity'] = pd.to_numeric(df['quantity'].replace('', '1'), errors='coerce').fillna(1)
|
| 329 |
+
df['mandays_per_unit'] = pd.to_numeric(df['mandays_per_unit'].replace('', '0'), errors='coerce').fillna(0)
|
| 330 |
+
df, total_mandays, total_cost = calculate_mandays_and_costs(df)
|
| 331 |
+
csv_string = df.to_csv(index=False)
|
| 332 |
+
|
| 333 |
+
insert_quotation(csv_string, total_cost, total_mandays)
|
| 334 |
+
|
| 335 |
+
progress(1.0, desc="Complete!")
|
| 336 |
+
return [df, "Process completed!", f"total_man_days: {total_mandays}\n total_costs:{total_cost}"]
|
| 337 |
+
|
| 338 |
+
def generate_csv_v3(progress=gr.Progress()):
|
| 339 |
+
# Step 1: Rewrite QA
|
| 340 |
+
progress(0, desc="Step 1: Rewriting QA...")
|
| 341 |
+
structured_qa_result = zus_quotation.rewrite_qa()
|
| 342 |
+
|
| 343 |
+
# Step 2: Flare Tasks
|
| 344 |
+
progress(0.33, desc="Step 2: Calling flare tasks...")
|
| 345 |
+
flare_tasks_result = zus_quotation.flare_tasks(flare_task_quotationv3)
|
| 346 |
+
|
| 347 |
+
# Step 3: Populate Template with Flared Task
|
| 348 |
+
progress(0.66, desc="Step 3: Populating quantity...")
|
| 349 |
+
organized_qa_result = zus_quotation.populate_template_with_orgranised_qa()
|
| 350 |
+
task_breakdown_df = pd.read_csv(StringIO(flare_tasks_result))
|
| 351 |
+
quantity_df = pd.read_csv(StringIO(organized_qa_result))
|
| 352 |
+
|
| 353 |
+
# df['quantity'] = pd.to_numeric(df['quantity'].replace('', '1'), errors='coerce').fillna(1)
|
| 354 |
+
# df['mandays_per_unit'] = pd.to_numeric(df['mandays_per_unit'].replace('', '0'), errors='coerce').fillna(0)
|
| 355 |
+
# df, total_mandays, total_cost = calculate_mandays_and_costs(df)
|
| 356 |
+
# csv_string = df.to_csv(index=False)
|
| 357 |
+
|
| 358 |
+
# insert_quotation(csv_string, total_cost, total_mandays)
|
| 359 |
+
|
| 360 |
+
progress(1.0, desc="Complete!")
|
| 361 |
+
return [task_breakdown_df,quantity_df, "Process completed!", "total_man_days: {total_mandays}\n total_costs:{total_cost}"]
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
def create_new_session():
|
| 365 |
+
"""Create a new session in the database and return the session_id"""
|
| 366 |
+
try:
|
| 367 |
+
conn = get_db_connection()
|
| 368 |
+
cur = conn.cursor()
|
| 369 |
+
|
| 370 |
+
# Insert new session with start time
|
| 371 |
+
cur.execute("""
|
| 372 |
+
INSERT INTO sessions (start_time)
|
| 373 |
+
VALUES (CURRENT_TIMESTAMP)
|
| 374 |
+
RETURNING session_id
|
| 375 |
+
""")
|
| 376 |
+
|
| 377 |
+
session_id = cur.fetchone()[0]
|
| 378 |
+
|
| 379 |
+
# Insert session_base_project record for "Engage"
|
| 380 |
+
cur.execute("""
|
| 381 |
+
INSERT INTO session_base_project (session_id, base_project_name)
|
| 382 |
+
VALUES (%s, 'Engage')
|
| 383 |
+
""", (session_id,))
|
| 384 |
+
|
| 385 |
+
conn.commit()
|
| 386 |
+
cur.close()
|
| 387 |
+
conn.close()
|
| 388 |
+
|
| 389 |
+
return session_id
|
| 390 |
+
except Exception as e:
|
| 391 |
+
print(f"Error creating new session: {str(e)}")
|
| 392 |
+
return None
|
| 393 |
+
|
| 394 |
+
def start_chat():
|
| 395 |
+
"""Initialize chat with first question and create new session"""
|
| 396 |
+
# Create new session and get session_id
|
| 397 |
+
session_id = create_new_session()
|
| 398 |
+
|
| 399 |
+
# Set the rubric and session_id for the project
|
| 400 |
+
section_name_list, rubric_list = get_section_name_and_rubric_list()
|
| 401 |
+
component_list = get_latest_components()
|
| 402 |
+
|
| 403 |
+
# Update session_id in Project instance
|
| 404 |
+
zus_quotation.session_id = session_id
|
| 405 |
+
|
| 406 |
+
zus_quotation.set_rubric(rubric_list)
|
| 407 |
+
zus_quotation.set_rubric_section_names(section_name_list)
|
| 408 |
+
zus_quotation.set_component_list(component_list)
|
| 409 |
+
|
| 410 |
+
initial_history = [(None, client_initial_question)]
|
| 411 |
+
return client_initial_question, initial_history
|
| 412 |
+
|
| 413 |
+
def refresh_components():
|
| 414 |
+
"""Refresh component list and update quotation"""
|
| 415 |
+
component_list = get_latest_components()
|
| 416 |
+
zus_quotation.set_component_list(component_list)
|
| 417 |
+
print("successfully updated components list")
|
| 418 |
+
# Generate new CSV to reflect updated components
|
| 419 |
+
return
|
| 420 |
+
|
| 421 |
+
def get_project_state():
|
| 422 |
+
"""Get current state of zus_quotation project"""
|
| 423 |
+
# Create status boxes
|
| 424 |
+
status = f"""Session ID: {zus_quotation.session_id}
|
| 425 |
+
Rubric Loaded: {bool(zus_quotation.rubric)}
|
| 426 |
+
Components Loaded: {bool(zus_quotation.component_list)}
|
| 427 |
+
Requirements Loaded: {bool(zus_quotation.project_detail)}"""
|
| 428 |
+
|
| 429 |
+
# Format requirements as a table if they exist
|
| 430 |
+
requirements_table = ""
|
| 431 |
+
if zus_quotation.project_detail:
|
| 432 |
+
print(f"\n\nrequirements : {type(zus_quotation.project_detail)}")
|
| 433 |
+
# Create markdown box for requirements
|
| 434 |
+
# requirements_table = "\n\n### Project Requirements\n```markdown\n"
|
| 435 |
+
for index,requirement in enumerate(list(zus_quotation.project_detail)):
|
| 436 |
+
requirements_table += f"\n_____________\n"
|
| 437 |
+
requirements_table += f"#Requirement {index+1}\n {requirement}"
|
| 438 |
+
|
| 439 |
+
return status, requirements_table
|
| 440 |
+
|
| 441 |
+
def fetch_session(session_id):
|
| 442 |
+
"""Fetch session details from database and initialize project state"""
|
| 443 |
+
try:
|
| 444 |
+
# 1. Fetch session details
|
| 445 |
+
conn = get_db_connection()
|
| 446 |
+
cur = conn.cursor(cursor_factory=RealDictCursor)
|
| 447 |
+
|
| 448 |
+
cur.execute("""
|
| 449 |
+
SELECT project_requirement, start_time
|
| 450 |
+
FROM sessions
|
| 451 |
+
WHERE session_id = %s
|
| 452 |
+
""", (session_id,))
|
| 453 |
+
|
| 454 |
+
session = cur.fetchone()
|
| 455 |
+
cur.close()
|
| 456 |
+
conn.close()
|
| 457 |
+
|
| 458 |
+
print(session)
|
| 459 |
+
if session:
|
| 460 |
+
# 2. Update zus_quotation with session data
|
| 461 |
+
zus_quotation.session_id = session_id
|
| 462 |
+
|
| 463 |
+
# Set project requirements if they exist
|
| 464 |
+
if session['project_requirement']:
|
| 465 |
+
try:
|
| 466 |
+
# Check if the project requirement is a string
|
| 467 |
+
if isinstance(session['project_requirement'], str):
|
| 468 |
+
# Attempt to parse it as JSON
|
| 469 |
+
try:
|
| 470 |
+
requirements = json.loads(session['project_requirement'])
|
| 471 |
+
except json.JSONDecodeError:
|
| 472 |
+
# If JSON parsing fails, split the string into a list
|
| 473 |
+
requirements = session['project_requirement'].split('\n') # or use another delimiter if needed
|
| 474 |
+
else:
|
| 475 |
+
requirements = session['project_requirement']
|
| 476 |
+
|
| 477 |
+
# Clear existing details and set new ones
|
| 478 |
+
zus_quotation.project_detail = []
|
| 479 |
+
for requirement in requirements:
|
| 480 |
+
zus_quotation.add_project_detail(requirement.strip()) # Use strip() to remove any leading/trailing whitespace
|
| 481 |
+
except Exception as e:
|
| 482 |
+
return "", "", f"Error processing project requirements in session {session_id}: {str(e)}"
|
| 483 |
+
|
| 484 |
+
# 3. Fetch and set rubric
|
| 485 |
+
section_name_list, rubric_list = get_section_name_and_rubric_list()
|
| 486 |
+
zus_quotation.set_rubric(rubric_list)
|
| 487 |
+
zus_quotation.set_rubric_section_names(section_name_list)
|
| 488 |
+
|
| 489 |
+
# 4. Fetch and set components
|
| 490 |
+
component_list = get_latest_components()
|
| 491 |
+
zus_quotation.set_component_list(component_list)
|
| 492 |
+
|
| 493 |
+
return (*get_project_state(), f"Successfully loaded session {session_id} with all data")
|
| 494 |
+
# "\n".join(rubric_list), # Return rubric list as a string
|
| 495 |
+
# component_list) # Ensure to extract string values
|
| 496 |
+
|
| 497 |
+
else:
|
| 498 |
+
return "", "", f"Session {session_id} not found"
|
| 499 |
+
# return "", "", f"Session {session_id} not found", "", ""
|
| 500 |
+
|
| 501 |
+
except Exception as e:
|
| 502 |
+
return "", "", f"Error fetching session: {str(e)}",
|
| 503 |
+
# return "", "", f"Error fetching session: {str(e)}", "", ""
|
| 504 |
+
|
| 505 |
+
def insert_quotation(csv_string, total_price, total_mandays, note=None, details = None, tier_level=1):
|
| 506 |
+
"""Insert a new quotation into the database with an updated version."""
|
| 507 |
+
try:
|
| 508 |
+
conn = get_db_connection()
|
| 509 |
+
cur = conn.cursor()
|
| 510 |
+
|
| 511 |
+
# Fetch the current maximum version for the given session_id
|
| 512 |
+
cur.execute("""
|
| 513 |
+
SELECT COALESCE(MAX(version), 0) + 1
|
| 514 |
+
FROM quotations
|
| 515 |
+
WHERE session_id = %s
|
| 516 |
+
""", (zus_quotation.session_id,))
|
| 517 |
+
|
| 518 |
+
result = cur.fetchone()
|
| 519 |
+
version = result[0] if result else 1 # Default to version 1 if no result
|
| 520 |
+
# Get the next version number
|
| 521 |
+
total_price = float(total_price) if total_price is not None else None
|
| 522 |
+
total_mandays = float(total_mandays) if total_mandays is not None else None
|
| 523 |
+
|
| 524 |
+
details = f"{json.dumps(zus_quotation.project_detail)} + {details}" if details else json.dumps(zus_quotation.project_detail)
|
| 525 |
+
|
| 526 |
+
# Insert new quotation
|
| 527 |
+
cur.execute("""
|
| 528 |
+
INSERT INTO quotations (session_id, version, details, quotation_csv, total_price, total_mandays)
|
| 529 |
+
VALUES (%s, %s, %s, %s, %s, %s)
|
| 530 |
+
""", (
|
| 531 |
+
zus_quotation.session_id,
|
| 532 |
+
version,
|
| 533 |
+
details, # Convert project details to JSON string
|
| 534 |
+
csv_string,
|
| 535 |
+
total_price,
|
| 536 |
+
total_mandays
|
| 537 |
+
))
|
| 538 |
+
|
| 539 |
+
conn.commit()
|
| 540 |
+
cur.close()
|
| 541 |
+
conn.close()
|
| 542 |
+
|
| 543 |
+
print("Successfully inserted quotation")
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
except Exception as e:
|
| 547 |
+
print(f"Error inserting quotation: {str(e)}")
|
| 548 |
+
|
| 549 |
+
def save_csv(df):
|
| 550 |
+
"""Save the DataFrame as a CSV file."""
|
| 551 |
+
if df is not None:
|
| 552 |
+
csv_file_path = "task_list.csv" # Specify your desired file path
|
| 553 |
+
df.to_csv(csv_file_path, index=False)
|
| 554 |
+
print(f"CSV saved to {csv_file_path}")
|
| 555 |
+
return f"CSV saved to {csv_file_path}"
|
| 556 |
+
return "No data to save."
|
| 557 |
+
|
| 558 |
+
|
| 559 |
+
def save_csv_v3(df, df2):
|
| 560 |
+
"""Save the DataFrame as a CSV file."""
|
| 561 |
+
retval = ""
|
| 562 |
+
if df is not None :
|
| 563 |
+
csv_file_path = "task_list.csv" # Specify your desired file path
|
| 564 |
+
df.to_csv(csv_file_path, index=False)
|
| 565 |
+
retval += f"Task CSV saved to {csv_file_path}\n"
|
| 566 |
+
if df2 is not None :
|
| 567 |
+
quantity_file_path = "quantity_list.csv" # Specify your desired file path
|
| 568 |
+
df2.to_csv(quantity_file_path, index=False)
|
| 569 |
+
retval += f"Task CSV saved to {quantity_file_path}\n"
|
| 570 |
+
|
| 571 |
+
with open("project_requirement.txt", "w") as file:
|
| 572 |
+
file.write(zus_quotation.structured_qa)
|
| 573 |
+
retval += f"Project Requirement saved to project_requirement.txt"
|
| 574 |
+
|
| 575 |
+
if retval:
|
| 576 |
+
return retval
|
| 577 |
+
return "No data to save."
|
| 578 |
+
|
| 579 |
+
|
| 580 |
+
gr.set_static_paths(["temp/"])
|
| 581 |
+
with gr.Blocks(title="Requirements Gathering Chatbot") as demo:
|
| 582 |
+
gr.Markdown("# Requirements Gathering Assistant")
|
| 583 |
+
gr.Markdown("This chatbot will help gather detailed requirements for your project.")
|
| 584 |
+
|
| 585 |
+
with gr.Tab(label= "Main"):
|
| 586 |
+
with gr.Row():
|
| 587 |
+
start_btn = gr.Button("Start New Session")
|
| 588 |
+
clear_btn = gr.Button("Clear")
|
| 589 |
+
|
| 590 |
+
with gr.Row():
|
| 591 |
+
with gr.Row():
|
| 592 |
+
chatbot = gr.Chatbot(height=510)
|
| 593 |
+
with gr.Column():
|
| 594 |
+
current_question = gr.Textbox(label="Edit Area", lines= 20)
|
| 595 |
+
with gr.Row():
|
| 596 |
+
submit_btn = gr.Button("Submit")
|
| 597 |
+
|
| 598 |
+
with gr.Tab(label= "Quotation Generator V1"):
|
| 599 |
+
with gr.Row():
|
| 600 |
+
# current_question = gr.Textbox(label="Edit Area", lines= 15)
|
| 601 |
+
# score_display = gr.Textbox(label="Progress", interactive=False)
|
| 602 |
+
with gr.Column(scale = 4):
|
| 603 |
+
units_table_v1 = gr.Dataframe(interactive=True, col_count=7) # New table component
|
| 604 |
+
|
| 605 |
+
with gr.Column(scale = 1):
|
| 606 |
+
generate_btn_v1 = gr.Button("Generate Quotation V1") # New button
|
| 607 |
+
units_output_v1 = gr.Textbox(label="Cost Summary", lines=3, interactive=False)
|
| 608 |
+
recalc_btn_v1 = gr.Button("Recalculate") # New recalculate button
|
| 609 |
+
# refresh_components_btn = gr.Button("Get Latest Component List") # New refresh button
|
| 610 |
+
|
| 611 |
+
with gr.Tab(label= "Quotation Generator V2"):
|
| 612 |
+
gr.Markdown("#Logic : Rewrites Project Requirement -> Flare Task,Quantity,Mandays -> Calculate")
|
| 613 |
+
gr.Markdown("#No sessions, CSV download pending")
|
| 614 |
+
|
| 615 |
+
with gr.Row():
|
| 616 |
+
# current_question = gr.Textbox(label="Edit Area", lines= 15)
|
| 617 |
+
# score_display = gr.Textbox(label="Progress", interactive=False)
|
| 618 |
+
with gr.Column(scale = 4):
|
| 619 |
+
units_table_v2 = gr.Dataframe(interactive=True, col_count=7) # New table component
|
| 620 |
+
|
| 621 |
+
with gr.Column(scale = 1):
|
| 622 |
+
generate_btn_v2 = gr.Button("Generate Task List V2") # New button
|
| 623 |
+
units_output_v2 = gr.Textbox(label="Cost Summary", lines=3, interactive=False)
|
| 624 |
+
progress_update = gr.Textbox(label="Progress Update", lines=2, interactive=False)
|
| 625 |
+
recalc_btn_v2 = gr.Button("Recalculate") # New recalculate button
|
| 626 |
+
save_csv_btn = gr.Button("Save CSV") # New Save CSV button
|
| 627 |
+
# refresh_components_btn = gr.Button("Get Latest Component List") # New refresh button
|
| 628 |
+
|
| 629 |
+
with gr.Tab(label= "Quotation Generator V3"):
|
| 630 |
+
gr.Markdown("# Logic : Rewrites Project Requirement -> Flare Task,Mandays -> Identify Quantity & Remarks -> Calculate")
|
| 631 |
+
#pending Gap Report
|
| 632 |
+
with gr.Row():
|
| 633 |
+
with gr.Column(scale=4):
|
| 634 |
+
|
| 635 |
+
gr.Markdown("# Task Breakdown Table")
|
| 636 |
+
tasks_table_v3 = gr.Dataframe(interactive=True, col_count=7) # New table component
|
| 637 |
+
gr.Markdown("# Inferred Quantity Table")
|
| 638 |
+
quantity_table_v3 = gr.Dataframe(interactive=True, col_count=7) # New table component
|
| 639 |
+
|
| 640 |
+
with gr.Column(scale=1):
|
| 641 |
+
generate_btn_v3 = gr.Button("Generate Task List V3") # New button
|
| 642 |
+
units_output_v3 = gr.Textbox(label="Cost Summary", lines=3, interactive=False)
|
| 643 |
+
units_output_v3 = gr.Textbox(label="Cost Summary", lines=3, interactive=False)
|
| 644 |
+
progress_update_v3 = gr.Textbox(label="Progress Update", lines=2, interactive=False)
|
| 645 |
+
recalc_btn_v3 = gr.Button("Recalculate") # New recalculate button
|
| 646 |
+
save_csv_btn_v3 = gr.Button("Save CSV") # New Save CSV button
|
| 647 |
+
|
| 648 |
+
generate_btn_v3.click(
|
| 649 |
+
fn=generate_csv_v3, # Assuming the same function is used
|
| 650 |
+
outputs=[tasks_table_v3,quantity_table_v3, progress_update_v3, units_output_v3]
|
| 651 |
+
)
|
| 652 |
+
|
| 653 |
+
recalc_btn_v3.click(
|
| 654 |
+
fn=recalculate_costs_v3, # Assuming the same function is used
|
| 655 |
+
inputs=[quantity_table_v3,tasks_table_v3],
|
| 656 |
+
outputs=[quantity_table_v3,progress_update_v3, units_output_v3]
|
| 657 |
+
)
|
| 658 |
+
|
| 659 |
+
save_csv_btn_v3.click(
|
| 660 |
+
fn=save_csv_v3,
|
| 661 |
+
inputs=[tasks_table_v3,quantity_table_v3],
|
| 662 |
+
outputs=progress_update_v3
|
| 663 |
+
)
|
| 664 |
+
|
| 665 |
+
# save_csv_btn_v3.click(
|
| 666 |
+
# fn=save_csv,
|
| 667 |
+
# inputs=tasks_table_v3,
|
| 668 |
+
# outputs=progress_update_v3
|
| 669 |
+
# )
|
| 670 |
+
|
| 671 |
+
# Replace single textbox with separate components
|
| 672 |
+
with gr.Tab(label= "Project Status"):
|
| 673 |
+
with gr.Row():
|
| 674 |
+
session_input = gr.Number(label="Session ID", precision=0)
|
| 675 |
+
message_box = gr.Textbox(label="Message", interactive=False)
|
| 676 |
+
status_box = gr.Textbox(
|
| 677 |
+
label="Project Status",
|
| 678 |
+
value="",
|
| 679 |
+
interactive=False
|
| 680 |
+
)
|
| 681 |
+
fetch_btn = gr.Button("Fetch Session")
|
| 682 |
+
|
| 683 |
+
with gr.Tab(label= "Requirement"):
|
| 684 |
+
fetched_requirements_box = gr.Markdown(
|
| 685 |
+
value=""
|
| 686 |
+
)
|
| 687 |
+
|
| 688 |
+
# Event handlers
|
| 689 |
+
start_btn.click(
|
| 690 |
+
fn=lambda: (*start_chat(), *get_project_state()),
|
| 691 |
+
outputs=[current_question, chatbot, status_box, fetched_requirements_box]
|
| 692 |
+
)
|
| 693 |
+
|
| 694 |
+
submit_btn.click(
|
| 695 |
+
fn=lambda answer, history: (*process_response(answer, history), *get_project_state()),
|
| 696 |
+
inputs=[current_question, chatbot],
|
| 697 |
+
outputs=[chatbot, current_question, status_box, fetched_requirements_box]
|
| 698 |
+
)
|
| 699 |
+
|
| 700 |
+
|
| 701 |
+
|
| 702 |
+
clear_btn.click(
|
| 703 |
+
fn=lambda: ([], ""),
|
| 704 |
+
outputs=[chatbot, current_question]
|
| 705 |
+
)
|
| 706 |
+
|
| 707 |
+
generate_btn_v1.click(
|
| 708 |
+
fn=generate_csv_v1,
|
| 709 |
+
outputs=[units_table_v1, units_output_v1]
|
| 710 |
+
)
|
| 711 |
+
|
| 712 |
+
recalc_btn_v1.click(
|
| 713 |
+
fn=recalculate_costs,
|
| 714 |
+
inputs=[units_table_v1],
|
| 715 |
+
outputs=[units_table_v1, units_output_v1]
|
| 716 |
+
)
|
| 717 |
+
|
| 718 |
+
# refresh_components_btn.click(
|
| 719 |
+
# fn=refresh_components
|
| 720 |
+
# )
|
| 721 |
+
|
| 722 |
+
fetch_btn.click(
|
| 723 |
+
fn=fetch_session,
|
| 724 |
+
inputs=[session_input],
|
| 725 |
+
outputs=[status_box, fetched_requirements_box, message_box]
|
| 726 |
+
# outputs=[status_box, fetched_requirements_box, message_box, fetched_rubric_box, fetched_component_box]
|
| 727 |
+
)
|
| 728 |
+
# Update the button to call the new function
|
| 729 |
+
generate_btn_v2.click(
|
| 730 |
+
generate_csv_v2,
|
| 731 |
+
outputs=[units_table_v2, progress_update,units_output_v2]
|
| 732 |
+
)
|
| 733 |
+
|
| 734 |
+
recalc_btn_v2.click(
|
| 735 |
+
fn=recalculate_costs_v2,
|
| 736 |
+
inputs=[units_table_v2],
|
| 737 |
+
outputs=[units_table_v2, progress_update,units_output_v2]
|
| 738 |
+
)
|
| 739 |
+
|
| 740 |
+
# save_csv_btn.click(
|
| 741 |
+
# fn=save_csv,
|
| 742 |
+
# inputs=units_table_v2,
|
| 743 |
+
# outputs=progress_update
|
| 744 |
+
# )
|
| 745 |
+
save_csv_btn.click(
|
| 746 |
+
fn=save_csv,
|
| 747 |
+
inputs=tasks_table_v3,
|
| 748 |
+
outputs=progress_update
|
| 749 |
+
)
|
| 750 |
+
if __name__ == "__main__":
|
| 751 |
+
# Assign interface to demo for hot reloading
|
| 752 |
+
demo.launch(share=True)
|
| 753 |
+
# print(get_latest_components())
|
myenv/bin/Activate.ps1
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<#
|
| 2 |
+
.Synopsis
|
| 3 |
+
Activate a Python virtual environment for the current PowerShell session.
|
| 4 |
+
|
| 5 |
+
.Description
|
| 6 |
+
Pushes the python executable for a virtual environment to the front of the
|
| 7 |
+
$Env:PATH environment variable and sets the prompt to signify that you are
|
| 8 |
+
in a Python virtual environment. Makes use of the command line switches as
|
| 9 |
+
well as the `pyvenv.cfg` file values present in the virtual environment.
|
| 10 |
+
|
| 11 |
+
.Parameter VenvDir
|
| 12 |
+
Path to the directory that contains the virtual environment to activate. The
|
| 13 |
+
default value for this is the parent of the directory that the Activate.ps1
|
| 14 |
+
script is located within.
|
| 15 |
+
|
| 16 |
+
.Parameter Prompt
|
| 17 |
+
The prompt prefix to display when this virtual environment is activated. By
|
| 18 |
+
default, this prompt is the name of the virtual environment folder (VenvDir)
|
| 19 |
+
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
| 20 |
+
|
| 21 |
+
.Example
|
| 22 |
+
Activate.ps1
|
| 23 |
+
Activates the Python virtual environment that contains the Activate.ps1 script.
|
| 24 |
+
|
| 25 |
+
.Example
|
| 26 |
+
Activate.ps1 -Verbose
|
| 27 |
+
Activates the Python virtual environment that contains the Activate.ps1 script,
|
| 28 |
+
and shows extra information about the activation as it executes.
|
| 29 |
+
|
| 30 |
+
.Example
|
| 31 |
+
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
| 32 |
+
Activates the Python virtual environment located in the specified location.
|
| 33 |
+
|
| 34 |
+
.Example
|
| 35 |
+
Activate.ps1 -Prompt "MyPython"
|
| 36 |
+
Activates the Python virtual environment that contains the Activate.ps1 script,
|
| 37 |
+
and prefixes the current prompt with the specified string (surrounded in
|
| 38 |
+
parentheses) while the virtual environment is active.
|
| 39 |
+
|
| 40 |
+
.Notes
|
| 41 |
+
On Windows, it may be required to enable this Activate.ps1 script by setting the
|
| 42 |
+
execution policy for the user. You can do this by issuing the following PowerShell
|
| 43 |
+
command:
|
| 44 |
+
|
| 45 |
+
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
| 46 |
+
|
| 47 |
+
For more information on Execution Policies:
|
| 48 |
+
https://go.microsoft.com/fwlink/?LinkID=135170
|
| 49 |
+
|
| 50 |
+
#>
|
| 51 |
+
Param(
|
| 52 |
+
[Parameter(Mandatory = $false)]
|
| 53 |
+
[String]
|
| 54 |
+
$VenvDir,
|
| 55 |
+
[Parameter(Mandatory = $false)]
|
| 56 |
+
[String]
|
| 57 |
+
$Prompt
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
<# Function declarations --------------------------------------------------- #>
|
| 61 |
+
|
| 62 |
+
<#
|
| 63 |
+
.Synopsis
|
| 64 |
+
Remove all shell session elements added by the Activate script, including the
|
| 65 |
+
addition of the virtual environment's Python executable from the beginning of
|
| 66 |
+
the PATH variable.
|
| 67 |
+
|
| 68 |
+
.Parameter NonDestructive
|
| 69 |
+
If present, do not remove this function from the global namespace for the
|
| 70 |
+
session.
|
| 71 |
+
|
| 72 |
+
#>
|
| 73 |
+
function global:deactivate ([switch]$NonDestructive) {
|
| 74 |
+
# Revert to original values
|
| 75 |
+
|
| 76 |
+
# The prior prompt:
|
| 77 |
+
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
|
| 78 |
+
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
|
| 79 |
+
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
# The prior PYTHONHOME:
|
| 83 |
+
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
|
| 84 |
+
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
|
| 85 |
+
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
# The prior PATH:
|
| 89 |
+
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
|
| 90 |
+
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
|
| 91 |
+
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
# Just remove the VIRTUAL_ENV altogether:
|
| 95 |
+
if (Test-Path -Path Env:VIRTUAL_ENV) {
|
| 96 |
+
Remove-Item -Path env:VIRTUAL_ENV
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
# Just remove VIRTUAL_ENV_PROMPT altogether.
|
| 100 |
+
if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
|
| 101 |
+
Remove-Item -Path env:VIRTUAL_ENV_PROMPT
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
| 105 |
+
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
| 106 |
+
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
# Leave deactivate function in the global namespace if requested:
|
| 110 |
+
if (-not $NonDestructive) {
|
| 111 |
+
Remove-Item -Path function:deactivate
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
<#
|
| 116 |
+
.Description
|
| 117 |
+
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
| 118 |
+
given folder, and returns them in a map.
|
| 119 |
+
|
| 120 |
+
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
| 121 |
+
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
| 122 |
+
then it is considered a `key = value` line. The left hand string is the key,
|
| 123 |
+
the right hand is the value.
|
| 124 |
+
|
| 125 |
+
If the value starts with a `'` or a `"` then the first and last character is
|
| 126 |
+
stripped from the value before being captured.
|
| 127 |
+
|
| 128 |
+
.Parameter ConfigDir
|
| 129 |
+
Path to the directory that contains the `pyvenv.cfg` file.
|
| 130 |
+
#>
|
| 131 |
+
function Get-PyVenvConfig(
|
| 132 |
+
[String]
|
| 133 |
+
$ConfigDir
|
| 134 |
+
) {
|
| 135 |
+
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
| 136 |
+
|
| 137 |
+
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
| 138 |
+
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
| 139 |
+
|
| 140 |
+
# An empty map will be returned if no config file is found.
|
| 141 |
+
$pyvenvConfig = @{ }
|
| 142 |
+
|
| 143 |
+
if ($pyvenvConfigPath) {
|
| 144 |
+
|
| 145 |
+
Write-Verbose "File exists, parse `key = value` lines"
|
| 146 |
+
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
| 147 |
+
|
| 148 |
+
$pyvenvConfigContent | ForEach-Object {
|
| 149 |
+
$keyval = $PSItem -split "\s*=\s*", 2
|
| 150 |
+
if ($keyval[0] -and $keyval[1]) {
|
| 151 |
+
$val = $keyval[1]
|
| 152 |
+
|
| 153 |
+
# Remove extraneous quotations around a string value.
|
| 154 |
+
if ("'""".Contains($val.Substring(0, 1))) {
|
| 155 |
+
$val = $val.Substring(1, $val.Length - 2)
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
$pyvenvConfig[$keyval[0]] = $val
|
| 159 |
+
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
+
return $pyvenvConfig
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
<# Begin Activate script --------------------------------------------------- #>
|
| 168 |
+
|
| 169 |
+
# Determine the containing directory of this script
|
| 170 |
+
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
| 171 |
+
$VenvExecDir = Get-Item -Path $VenvExecPath
|
| 172 |
+
|
| 173 |
+
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
| 174 |
+
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
| 175 |
+
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
| 176 |
+
|
| 177 |
+
# Set values required in priority: CmdLine, ConfigFile, Default
|
| 178 |
+
# First, get the location of the virtual environment, it might not be
|
| 179 |
+
# VenvExecDir if specified on the command line.
|
| 180 |
+
if ($VenvDir) {
|
| 181 |
+
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
| 182 |
+
}
|
| 183 |
+
else {
|
| 184 |
+
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
| 185 |
+
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
| 186 |
+
Write-Verbose "VenvDir=$VenvDir"
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
# Next, read the `pyvenv.cfg` file to determine any required value such
|
| 190 |
+
# as `prompt`.
|
| 191 |
+
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
| 192 |
+
|
| 193 |
+
# Next, set the prompt from the command line, or the config file, or
|
| 194 |
+
# just use the name of the virtual environment folder.
|
| 195 |
+
if ($Prompt) {
|
| 196 |
+
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
| 197 |
+
}
|
| 198 |
+
else {
|
| 199 |
+
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
| 200 |
+
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
| 201 |
+
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
| 202 |
+
$Prompt = $pyvenvCfg['prompt'];
|
| 203 |
+
}
|
| 204 |
+
else {
|
| 205 |
+
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
|
| 206 |
+
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
| 207 |
+
$Prompt = Split-Path -Path $venvDir -Leaf
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
Write-Verbose "Prompt = '$Prompt'"
|
| 212 |
+
Write-Verbose "VenvDir='$VenvDir'"
|
| 213 |
+
|
| 214 |
+
# Deactivate any currently active virtual environment, but leave the
|
| 215 |
+
# deactivate function in place.
|
| 216 |
+
deactivate -nondestructive
|
| 217 |
+
|
| 218 |
+
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
| 219 |
+
# that there is an activated venv.
|
| 220 |
+
$env:VIRTUAL_ENV = $VenvDir
|
| 221 |
+
|
| 222 |
+
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
| 223 |
+
|
| 224 |
+
Write-Verbose "Setting prompt to '$Prompt'"
|
| 225 |
+
|
| 226 |
+
# Set the prompt to include the env name
|
| 227 |
+
# Make sure _OLD_VIRTUAL_PROMPT is global
|
| 228 |
+
function global:_OLD_VIRTUAL_PROMPT { "" }
|
| 229 |
+
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
| 230 |
+
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
| 231 |
+
|
| 232 |
+
function global:prompt {
|
| 233 |
+
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
| 234 |
+
_OLD_VIRTUAL_PROMPT
|
| 235 |
+
}
|
| 236 |
+
$env:VIRTUAL_ENV_PROMPT = $Prompt
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
# Clear PYTHONHOME
|
| 240 |
+
if (Test-Path -Path Env:PYTHONHOME) {
|
| 241 |
+
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
| 242 |
+
Remove-Item -Path Env:PYTHONHOME
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
# Add the venv to the PATH
|
| 246 |
+
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
| 247 |
+
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
myenv/bin/activate
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file must be used with "source bin/activate" *from bash*
|
| 2 |
+
# you cannot run it directly
|
| 3 |
+
|
| 4 |
+
deactivate () {
|
| 5 |
+
# reset old environment variables
|
| 6 |
+
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
| 7 |
+
PATH="${_OLD_VIRTUAL_PATH:-}"
|
| 8 |
+
export PATH
|
| 9 |
+
unset _OLD_VIRTUAL_PATH
|
| 10 |
+
fi
|
| 11 |
+
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
| 12 |
+
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
| 13 |
+
export PYTHONHOME
|
| 14 |
+
unset _OLD_VIRTUAL_PYTHONHOME
|
| 15 |
+
fi
|
| 16 |
+
|
| 17 |
+
# This should detect bash and zsh, which have a hash command that must
|
| 18 |
+
# be called to get it to forget past commands. Without forgetting
|
| 19 |
+
# past commands the $PATH changes we made may not be respected
|
| 20 |
+
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
| 21 |
+
hash -r 2> /dev/null
|
| 22 |
+
fi
|
| 23 |
+
|
| 24 |
+
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
| 25 |
+
PS1="${_OLD_VIRTUAL_PS1:-}"
|
| 26 |
+
export PS1
|
| 27 |
+
unset _OLD_VIRTUAL_PS1
|
| 28 |
+
fi
|
| 29 |
+
|
| 30 |
+
unset VIRTUAL_ENV
|
| 31 |
+
unset VIRTUAL_ENV_PROMPT
|
| 32 |
+
if [ ! "${1:-}" = "nondestructive" ] ; then
|
| 33 |
+
# Self destruct!
|
| 34 |
+
unset -f deactivate
|
| 35 |
+
fi
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
# unset irrelevant variables
|
| 39 |
+
deactivate nondestructive
|
| 40 |
+
|
| 41 |
+
VIRTUAL_ENV="/Users/jess/Desktop/mh/quotation_chatbot/myenv"
|
| 42 |
+
export VIRTUAL_ENV
|
| 43 |
+
|
| 44 |
+
_OLD_VIRTUAL_PATH="$PATH"
|
| 45 |
+
PATH="$VIRTUAL_ENV/bin:$PATH"
|
| 46 |
+
export PATH
|
| 47 |
+
|
| 48 |
+
# unset PYTHONHOME if set
|
| 49 |
+
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
| 50 |
+
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
| 51 |
+
if [ -n "${PYTHONHOME:-}" ] ; then
|
| 52 |
+
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
| 53 |
+
unset PYTHONHOME
|
| 54 |
+
fi
|
| 55 |
+
|
| 56 |
+
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
| 57 |
+
_OLD_VIRTUAL_PS1="${PS1:-}"
|
| 58 |
+
PS1="(myenv) ${PS1:-}"
|
| 59 |
+
export PS1
|
| 60 |
+
VIRTUAL_ENV_PROMPT="(myenv) "
|
| 61 |
+
export VIRTUAL_ENV_PROMPT
|
| 62 |
+
fi
|
| 63 |
+
|
| 64 |
+
# This should detect bash and zsh, which have a hash command that must
|
| 65 |
+
# be called to get it to forget past commands. Without forgetting
|
| 66 |
+
# past commands the $PATH changes we made may not be respected
|
| 67 |
+
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
| 68 |
+
hash -r 2> /dev/null
|
| 69 |
+
fi
|
myenv/bin/activate.csh
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file must be used with "source bin/activate.csh" *from csh*.
|
| 2 |
+
# You cannot run it directly.
|
| 3 |
+
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
| 4 |
+
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
| 5 |
+
|
| 6 |
+
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate'
|
| 7 |
+
|
| 8 |
+
# Unset irrelevant variables.
|
| 9 |
+
deactivate nondestructive
|
| 10 |
+
|
| 11 |
+
setenv VIRTUAL_ENV "/Users/jess/Desktop/mh/quotation_chatbot/myenv"
|
| 12 |
+
|
| 13 |
+
set _OLD_VIRTUAL_PATH="$PATH"
|
| 14 |
+
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
set _OLD_VIRTUAL_PROMPT="$prompt"
|
| 18 |
+
|
| 19 |
+
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
| 20 |
+
set prompt = "(myenv) $prompt"
|
| 21 |
+
setenv VIRTUAL_ENV_PROMPT "(myenv) "
|
| 22 |
+
endif
|
| 23 |
+
|
| 24 |
+
alias pydoc python -m pydoc
|
| 25 |
+
|
| 26 |
+
rehash
|
myenv/bin/activate.fish
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file must be used with "source <venv>/bin/activate.fish" *from fish*
|
| 2 |
+
# (https://fishshell.com/); you cannot run it directly.
|
| 3 |
+
|
| 4 |
+
function deactivate -d "Exit virtual environment and return to normal shell environment"
|
| 5 |
+
# reset old environment variables
|
| 6 |
+
if test -n "$_OLD_VIRTUAL_PATH"
|
| 7 |
+
set -gx PATH $_OLD_VIRTUAL_PATH
|
| 8 |
+
set -e _OLD_VIRTUAL_PATH
|
| 9 |
+
end
|
| 10 |
+
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
| 11 |
+
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
| 12 |
+
set -e _OLD_VIRTUAL_PYTHONHOME
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
| 16 |
+
set -e _OLD_FISH_PROMPT_OVERRIDE
|
| 17 |
+
# prevents error when using nested fish instances (Issue #93858)
|
| 18 |
+
if functions -q _old_fish_prompt
|
| 19 |
+
functions -e fish_prompt
|
| 20 |
+
functions -c _old_fish_prompt fish_prompt
|
| 21 |
+
functions -e _old_fish_prompt
|
| 22 |
+
end
|
| 23 |
+
end
|
| 24 |
+
|
| 25 |
+
set -e VIRTUAL_ENV
|
| 26 |
+
set -e VIRTUAL_ENV_PROMPT
|
| 27 |
+
if test "$argv[1]" != "nondestructive"
|
| 28 |
+
# Self-destruct!
|
| 29 |
+
functions -e deactivate
|
| 30 |
+
end
|
| 31 |
+
end
|
| 32 |
+
|
| 33 |
+
# Unset irrelevant variables.
|
| 34 |
+
deactivate nondestructive
|
| 35 |
+
|
| 36 |
+
set -gx VIRTUAL_ENV "/Users/jess/Desktop/mh/quotation_chatbot/myenv"
|
| 37 |
+
|
| 38 |
+
set -gx _OLD_VIRTUAL_PATH $PATH
|
| 39 |
+
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
|
| 40 |
+
|
| 41 |
+
# Unset PYTHONHOME if set.
|
| 42 |
+
if set -q PYTHONHOME
|
| 43 |
+
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
| 44 |
+
set -e PYTHONHOME
|
| 45 |
+
end
|
| 46 |
+
|
| 47 |
+
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
| 48 |
+
# fish uses a function instead of an env var to generate the prompt.
|
| 49 |
+
|
| 50 |
+
# Save the current fish_prompt function as the function _old_fish_prompt.
|
| 51 |
+
functions -c fish_prompt _old_fish_prompt
|
| 52 |
+
|
| 53 |
+
# With the original prompt function renamed, we can override with our own.
|
| 54 |
+
function fish_prompt
|
| 55 |
+
# Save the return status of the last command.
|
| 56 |
+
set -l old_status $status
|
| 57 |
+
|
| 58 |
+
# Output the venv prompt; color taken from the blue of the Python logo.
|
| 59 |
+
printf "%s%s%s" (set_color 4B8BBE) "(myenv) " (set_color normal)
|
| 60 |
+
|
| 61 |
+
# Restore the return status of the previous command.
|
| 62 |
+
echo "exit $old_status" | .
|
| 63 |
+
# Output the original/"old" prompt.
|
| 64 |
+
_old_fish_prompt
|
| 65 |
+
end
|
| 66 |
+
|
| 67 |
+
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
| 68 |
+
set -gx VIRTUAL_ENV_PROMPT "(myenv) "
|
| 69 |
+
end
|
myenv/bin/debugpy
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from debugpy.server.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/distro
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from distro.distro import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/dotenv
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from dotenv.__main__ import cli
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli())
|
myenv/bin/f2py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from numpy.f2py.f2py2e import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/fastapi
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from fastapi.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/git-filter-repo
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from git_filter_repo import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/gradio
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from gradio.cli import cli
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli())
|
myenv/bin/httpx
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from httpx import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/huggingface-cli
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from huggingface_hub.commands.huggingface_cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/ipython
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from IPython import start_ipython
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(start_ipython())
|
myenv/bin/ipython3
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from IPython import start_ipython
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(start_ipython())
|
myenv/bin/jupyter
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from jupyter_core.command import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/jupyter-kernel
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from jupyter_client.kernelapp import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/jupyter-kernelspec
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from jupyter_client.kernelspecapp import KernelSpecApp
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(KernelSpecApp.launch_instance())
|
myenv/bin/jupyter-migrate
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from jupyter_core.migrate import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/jupyter-run
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from jupyter_client.runapp import RunApp
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(RunApp.launch_instance())
|
myenv/bin/jupyter-troubleshoot
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from jupyter_core.troubleshoot import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/markdown-it
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from markdown_it.cli.parse import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/normalizer
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from charset_normalizer.cli import cli_detect
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli_detect())
|
myenv/bin/numpy-config
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from numpy._configtool import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/openai
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from openai.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/opentelemetry-bootstrap
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from opentelemetry.instrumentation.bootstrap import run
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(run())
|
myenv/bin/opentelemetry-instrument
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from opentelemetry.instrumentation.auto_instrumentation import run
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(run())
|
myenv/bin/pip
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pip._internal.cli.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/pip3
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pip._internal.cli.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/pip3.11
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pip._internal.cli.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/pygmentize
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pygments.cmdline import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/python
ADDED
|
Binary file (153 kB). View file
|
|
|
myenv/bin/python3
ADDED
|
Binary file (153 kB). View file
|
|
|
myenv/bin/python3.11
ADDED
|
Binary file (153 kB). View file
|
|
|
myenv/bin/ruff
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5f35c86ca83978276cfe0b5db15b1c7ed5377d60c63a38f2e801a1fcc044347b
|
| 3 |
+
size 27775688
|
myenv/bin/tests
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from poetry_scripts import run_tests
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(run_tests())
|
myenv/bin/tqdm
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from tqdm.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/transformers-cli
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from transformers.commands.transformers_cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/typer
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from typer.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/upload_theme
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from gradio.themes.upload_theme import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/bin/uvicorn
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/jess/Desktop/mh/quotation_chatbot/myenv/bin/python3.11
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from uvicorn.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
myenv/lib/python3.11/site-packages/Columnar-1.3.1.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
myenv/lib/python3.11/site-packages/Columnar-1.3.1.dist-info/LICENSE.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright 2019 Max Taggart
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
| 4 |
+
|
| 5 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
| 6 |
+
|
| 7 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|