Update app.py
Browse files
app.py
CHANGED
|
@@ -87,25 +87,45 @@ def analyze_coordination_needs(user_message, department, user_name, image=None):
|
|
| 87 |
image.save(buffered, format="PNG")
|
| 88 |
img_base64 = base64.b64encode(buffered.getvalue()).decode()
|
| 89 |
|
| 90 |
-
prompt = f"""
|
|
|
|
| 91 |
|
| 92 |
-
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
- Requestor: {user_name}
|
| 97 |
-
- Message: {user_message}
|
| 98 |
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
5. What follow-up might be needed
|
| 106 |
|
| 107 |
-
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
try:
|
| 110 |
response = requests.post(
|
| 111 |
"https://openrouter.ai/api/v1/chat/completions",
|
|
@@ -148,22 +168,52 @@ Please format your response in a friendly, conversational way that's easy to rea
|
|
| 148 |
|
| 149 |
else:
|
| 150 |
# Text-only analysis
|
| 151 |
-
prompt = f"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
-
|
|
|
|
| 154 |
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
- What specific steps should be taken next
|
| 163 |
-
- What priority this request should have
|
| 164 |
-
- What follow-up might be needed
|
| 165 |
|
| 166 |
-
|
|
|
|
|
|
|
| 167 |
|
| 168 |
try:
|
| 169 |
response = requests.post(
|
|
|
|
| 87 |
image.save(buffered, format="PNG")
|
| 88 |
img_base64 = base64.b64encode(buffered.getvalue()).decode()
|
| 89 |
|
| 90 |
+
prompt = f"""
|
| 91 |
+
You are an Enterprise Operations Coordination AI.
|
| 92 |
|
| 93 |
+
Analyze the request AND the attached image to determine responsibility and next actions.
|
| 94 |
|
| 95 |
+
Write formally and professionally.
|
| 96 |
+
No casual tone. No emojis.
|
|
|
|
|
|
|
| 97 |
|
| 98 |
+
AVAILABLE DEPARTMENTS:
|
| 99 |
+
- Administration: approvals, management, coordination
|
| 100 |
+
- Production: equipment, facilities, manufacturing, maintenance
|
| 101 |
+
- Magazine: design, content, publishing
|
| 102 |
|
| 103 |
+
REQUEST:
|
| 104 |
+
Requestor: {user_name}
|
| 105 |
+
Origin Department: {department}
|
| 106 |
+
Message: {user_message}
|
|
|
|
| 107 |
|
| 108 |
+
Provide:
|
| 109 |
|
| 110 |
+
=== EXECUTIVE SUMMARY ===
|
| 111 |
+
Short professional summary
|
| 112 |
+
|
| 113 |
+
=== IMAGE OBSERVATIONS ===
|
| 114 |
+
Important findings from the image
|
| 115 |
+
|
| 116 |
+
=== RECOMMENDED TARGET DEPARTMENT ===
|
| 117 |
+
Choose ONLY ONE: Administration | Production | Magazine
|
| 118 |
+
Reason
|
| 119 |
+
|
| 120 |
+
=== ACTION PLAN ===
|
| 121 |
+
Numbered steps
|
| 122 |
+
|
| 123 |
+
=== PRIORITY ===
|
| 124 |
+
Low | Medium | High with reason
|
| 125 |
+
|
| 126 |
+
=== FOLLOW-UP ===
|
| 127 |
+
Monitoring or escalation steps
|
| 128 |
+
"""
|
| 129 |
try:
|
| 130 |
response = requests.post(
|
| 131 |
"https://openrouter.ai/api/v1/chat/completions",
|
|
|
|
| 168 |
|
| 169 |
else:
|
| 170 |
# Text-only analysis
|
| 171 |
+
prompt = prompt = f"""
|
| 172 |
+
You are an Enterprise Operations Coordination AI used inside a professional organization.
|
| 173 |
+
|
| 174 |
+
Your responsibility is to:
|
| 175 |
+
• analyze the request
|
| 176 |
+
• determine which department should handle it
|
| 177 |
+
• produce a concise, executive-style coordination plan
|
| 178 |
+
|
| 179 |
+
Write formally and professionally.
|
| 180 |
+
Do NOT use conversational tone.
|
| 181 |
+
Do NOT use emojis.
|
| 182 |
+
Be precise, structured, and action-oriented.
|
| 183 |
+
|
| 184 |
+
AVAILABLE DEPARTMENTS:
|
| 185 |
+
- Administration: management, approvals, policies, finance, coordination
|
| 186 |
+
- Production: manufacturing, maintenance, equipment, operations, logistics
|
| 187 |
+
- Magazine: content creation, publishing, marketing materials, communication
|
| 188 |
+
|
| 189 |
+
REQUEST:
|
| 190 |
+
Requestor: {user_name}
|
| 191 |
+
Origin Department: {department}
|
| 192 |
+
Message: {user_message}
|
| 193 |
+
|
| 194 |
+
Return your answer STRICTLY using this format:
|
| 195 |
+
|
| 196 |
+
=== EXECUTIVE SUMMARY ===
|
| 197 |
+
2–3 sentence professional summary.
|
| 198 |
+
|
| 199 |
+
=== RECOMMENDED TARGET DEPARTMENT ===
|
| 200 |
+
Choose ONLY ONE: Administration | Production | Magazine
|
| 201 |
+
Brief justification.
|
| 202 |
|
| 203 |
+
=== DEPARTMENTS INVOLVED ===
|
| 204 |
+
• Department – responsibility
|
| 205 |
|
| 206 |
+
=== ACTION PLAN ===
|
| 207 |
+
1. Step
|
| 208 |
+
2. Step
|
| 209 |
+
3. Step
|
| 210 |
|
| 211 |
+
=== PRIORITY ===
|
| 212 |
+
Low | Medium | High with reason
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
+
=== FOLLOW-UP ===
|
| 215 |
+
Required monitoring or reporting actions
|
| 216 |
+
"""
|
| 217 |
|
| 218 |
try:
|
| 219 |
response = requests.post(
|