HelenaXH commited on
Commit
1454d37
·
verified ·
1 Parent(s): f56bf7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -34
app.py CHANGED
@@ -119,29 +119,46 @@ def answer_abc_questions(selected, bg_info, wv, ps, dd):
119
  desired_parts.append("C")
120
 
121
  if not desired_parts:
122
- return "好的,你暂时不需要查看A/B/C的专项信息。"
123
 
124
  prompt_text = f"""
125
- 你是一位专业的职业规划顾问。以下是学生背景信息,请根据他选择的模块(A/B/C)给出详细分析和建议。
126
- 学生背景:
127
- - 学术背景: {bg_info}
128
- - 工作意义: {wv}
129
- - 性格: {ps}
130
- - 理想工作: {dd}
131
- 学生目前想要的额外信息模块:{', '.join(desired_parts)}
132
- 请分别按顺序为每个模块写一段分析和建议,可以使用Markdown分段形式。
133
- (A: 专业/选课方向 & 求职入门建议部分的回答请根据学生的学术背景信息分析学生已经有的能力,然后根据其选择的职业方向分析该学生未来的选课应该注重什么课程方向,提示学生课程名称和关键词)
134
- ('B: 本校资源利用建议'部分的回答请你从3个方面回答学生,包括1.如何利用学校的career service;2.如何关注学校与职业准备和证书考试相关的club、组织和平台;3.学生如何与学校的及其所在专业的校友取得联系和networking技巧)
135
- ('C: 实习 & Experience积累'部分的回答请你从申请internship的平台、达成目前职业目标需要的internship方向,申请需要的资料和准备技巧、通过networking获得实习或者学生工作经历的策略)
136
- 请只回答用户所选模块,不要回答未选的模块。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  """
138
  try:
139
  api_key = os.environ.get("API_TOKEN")
140
  if not api_key:
141
- return "错误:API_TOKEN 未设置"
142
  client = OpenAI(api_key=api_key)
143
  msgs = [
144
- {"role": "system", "content": "你是一位专业职业顾问,会针对A/B/C进行分析。"},
145
  {"role": "user", "content": prompt_text}
146
  ]
147
  resp = client.chat.completions.create(
@@ -154,35 +171,39 @@ def answer_abc_questions(selected, bg_info, wv, ps, dd):
154
  )
155
  return resp.choices[0].message.content
156
  except Exception as e:
157
- return f"生成A/B/C专项信息时出错: {str(e)}"
 
158
 
159
 
160
- # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 职业详细介绍 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
161
  def do_selected_career_detail(selected_career, bg_info, wv, ps, dd):
162
  prompt = f"""
163
- 你是一位专业的职业规划顾问。
164
- 学生最终选择的具体职业: {selected_career}
165
- 学生背景: {bg_info}
166
- 工作意义: {wv}
167
- 性格: {ps}
168
- 理想工作: {dd}
169
- 请写一份更详细的职业说明,至少包含:
170
- 1. 行业平均薪资(初级/中级/高级)
171
- 2. 工作环境(远程/混合/办公室,团队规模等)
172
- 3. 晋升难度(需要什么资历或条件)
173
- 4. 关键技能和考证
174
- 5. 日常工作节奏
175
- 6. 行业前景
176
- 用分段Markdown格式,字数不少于300字。
 
 
 
 
177
  """
178
  try:
179
  api_key = os.environ.get("API_TOKEN")
180
  if not api_key:
181
- return "错误:API_TOKEN 未设置"
182
  client = OpenAI(api_key=api_key)
183
 
184
  msgs = [
185
- {"role": "system", "content": "你是一位专业职业顾问,会为用户选定的具体职业提供详细的分析。"},
186
  {"role": "user", "content": prompt}
187
  ]
188
  resp = client.chat.completions.create(
@@ -195,7 +216,7 @@ def do_selected_career_detail(selected_career, bg_info, wv, ps, dd):
195
  )
196
  return resp.choices[0].message.content
197
  except Exception as e:
