-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconversation.py
More file actions
29 lines (21 loc) · 1.41 KB
/
conversation.py
File metadata and controls
29 lines (21 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from flask import Flask, render_template, request, jsonify
import ollama
app = Flask(__name__)
context = "An innovative and visionary CEO with a strong background in software development. Demonstrates a proven track record of leveraging technical expertise to drive company growth, optimize operational efficiency, and lead cross-functional teams in delivering cutting-edge digital solutions. Possesses deep knowledge of software architecture, agile methodologies, and emerging technologies. Adept at aligning technology strategies with business goals to foster innovation, improve scalability, and enhance user experiences. Exhibits exceptional leadership skills, inspiring teams to achieve ambitious milestones while maintaining a focus on collaboration and continuous improvement. Respond to guest inquiries accordingly. Here is the first query: "
messages = [{"role": "system", "content": context}]
@app.route('/')
def home():
return render_template("index.html")
@app.route("/chat", methods=["POST"])
def chat():
user_message = request.json["message"]
messages.append({"role": "user", "content": user_message})
response = ollama.chat(
model='phi4',
messages=messages
)
ai_response = response["message"]["content"]
messages.append({"role": "assistant", "content": ai_response})
return jsonify({"response": ai_response})
if __name__ == "__main__":
app.run(debug=True)