Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
final
Browse files Browse the repository at this point in the history
  • Loading branch information
Faheem Kulangara Kandiyil authored and Faheem Kulangara Kandiyil committed Nov 23, 2024
1 parent 0d7b3b1 commit 4abbfd7
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 27 deletions.
2 changes: 1 addition & 1 deletion data_sources/slack_channel_data/process_slack_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def clean_slack_data(raw_message):
return raw_message # Return original if processing fails

# Read the CSV file
df = pd.read_csv('data_sources/slack_channel_data/#advanced-support_large_replies.csv')
df = pd.read_csv('data_sources/slack_channel_data/#advanced-support_breakdown - compiled.csv')

# Clean the specific column (replace 'conversation_column' with your column name)
df['content'] = df['conversation'].apply(clean_slack_data)
Expand Down
14 changes: 14 additions & 0 deletions hb_cs_genie/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions hb_cs_genie/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@testing-library/user-event": "^13.5.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-loading-indicators": "^1.0.0",
"react-markdown": "^9.0.1",
"react-scripts": "^5.0.1",
"web-vitals": "^2.1.4"
Expand Down
39 changes: 37 additions & 2 deletions hb_cs_genie/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ body {

.search-button {
transition: all 0.2s ease !important;
background: #8B5CF6 !important; /* Base color */
background: #9c39c7 !important; /* Base color */
}

.search-button:hover:not(:disabled) {
background: linear-gradient(135deg, #9f85ff 0%, #7e5cf6 100%) !important;
background: linear-gradient(135deg, #6506a9 0%, #4B0082 100%) !important;
}

.search-button:active {
Expand All @@ -143,3 +143,38 @@ body {
50% { transform: scale(0.98); }
100% { transform: scale(1); }
}

.title-wrapper {
position: relative;
display: inline-block;
cursor: pointer;
padding: 10px 0;
}

.title-text {
background: linear-gradient(150deg, #4B0082 10%, #b93eff 90%);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: bold;
transition: transform 0.3s ease;
}

.line-reveal {
position: absolute;
left: 50%;
bottom: 0;
height: 1.5px;
width: 0;
background: linear-gradient(90deg, #4B0082, #b93eff);
transition: width 0.6s ease;
transform: translateX(-50%);
}

.title-wrapper:hover .line-reveal {
width: 100%;
}

.title-wrapper:hover .title-text {
transform: translateY(-2px);
}
54 changes: 32 additions & 22 deletions hb_cs_genie/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import {
Container,
} from "@mantine/core";
import { IconSearch } from '@tabler/icons-react';
import { ThreeDot } from 'react-loading-indicators'

function App() {
const [question, setQuestion] = useState('')
const [currentQuestion, setCurrentQuestion] = useState('')
const [id, setId] = useState(null)
const [status, setStatus] = useState('completed')
const [answer, setAnswer] = useState('')
Expand All @@ -37,7 +39,7 @@ function App() {
setStatus('answered');
console.log(answer)
setQaHistory(prevHistory => [{
question: question,
question: currentQuestion,
answer: data.answer
}, ...prevHistory]);
break;
Expand Down Expand Up @@ -67,12 +69,14 @@ function App() {
// Clean up any pending timeouts if component unmounts
clearTimeout();
};
}, [status, answer, id]); // Add id to dependencies
}, [status, answer, id, currentQuestion]); // Add id and currentQuestion to dependencies

const handleSubmit = async (e) => {
e.preventDefault();
if (!question.trim() || status === 'in-progress') return;

setCurrentQuestion(question);
setQuestion('');
setStatus('submitting');
setError(null);
setAnswer(null);
Expand Down Expand Up @@ -106,18 +110,22 @@ function App() {
>
{/* Title Section */}
<Box style={{ textAlign: 'center', marginBottom: '60px' }}>
<Title order={1} style={{
fontSize: '2.5rem',
marginBottom: '10px',
background: 'linear-gradient(140deg, #693eff 20%, #b93eff 100%)',
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
backgroundClip: 'text'
}}>
Homebase Genie
<Title
order={1}
className="title-wrapper"
style={{
fontSize: '2.5rem',
marginBottom: '0px',
display: 'inline-block'
}}
>
<span className="title-text">
Homebase Genie
</span>
<div className="line-reveal" />
</Title>
<Text size="lg" color="dimmed">
Built by Queryous Minds.
<Text size="lg" style={{ color: '#6b6b6b' }}>
Built by Queryous Minds and LLMs.
</Text>
</Box>

Expand All @@ -134,7 +142,7 @@ function App() {
<form onSubmit={handleSubmit}>
<Box style={{ display: 'flex', gap: '10px' }}>
<TextInput
placeholder="Ask a question related to Homebase product..."
placeholder="Enter your Homebase-related question here..."
value={question}
onChange={(e) => setQuestion(e.target.value)}
disabled={status === 'in-progress'}
Expand All @@ -155,7 +163,7 @@ function App() {
paddingLeft: '20px',
paddingRight: '20px',
overflow: 'hidden',
textOverflow: 'ellipsis',
textOverflow: 'ellipsis'
},
wrapper: {
width: '450px',
Expand All @@ -168,7 +176,7 @@ function App() {
disabled={!question.trim() || status === 'in-progress'}
loading={status === 'in-progress'}
style={{
backgroundColor: '#8B5CF6',
backgroundColor: '#4B0082',
height: '48px',
padding: '0 30px',
borderRadius: '14px',
Expand Down Expand Up @@ -200,9 +208,9 @@ function App() {
{/* Results Section */}
<Box style={{ maxWidth: '600px', margin: '20px auto' }}>
{status === 'in-progress' && (
<Text align="center" color="dimmed">
Thinking...
</Text>
<Box style={{ display: 'flex', justifyContent: 'center', marginTop: '30px', marginBottom: '30px' }}>
<ThreeDot color="#8B5CF6" size="small" text="" textColor="#8B5CF6" />
</Box>
)}

{qaHistory.map((qa, index) => (
Expand All @@ -221,16 +229,18 @@ function App() {
mb={10}
style={{
fontWeight: 700, // Make question bold
color: '#1a1a1a' // Darker color for better contrast
color: '#1a1a1a', // Darker color for better contrast
fontSize: '14px'
}}
>
{qa.question}
</Text>
<Box
style={{
marginTop: '15px',
marginTop: '5px',
borderTop: '1px solid #f0f0f0',
paddingTop: '15px'
paddingTop: '5px',
fontSize: '14px'
}}
>
<ReactMarkdown
Expand Down
4 changes: 2 additions & 2 deletions llm/qa_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def construct_prompt(self, question: str, context_chunks: List[Dict]) -> str:
"If the answer cannot be found in the context, say 'I don't have enough information to answer that question.' "
"Total output characters should be less than 50000. "
"If you find the answer, include the relevant article URLs at the bottom of your response using the format: "
"\n\n---\n\nFor more information, see: [Article Title or Slack thread url](URL)\n\n"
"\n\n---\n\nFor more information, see: [Title and if title not available URL](URL)\n\n"
)
context = ""
total_tokens = self.count_tokens(base_prompt + question)
Expand Down Expand Up @@ -169,7 +169,7 @@ def generate_answer(self, question: str) -> str:
model=self.model,
max_tokens=1000,
messages=[{"role": "user", "content": prompt}],
temperature=1
temperature=0.3
)

return response.content[0].text
Expand Down

0 comments on commit 4abbfd7

Please sign in to comment.