198
- return f"生成职业详细信息时出错: {str(e)}"
199
 
200
 
201
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 时间轴式规划 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
119
  desired_parts.append("C")
120
 
121
  if not desired_parts:
122
+ return "OK, you don't need ABC"
123
 
124
  prompt_text = f"""
125
+ You are a professional career planning advisor. Below is the student's background information. Please provide detailed analysis and suggestions based on the selected module(s): A, B, or C.
126
+
127
+ Student Profile:
128
+ - Academic Background: {bg_info}
129
+ - Work Value: {wv}
130
+ - Personality: {ps}
131
+ - Ideal Workday: {dd}
132
+
133
+ The student wants insights on the following module(s): {', '.join(desired_parts)}
134
+ Please write a separate section for each selected module in order, using Markdown formatting.
135
+
136
+ (A: Course Selection & Career Entry)
137
+ - Analyze the student’s current academic background and what capabilities they already have.
138
+ - Based on their intended career, recommend what types of courses they should focus on.
139
+ - Suggest course names and keywords to guide their course planning.
140
+
141
+ (B: School Resource Utilization)
142
+ - Provide 3 types of suggestions:
143
+ 1. How to utilize the university's career services.
144
+ 2. How to get involved with career-related clubs, organizations, and platforms.
145
+ 3. How to network with alumni in their field and improve networking skills.
146
+
147
+ (C: Internships & Experience Building)
148
+ - Suggest platforms to find internships.
149
+ - Recommend internship directions aligned with the student’s career goal.
150
+ - Provide tips for preparing materials and applying.
151
+ - Strategies for gaining experience through networking, internships, or campus jobs.
152
+
153
+ Only include the modules selected by the student. Do not generate content for unselected modules.
154
  """
155
  try:
156
  api_key = os.environ.get("API_TOKEN")
157
  if not api_key:
158
+ return "Wrong:API_TOKEN Not set"
159
  client = OpenAI(api_key=api_key)
160
  msgs = [
161
+ {"role": "system", "content": "You are a professional career advisor who provides module-specific (A/B/C) analysis and suggestions."},
162
  {"role": "user", "content": prompt_text}
163
  ]
164
  resp = client.chat.completions.create(
 
171
  )
172
  return resp.choices[0].message.content
173
  except Exception as e:
174
+ return f"Wrong ABC: {str(e)}"
175
+
176
 
177
 
 
178
  def do_selected_career_detail(selected_career, bg_info, wv, ps, dd):
179
  prompt = f"""
180
+ You are a professional career planning advisor.
181
+
182
+ The student has selected the following specific career: {selected_career}
183
+ Student Profile:
184
+ - Academic Background: {bg_info}
185
+ - Work Value: {wv}
186
+ - Personality: {ps}
187
+ - Ideal Workday: {dd}
188
+
189
+ Please write a detailed description of this career including at least the following:
190
+ 1. Average salary (entry-level / mid-level / senior)
191
+ 2. Work environment (remote/hybrid/in-office, team size, etc.)
192
+ 3. Promotion difficulty (what qualifications or milestones are needed)
193
+ 4. Key skills and certifications required
194
+ 5. Typical work rhythm (fast-paced or routine?)
195
+ 6. Industry outlook
196
+
197
+ Please use Markdown formatting in separate sections, with a minimum of 300 words.
198
  """
199
  try:
200
  api_key = os.environ.get("API_TOKEN")
201
  if not api_key:
202
+ return "Wrong:API_TOKEN not set"
203
  client = OpenAI(api_key=api_key)
204
 
205
  msgs = [
206
+ {"role": "system", "content": "You are a professional career advisor who provides in-depth career descriptions."},
207
  {"role": "user", "content": prompt}
208
  ]
209
  resp = client.chat.completions.create(
 
216
  )
217
  return resp.choices[0].message.content
218
  except Exception as e:
219
+ return f"Wrong path: {str(e)}"
220
 
221
 
222
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 时间轴式规划 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~